@octaviaflow/core 3.1.0-beta.77 → 3.1.0-beta.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-FJHUWP4K.js +2756 -0
- package/dist/chunk-FJHUWP4K.js.map +1 -0
- package/dist/chunk-PB4O5GEF.js +5701 -0
- package/dist/chunk-PB4O5GEF.js.map +1 -0
- package/dist/chunk-XD5G2K2M.js +1646 -0
- package/dist/chunk-XD5G2K2M.js.map +1 -0
- package/dist/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/OnboardingFlow/OnboardingFlow.d.ts +8 -2
- package/dist/components/OnboardingFlow/OnboardingFlow.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/index.cjs +91 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +92 -77
- package/dist/index.js.map +1 -1
- package/dist/marketing.cjs +1 -0
- package/dist/marketing.cjs.map +1 -1
- package/dist/marketing.js +2 -2
- package/dist/workflow.cjs +2 -0
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Accordion/Accordion.tsx","../src/components/Button/Button.tsx","../src/utils/a11y.ts","../src/utils/Slot.tsx","../src/utils/composeRefs.ts","../src/components/Input/Input.tsx","../src/components/Tooltip/Tooltip.tsx","../../../node_modules/react-stately/dist/private/utils/packages/react-stately/src/utils/useControlledState.ts","../../../node_modules/react-stately/dist/private/form/packages/react-stately/src/form/useFormValidationState.ts","../../../node_modules/react-stately/dist/private/collections/packages/react-stately/src/collections/getChildNodes.ts","../../../node_modules/react-stately/dist/private/list/packages/react-stately/src/list/ListCollection.ts","../../../node_modules/react-stately/dist/private/selection/packages/react-stately/src/selection/Selection.ts","../../../node_modules/react-stately/dist/private/selection/packages/react-stately/src/selection/useMultipleSelectionState.ts","../../../node_modules/react-stately/dist/private/selection/packages/react-stately/src/selection/SelectionManager.ts","../../../node_modules/react-stately/dist/private/collections/packages/react-stately/src/collections/CollectionBuilder.ts","../../../node_modules/react-stately/dist/private/collections/packages/react-stately/src/collections/useCollection.ts","../../../node_modules/react-stately/dist/private/list/packages/react-stately/src/list/useListState.ts","../../../node_modules/react-stately/dist/private/overlays/packages/react-stately/src/overlays/useOverlayTriggerState.ts","../../../node_modules/react-stately/dist/private/collections/packages/react-stately/src/collections/Item.ts","../../../node_modules/react-stately/dist/private/list/packages/react-stately/src/list/useSingleSelectListState.ts","../../../node_modules/react-stately/dist/private/menu/packages/react-stately/src/menu/useMenuTriggerState.ts","../../../node_modules/react-stately/dist/private/radio/packages/react-stately/src/radio/useRadioGroupState.ts","../../../node_modules/react-stately/dist/private/select/packages/react-stately/src/select/useSelectState.ts","../../../node_modules/react-stately/dist/private/tabs/packages/react-stately/src/tabs/useTabListState.ts","../../../node_modules/react-stately/dist/private/toggle/packages/react-stately/src/toggle/useToggleState.ts","../../../node_modules/react-stately/dist/private/tooltip/packages/react-stately/src/tooltip/useTooltipTriggerState.ts","../../../node_modules/react-stately/dist/private/tree/packages/react-stately/src/tree/TreeCollection.ts","../../../node_modules/react-stately/dist/private/tree/packages/react-stately/src/tree/useTreeState.ts","../src/components/Select/Select.tsx","../src/components/Spinner/Spinner.tsx"],"sourcesContent":["\"use client\";\nimport { ChevronDownIcon } from \"@octaviaflow/icons\";\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type KeyboardEvent,\n type ReactNode,\n useCallback,\n useId,\n useState,\n} from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/* ---------------------------------------------------------------------------\n * Accordion — collapsible content sections.\n *\n * Used in ConfigPanel-style settings surfaces, FAQ blocks, runbook\n * docs, advanced-options sections. Two selection modes:\n * - `single` (default): only one item open at a time\n * - `multiple`: any combination of items can be open\n *\n * Controlled OR uncontrolled. Animated expand/collapse via\n * framer-motion (respects reduced-motion). Keyboard nav follows the\n * WAI-ARIA accordion pattern: ↑↓ moves between triggers, Home/End\n * jump to first/last, Enter/Space toggles.\n *\n * A11y: each item is `<div>` with a `<button aria-expanded>` header\n * and a `<div role=\"region\" aria-labelledby>` content panel.\n * ------------------------------------------------------------------------- */\n\nexport type AccordionMode = \"single\" | \"multiple\";\nexport type AccordionVariant = \"default\" | \"bordered\" | \"separated\";\n\nexport interface AccordionItem {\n /** Stable identifier. */\n id: string;\n /** Header label. */\n label: ReactNode;\n /** Optional secondary line below the label. */\n description?: ReactNode;\n /** Optional leading icon. */\n icon?: ReactNode;\n /** Optional trailing slot in the header (badge, count, action). */\n trailing?: ReactNode;\n /** Panel content. */\n content: ReactNode;\n /** Disable interaction for this item. */\n disabled?: boolean;\n}\n\nexport interface AccordionProps\n extends Omit<\n ComponentPropsWithoutRef<\"div\">,\n | \"onChange\"\n | \"defaultValue\"\n | \"children\"\n | \"onDrag\"\n | \"onDragStart\"\n | \"onDragEnd\"\n | \"onAnimationStart\"\n > {\n /** Items to render. */\n items: AccordionItem[];\n /** Single vs multiple expansion. Default `\"single\"`. */\n mode?: AccordionMode;\n /** Controlled expanded item ids. */\n value?: string[];\n /** Uncontrolled initial expanded ids. */\n defaultValue?: string[];\n /** Fires when the expanded set changes. */\n onValueChange?: (value: string[]) => void;\n /**\n * Allow the last open item to be closed (single mode). Default\n * `true`. When `false`, one item is always open — useful for tabbed-\n * like surfaces.\n */\n collapsible?: boolean;\n /** Visual variant. Default `\"default\"`. */\n variant?: AccordionVariant;\n /** Visual size. Default `\"md\"`. */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Disable the entire accordion. */\n disabled?: boolean;\n}\n\n/* ---------------------------------------------------------------------------\n * Component\n * ------------------------------------------------------------------------- */\n\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(\n function Accordion(\n {\n items,\n mode = \"single\",\n value: controlledValue,\n defaultValue,\n onValueChange,\n collapsible = true,\n variant = \"default\",\n size = \"md\",\n disabled = false,\n id: providedId,\n className,\n ...rest\n },\n ref,\n ) {\n const reactId = useId();\n const baseId = providedId ?? `ods-accordion-${reactId}`;\n const reducedMotion = useReducedMotion();\n\n const [internalValue, setInternalValue] = useState<string[]>(\n defaultValue ?? [],\n );\n const isControlled = controlledValue !== undefined;\n const value = isControlled ? controlledValue : internalValue;\n const valueSet = new Set(value);\n\n const setValue = useCallback(\n (next: string[]) => {\n if (!isControlled) setInternalValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n const toggleItem = useCallback(\n (id: string) => {\n const isOpen = valueSet.has(id);\n if (mode === \"multiple\") {\n const next = isOpen\n ? value.filter((v) => v !== id)\n : [...value, id];\n setValue(next);\n return;\n }\n // single\n if (isOpen) {\n // Only close if collapsible — otherwise no-op.\n if (collapsible) setValue([]);\n return;\n }\n setValue([id]);\n },\n [collapsible, mode, setValue, value, valueSet],\n );\n\n const handleKeyDown = (\n e: KeyboardEvent<HTMLButtonElement>,\n index: number,\n ) => {\n const enabledIdx = items\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n const curr = enabledIdx.indexOf(index);\n const focusIdx = (i: number) => {\n const target = enabledIdx[i];\n if (target === undefined) return;\n const btn = document.getElementById(\n `${baseId}-trigger-${items[target]!.id}`,\n );\n (btn as HTMLButtonElement | null)?.focus();\n };\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n focusIdx((curr + 1) % enabledIdx.length);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n focusIdx((curr - 1 + enabledIdx.length) % enabledIdx.length);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n focusIdx(0);\n } else if (e.key === \"End\") {\n e.preventDefault();\n focusIdx(enabledIdx.length - 1);\n }\n };\n\n return (\n <div\n {...rest}\n ref={ref}\n id={baseId}\n className={cn(\n \"ods-accordion\",\n `ods-accordion--${variant}`,\n `ods-accordion--${size}`,\n disabled && \"ods-accordion--disabled\",\n className,\n )}\n >\n {items.map((item, i) => {\n const isOpen = valueSet.has(item.id);\n const itemDisabled = item.disabled || disabled;\n const triggerId = `${baseId}-trigger-${item.id}`;\n const panelId = `${baseId}-panel-${item.id}`;\n return (\n <div\n key={item.id}\n className={cn(\n \"ods-accordion__item\",\n isOpen && \"ods-accordion__item--open\",\n itemDisabled && \"ods-accordion__item--disabled\",\n )}\n >\n <button\n id={triggerId}\n type=\"button\"\n className=\"ods-accordion__trigger\"\n aria-expanded={isOpen}\n aria-controls={panelId}\n disabled={itemDisabled}\n onClick={() => toggleItem(item.id)}\n onKeyDown={(e) => handleKeyDown(e, i)}\n >\n {item.icon && (\n <span\n className=\"ods-accordion__icon\"\n aria-hidden=\"true\"\n >\n {item.icon}\n </span>\n )}\n <span className=\"ods-accordion__label-wrap\">\n <span className=\"ods-accordion__label\">{item.label}</span>\n {item.description && (\n <span className=\"ods-accordion__description\">\n {item.description}\n </span>\n )}\n </span>\n {item.trailing && (\n <span\n className=\"ods-accordion__trailing\"\n onClick={(e) => e.stopPropagation()}\n >\n {item.trailing}\n </span>\n )}\n <span\n className={cn(\n \"ods-accordion__chevron\",\n isOpen && \"ods-accordion__chevron--open\",\n )}\n aria-hidden=\"true\"\n >\n <ChevronDownIcon size=\"sm\" aria-hidden />\n </span>\n </button>\n\n <AnimatePresence initial={false}>\n {isOpen && (\n <motion.div\n role=\"region\"\n id={panelId}\n aria-labelledby={triggerId}\n className=\"ods-accordion__panel\"\n initial={\n reducedMotion\n ? false\n : { height: 0, opacity: 0 }\n }\n animate={\n reducedMotion\n ? undefined\n : { height: \"auto\", opacity: 1 }\n }\n exit={\n reducedMotion\n ? undefined\n : { height: 0, opacity: 0 }\n }\n transition={\n reducedMotion\n ? { duration: 0 }\n : { duration: 0.18 }\n }\n style={{ overflow: \"hidden\" }}\n >\n <div className=\"ods-accordion__content\">\n {item.content}\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n })}\n </div>\n );\n },\n);\n\nAccordion.displayName = \"Accordion\";\n","\"use client\";\nimport { motion, useReducedMotion } from \"framer-motion\";\nimport {\n type ButtonHTMLAttributes,\n type CSSProperties,\n forwardRef,\n type ReactElement,\n type ReactNode,\n type Ref,\n useImperativeHandle,\n useRef,\n} from \"react\";\nimport { useButton } from \"react-aria\";\nimport { resolveAccessibleName, hasRenderableText } from \"../../utils/a11y\";\nimport { cn } from \"../../utils/cn\";\nimport { Slot } from \"../../utils/Slot\";\n\nexport interface ButtonProps\n extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"onDrag\" | \"onDragStart\" | \"onDragEnd\" | \"onAnimationStart\"\n > {\n variant?: \"primary\" | \"secondary\" | \"ghost\" | \"danger\" | \"icon\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n /** Override the rendered label while loading. Useful for action verbs that\n * change form mid-request — e.g. `\"Sign in\"` → `\"Signing in…\"`. */\n loadingText?: ReactNode;\n /** Accessible label for the spinner (announced by AT during loading).\n * Defaults to `\"Loading\"`. Customize for localization or context. */\n loadingLabel?: string;\n leftIcon?: ReactNode;\n rightIcon?: ReactNode;\n fullWidth?: boolean;\n /** Toggle-button state. When defined, the button advertises\n * `aria-pressed` and adds `--pressed` styling. */\n pressed?: boolean;\n children?: ReactNode;\n /**\n * Override the cursor shown on hover. When omitted, the cursor auto-resolves:\n * - `not-allowed` when disabled (CSS handles this — see Button.module.scss)\n * - `progress` when loading (request in flight)\n * - `pointer` when the button has an action (onClick, type=\"submit\",\n * or type=\"reset\"). Anchors (href) get pointer too.\n * - `default` otherwise (decorative / placeholder buttons)\n * Pass an explicit value (e.g. `\"text\"`, `\"grab\"`) to override the\n * auto-resolve for the specific story / use case.\n */\n cursor?: CSSProperties[\"cursor\"];\n /** Render Button's styling onto a custom child element (Radix-style Slot).\n *\n * <Button asChild variant=\"primary\">\n * <NextLink href=\"/checkout\">Continue</NextLink>\n * </Button>\n *\n * When `asChild` is true, Button does NOT render its internal icon /\n * label / spinner slots — the consumer's element fully owns content. Use\n * the regular form (without `asChild`) when you want the built-in\n * slots / loading spinner / size-scaled icons. */\n asChild?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"primary\",\n size = \"md\",\n loading = false,\n loadingText,\n loadingLabel = \"Loading\",\n disabled = false,\n leftIcon,\n rightIcon,\n fullWidth = false,\n pressed,\n asChild = false,\n className,\n children,\n type,\n cursor,\n style,\n ...props\n },\n forwardedRef,\n) {\n const ref = useRef<HTMLButtonElement>(null);\n useImperativeHandle(forwardedRef, () => ref.current as HTMLButtonElement);\n const isDisabled = disabled || loading;\n // Respect users who've asked for reduced motion (OS-level a11y setting).\n // When true we skip the whileTap scale animation entirely — Framer's own\n // hook reads `prefers-reduced-motion: reduce` and stays reactive.\n const prefersReducedMotion = useReducedMotion();\n\n // Cursor resolution (centralised in JS so inline-style specificity wins\n // over any CSS cursor rule). Order of precedence:\n // 1. Caller's explicit `cursor` prop.\n // 2. `not-allowed` when disabled (and not also loading — see below).\n // 3. `progress` when loading (button is intentionally non-interactive\n // but the user should see we're working on it).\n // 4. `pointer` when the button has an action.\n // 5. `default` for decorative buttons.\n // Disabled takes precedence over loading when BOTH are set: explicit\n // disabled is a stronger intent than \"currently busy\".\n // Button always renders a native <button>; anchor semantics live on\n // LinkButton. No href branch needed here.\n const hasAction = Boolean(props.onClick) || type === \"submit\" || type === \"reset\";\n const resolvedCursor: string =\n cursor ?? (disabled ? \"not-allowed\" : loading ? \"progress\" : hasAction ? \"pointer\" : \"default\");\n // Forms rely on `type=\"submit\"` to trigger submission. React Aria's useButton\n // defaults type to \"button\" when omitted, so we always pass the caller's type\n // through (defaulting to \"button\" only when truly unspecified).\n const resolvedType: \"button\" | \"submit\" | \"reset\" = type ?? \"button\";\n\n // Buttons get their accessible name from children. Icon-only buttons\n // (variant=\"icon\" or empty children + iconLeft/Right) MUST provide\n // aria-label or aria-labelledby — we resolve it here so react-aria's\n // useButton receives a guaranteed string-or-id, and dev-mode console.error\n // surfaces the missing-name case.\n //\n // `hasVisibleText` counts any renderable TEXT in children — including text\n // inside arrays/fragments/elements (e.g. `{cond && \"Connect\"}` which React\n // passes as an array, or `<span>Save</span>`). SVG/icon-only subtrees carry\n // no readable text, so genuinely icon-only buttons still require an explicit\n // aria-label. (A glyph string like \"×\" counts — announced verbatim.) This\n // must NOT be a bare `typeof children === \"string\"` check: conditional or\n // interpolated text children are arrays, and missing them here forces a\n // bogus `aria-label=\"Unlabeled Button\"` that overrides the real label.\n const hasVisibleText = hasRenderableText(children);\n // In `asChild` mode the consumer's element owns its own accessible name\n // (e.g., the anchor's text content). Suppress Button's own a11y check\n // to avoid false-positive dev warnings.\n const needsAriaName = !hasVisibleText && !asChild;\n const ariaNameProps = needsAriaName\n ? resolveAccessibleName({\n ariaLabel: (props as any)[\"aria-label\"],\n ariaLabelledby: (props as any)[\"aria-labelledby\"],\n componentName: \"Button\",\n })\n : undefined;\n\n const { buttonProps } = useButton(\n {\n isDisabled,\n onPress: props.onClick as any,\n type: resolvedType,\n ...(ariaNameProps ?? {}),\n },\n ref,\n );\n\n // Strip Framer-conflicting props from React Aria output\n const { onDrag, onDragStart, onDragEnd, onAnimationStart, ...safeButtonProps } =\n buttonProps as any;\n\n // Native HTML button attributes the caller passed (form, name, value,\n // aria-*, data-*, etc.) must reach the DOM. We strip the ones React Aria\n // already manages from buttonProps to avoid double-binding event handlers.\n const {\n onClick: _onClick,\n onKeyDown: _onKeyDown,\n onKeyUp: _onKeyUp,\n onMouseDown: _onMouseDown,\n onPointerDown: _onPointerDown,\n onPointerUp: _onPointerUp,\n onFocus: _onFocus,\n onBlur: _onBlur,\n ...passthroughProps\n } = props as Record<string, unknown>;\n\n const rootClassName = cn(\n \"ods-btn\",\n `ods-btn--${variant}`,\n `ods-btn--${size}`,\n loading && \"ods-btn--loading\",\n fullWidth && \"ods-btn--full\",\n pressed && \"ods-btn--pressed\",\n className,\n );\n\n // asChild mode — project Button's chrome onto the consumer's element.\n // Internal slots (icons, spinner, label) are NOT rendered — consumer\n // owns the content. react-aria event wiring is also skipped because\n // the consumer's element handles its own activation semantics.\n if (asChild) {\n return (\n <Slot\n {...(passthroughProps as Record<string, unknown>)}\n ref={forwardedRef as unknown as Ref<HTMLElement>}\n className={rootClassName}\n style={{ cursor: resolvedCursor, ...(style as CSSProperties) }}\n aria-pressed={pressed}\n aria-disabled={isDisabled || undefined}\n >\n {children as ReactElement}\n </Slot>\n );\n }\n\n // The visible label — `loadingText` overrides `children` while loading\n // so the in-progress verb form (\"Signing in…\") replaces the idle one.\n const visibleLabel = loading && loadingText !== undefined ? loadingText : children;\n\n return (\n <motion.button\n {...(passthroughProps as any)}\n {...safeButtonProps}\n type={resolvedType}\n ref={ref}\n className={rootClassName}\n // Disabled state CSS rule (cursor: not-allowed) outranks this inline\n // value — see Button.module.scss. So `style.cursor` only applies to\n // idle/loading/active states, exactly what we want.\n style={{ cursor: resolvedCursor, ...(style as any) }}\n data-loading={loading || undefined}\n aria-busy={loading || undefined}\n aria-pressed={pressed}\n whileTap={isDisabled || prefersReducedMotion ? undefined : { scale: 0.97 }}\n transition={{ duration: 0.1 }}\n >\n {/* Content layer. When loading, the leftIcon slot is replaced by an\n inline spinner — both spinner AND label stay visible so the user\n sees the in-progress text (e.g. \"Signing in…\") next to the\n activity indicator. */}\n <span className=\"ods-btn__content\">\n {loading ? (\n <span\n className=\"ods-btn__icon ods-btn__icon--left ods-btn__icon--spinner\"\n role=\"status\"\n aria-label={loadingLabel}\n >\n {/* viewBox is 1em-scaled by CSS (.ods-btn__icon svg → 1em) so\n the spinner tracks the per-size icon scale (12 / 14 / 16 px)\n without needing per-size width attributes. */}\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeDasharray=\"32\"\n strokeDashoffset=\"12\"\n />\n </svg>\n </span>\n ) : (\n leftIcon && <span className=\"ods-btn__icon ods-btn__icon--left\">{leftIcon}</span>\n )}\n {visibleLabel != null && visibleLabel !== false && (\n <span className=\"ods-btn__label\">{visibleLabel}</span>\n )}\n {rightIcon && !loading && (\n <span className=\"ods-btn__icon ods-btn__icon--right\">{rightIcon}</span>\n )}\n </span>\n </motion.button>\n );\n});\n\nButton.displayName = \"Button\";\n","/**\n * a11y — shared helpers for resolving an accessible name from the union of\n * props every form/interactive component accepts.\n *\n * Why this exists:\n * react-aria's hooks (useCheckbox, useSwitch, useRadio, useTextField,\n * useButton, etc.) emit a runtime warning to the browser console when\n * none of the following is present on the underlying element:\n * - aria-label\n * - aria-labelledby\n * - a visible <label> with htmlFor pointing to the element id\n *\n * Many of our components accept `label` as `string | ReactNode`. When\n * `label` is a ReactNode (icon + text, custom JSX), react-aria can't see\n * a text label and the warning fires. This helper centralizes the\n * derivation: it returns a single { 'aria-label' or 'aria-labelledby' }\n * shape that react-aria will accept, and — in development only — it\n * surfaces a focused console.error pointing the developer at the prop\n * they're missing instead of the generic react-aria warning.\n *\n * Usage:\n * const ariaProps = resolveAccessibleName({\n * label,\n * ariaLabel: props['aria-label'],\n * ariaLabelledby: props['aria-labelledby'],\n * componentName: 'Checkbox',\n * });\n * // → { 'aria-label': string } | { 'aria-labelledby': string } | { 'aria-label': string }\n *\n * useCheckbox({ ...otherProps, ...ariaProps }, state, ref);\n */\n\nimport { isValidElement, type ReactNode } from \"react\";\n\n/**\n * True when a ReactNode renders any non-empty, human-readable text.\n *\n * Used by controls whose accessible name comes from their CHILDREN (e.g.\n * Button). Recurses through arrays, fragments, and element children so that\n * conditionally-rendered or wrapped text is detected — e.g.\n * `{cond && \"Save\"}`, `[\"Connect with \", name]`, or `<span>Save</span>`.\n *\n * Returns false for icon/SVG-only subtrees (no string content), so genuinely\n * icon-only controls still trip the missing-accessible-name check. Numbers\n * count (they render as announced text, including 0); booleans / null /\n * undefined do not render and so don't count.\n */\nexport function hasRenderableText(node: ReactNode): boolean {\n if (node === null || node === undefined || typeof node === \"boolean\") return false;\n if (typeof node === \"string\") return node.trim().length > 0;\n if (typeof node === \"number\") return true;\n if (Array.isArray(node)) return node.some(hasRenderableText);\n if (isValidElement(node)) {\n return hasRenderableText((node.props as { children?: ReactNode }).children);\n }\n return false;\n}\n\n/**\n * Extract the concatenated visible text from a ReactNode — used to derive an\n * accessible name when a control accepts a rich `label` (icon + text, custom\n * JSX). Mirrors `hasRenderableText`'s traversal: strings/numbers contribute,\n * arrays/fragments/elements recurse into their children, and\n * booleans/null/undefined contribute nothing. Returns '' when there is no text.\n */\nexport function getRenderableText(node: ReactNode): string {\n if (node === null || node === undefined || typeof node === \"boolean\") return \"\";\n if (typeof node === \"string\") return node;\n if (typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(getRenderableText).join(\"\");\n if (isValidElement(node)) {\n return getRenderableText((node.props as { children?: ReactNode }).children);\n }\n return \"\";\n}\n\nexport interface ResolveAccessibleNameInput {\n /** The visible label, if any. Strings are auto-used as aria-label. */\n label?: ReactNode;\n /** Caller-provided aria-label override. Highest priority when present. */\n ariaLabel?: string;\n /** Caller-provided aria-labelledby. Wins over label-derived values. */\n ariaLabelledby?: string;\n /**\n * Component name used in dev-mode error messages. Helps the developer\n * locate which usage needs a label.\n */\n componentName: string;\n /**\n * Optional secondary fallbacks the component knows about — e.g. a Radio\n * can fall back to its `value` so radios in a group are at least\n * distinguishable. The first non-empty string is used.\n */\n fallbacks?: Array<string | undefined>;\n}\n\nexport type ResolvedAccessibleName = { \"aria-label\": string } | { \"aria-labelledby\": string };\n\n/**\n * Resolve the accessible-name props that should be spread onto the\n * underlying element. Guarantees at least one of aria-label / aria-labelledby\n * is present so react-aria won't warn at runtime.\n *\n * Priority order:\n * 1. aria-labelledby (caller-provided)\n * 2. aria-label (caller-provided)\n * 3. label (when string)\n * 4. fallbacks (when string)\n * 5. component-name placeholder + dev-mode console.error\n */\nexport function resolveAccessibleName(input: ResolveAccessibleNameInput): ResolvedAccessibleName {\n if (input.ariaLabelledby) {\n return { \"aria-labelledby\": input.ariaLabelledby };\n }\n if (input.ariaLabel) {\n return { \"aria-label\": input.ariaLabel };\n }\n if (typeof input.label === \"string\" && input.label.trim().length > 0) {\n return { \"aria-label\": input.label };\n }\n for (const candidate of input.fallbacks ?? []) {\n if (typeof candidate === \"string\" && candidate.trim().length > 0) {\n return { \"aria-label\": candidate };\n }\n }\n\n // Last resort — emit a placeholder so react-aria stays quiet in\n // production, but loudly point at the missing prop in development so the\n // developer fixes the real bug rather than ignoring a global warning.\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.error(\n `[@octaviaflow/core ${input.componentName}] No accessible name. ` +\n `Pass a string \\`label\\`, or \\`aria-label\\`, or \\`aria-labelledby\\` ` +\n `so screen readers can announce this control.`,\n );\n }\n return { \"aria-label\": `Unlabeled ${input.componentName}` };\n}\n","\"use client\";\nimport {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n type CSSProperties,\n type HTMLAttributes,\n type ReactElement,\n type Ref,\n} from \"react\";\nimport { composeRefs } from \"./composeRefs\";\n\n/* ---------------------------------------------------------------------------\n * Slot — the `asChild` primitive\n *\n * Takes exactly one React element child and clones it, merging the Slot's\n * own props onto the child:\n * - `className` concatenates (slot's classes follow child's)\n * - `style` merges (child's keys win on overlap)\n * - Event handlers chain (slot's handler runs first; if it calls\n * `event.preventDefault()` the child's handler is short-circuited —\n * matching React's own synthetic-event default-handling convention)\n * - Refs compose so both the forwarded ref and the child's own ref point\n * at the rendered DOM node.\n *\n * This is what powers `asChild` across our primitives: it lets consumers\n * swap the rendered element (e.g., to a router Link) without losing the\n * component's styling, accessibility, or behavioural contract.\n * ------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, unknown>;\n\ninterface SlotProps extends HTMLAttributes<HTMLElement> {\n children?: React.ReactNode;\n}\n\nexport const Slot = forwardRef<HTMLElement, SlotProps>(function Slot(\n { children, ...slotProps },\n forwardedRef,\n) {\n if (!isValidElement(children)) {\n // Slot requires exactly one React element child. Returning null is\n // safer than throwing — callers that conditionally use `asChild` are\n // common, and we don't want stories / SSR to crash on an empty pass.\n return null;\n }\n const child = Children.only(children) as ReactElement<AnyProps>;\n const childProps = child.props ?? {};\n const childRef = (child as unknown as { ref?: Ref<HTMLElement> }).ref;\n\n return cloneElement(child, {\n ...mergeProps(slotProps as AnyProps, childProps),\n ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n });\n});\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps): AnyProps {\n // Start with the slot's props, then layer the child's on top. We then\n // walk back over the overlapping keys to apply per-key merge rules.\n const merged: AnyProps = { ...slotProps, ...childProps };\n\n for (const key of Object.keys(slotProps)) {\n const slotValue = slotProps[key];\n const childValue = childProps[key];\n\n // Event handlers — chain. Slot's handler runs first; if it invokes\n // event.preventDefault() the child's is skipped, matching the React\n // norm. Both being functions is the trigger.\n if (\n /^on[A-Z]/.test(key) &&\n typeof slotValue === \"function\" &&\n typeof childValue === \"function\"\n ) {\n merged[key] = (...args: unknown[]) => {\n (slotValue as (...a: unknown[]) => void)(...args);\n const event = args[0] as { defaultPrevented?: boolean } | undefined;\n if (event?.defaultPrevented) return;\n (childValue as (...a: unknown[]) => void)(...args);\n };\n continue;\n }\n\n // className — concatenate (slot's classes come first so child's can\n // visually override on direct conflict, which matches authoring intent).\n if (key === \"className\") {\n merged.className = [slotValue, childValue].filter(Boolean).join(\" \");\n continue;\n }\n\n // style — merge; child's keys win on overlap so consumers' inline\n // styles can override our defaults.\n if (key === \"style\") {\n merged.style = {\n ...(slotValue as CSSProperties | undefined),\n ...(childValue as CSSProperties | undefined),\n };\n continue;\n }\n }\n\n return merged;\n}\n","import type { MutableRefObject, Ref, RefCallback } from \"react\";\n\n/** Compose any number of refs (callback or object) into a single ref-callback.\n * Each underlying ref receives the node when React assigns it. Useful for the\n * `asChild` pattern where both the forwarded ref and the child's own ref need\n * to point at the same DOM node. */\nexport function composeRefs<T>(...refs: Array<Ref<T> | undefined | null>): RefCallback<T> {\n return (node: T) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref != null) {\n (ref as MutableRefObject<T | null>).current = node;\n }\n }\n };\n}\n","\"use client\";\nimport { CloseIcon } from \"@octaviaflow/icons\";\nimport {\n forwardRef,\n type InputHTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useId,\n useImperativeHandle,\n useRef,\n} from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\"> {\n type?:\n | \"text\"\n | \"email\"\n | \"password\"\n | \"search\"\n | \"number\"\n | \"tel\"\n | \"url\"\n | \"color\"\n | \"date\"\n | \"datetime-local\"\n | \"month\"\n | \"time\"\n | \"week\";\n size?: \"sm\" | \"md\" | \"lg\";\n error?: boolean;\n errorMessage?: string;\n label?: ReactNode;\n helperText?: ReactNode;\n leftIcon?: ReactNode;\n rightIcon?: ReactNode;\n /**\n * Show a clear button on the right while the input has a value.\n * Auto-enabled when `type=\"search\"`; explicitly toggle for other types.\n */\n clearable?: boolean;\n onClear?: () => void;\n /**\n * Right-side keyboard shortcut hint (e.g. \"⌘K\"). Rendered as a kbd-style chip.\n * Hidden while a clear button is showing (clear takes precedence).\n */\n shortcutHint?: ReactNode;\n}\n\nconst CLEAR_GLYPH = <CloseIcon width={12} height={12} aria-hidden=\"true\" />;\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\n (\n {\n type = \"text\",\n size = \"md\",\n error = false,\n errorMessage,\n label,\n helperText,\n leftIcon,\n rightIcon,\n clearable,\n onClear,\n shortcutHint,\n disabled = false,\n required,\n id,\n className,\n value,\n defaultValue,\n onChange,\n onKeyDown,\n ...props\n },\n forwardedRef,\n ) => {\n const innerRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(forwardedRef, () => innerRef.current as HTMLInputElement);\n\n const reactId = useId();\n const inputId = id ?? `${reactId}-input`;\n const errorId = `${reactId}-err`;\n const helperId = `${reactId}-help`;\n\n const isControlled = value !== undefined;\n const isClearable = (clearable ?? type === \"search\") && !disabled;\n const isSearch = type === \"search\";\n\n const currentValue = isControlled\n ? String(value ?? \"\")\n : (innerRef.current?.value ?? String(defaultValue ?? \"\"));\n const showClear = isClearable && currentValue.length > 0;\n\n const clearValue = () => {\n const el = innerRef.current;\n if (el && !isControlled) {\n const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, \"value\")?.set;\n setter?.call(el, \"\");\n el.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }\n onClear?.();\n el?.focus();\n };\n\n const handleClear = (e: MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n e.stopPropagation();\n clearValue();\n };\n\n // Esc clears the value for search inputs — standard browser-search UX.\n // Consumer's own onKeyDown still runs first; preventDefault from theirs\n // short-circuits ours.\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n if (isClearable && isSearch && e.key === \"Escape\" && currentValue) {\n e.preventDefault();\n clearValue();\n }\n };\n\n const describedBy = error && errorMessage ? errorId : helperText ? helperId : undefined;\n\n return (\n <div\n className={cn(\n \"ods-input\",\n `ods-input--${size}`,\n error && \"ods-input--error\",\n disabled && \"ods-input--disabled\",\n isSearch && \"ods-input--search\",\n className,\n )}\n >\n {label && (\n <label htmlFor={inputId} className=\"ods-input__label\">\n {label}\n {required && (\n <span className=\"ods-input__required\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n <div className=\"ods-input__wrapper\">\n {leftIcon && (\n <span className=\"ods-input__icon--left\" aria-hidden=\"true\">\n {leftIcon}\n </span>\n )}\n <input\n {...props}\n id={inputId}\n ref={innerRef}\n type={type}\n disabled={disabled}\n required={required}\n value={value}\n defaultValue={defaultValue}\n onChange={onChange}\n onKeyDown={handleKeyDown}\n className={cn(\n \"ods-input__field\",\n leftIcon && \"ods-input__field--with-left-icon\",\n (rightIcon || showClear || shortcutHint) && \"ods-input__field--with-right-icon\",\n showClear && shortcutHint && \"ods-input__field--with-right-actions\",\n )}\n aria-invalid={error || undefined}\n aria-required={required || undefined}\n aria-describedby={describedBy}\n />\n <span className=\"ods-input__right\">\n {showClear && (\n <button\n type=\"button\"\n className=\"ods-input__clear\"\n onClick={handleClear}\n aria-label=\"Clear\"\n tabIndex={-1}\n >\n {CLEAR_GLYPH}\n </button>\n )}\n {shortcutHint && !showClear && (\n <span className=\"ods-input__kbd\" aria-hidden=\"true\">\n {shortcutHint}\n </span>\n )}\n {rightIcon && !showClear && !shortcutHint && (\n <span className=\"ods-input__icon--right\" aria-hidden=\"true\">\n {rightIcon}\n </span>\n )}\n </span>\n </div>\n {error && errorMessage && (\n <div id={errorId} className=\"ods-input__error-message\" role=\"alert\">\n {errorMessage}\n </div>\n )}\n {!error && helperText && (\n <div id={helperId} className=\"ods-input__helper\">\n {helperText}\n </div>\n )}\n </div>\n );\n },\n);\n\nInput.displayName = \"Input\";\n","\"use client\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport {\n cloneElement,\n type ComponentPropsWithRef,\n type DOMAttributes,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type Ref,\n type RefObject,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { useTooltip, useTooltipTrigger } from \"react-aria\";\nimport { createPortal } from \"react-dom\";\nimport { useTooltipTriggerState } from \"react-stately\";\nimport { cn } from \"../../utils/cn\";\n\nexport type TooltipPosition = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nexport interface TooltipProps {\n content: ReactNode;\n /** Preferred position. May flip to the opposite side if it would overflow. */\n position?: TooltipPosition;\n /** Open-delay in milliseconds (react-aria's warmup). Defaults to 200. */\n delay?: number;\n /** Pixel gap between trigger and tooltip. Defaults to 8. */\n offset?: number;\n /** Suppress the tooltip entirely without removing the trigger from the tree. */\n disabled?: boolean;\n /** Stable id for the tooltip DOM node — useful for aria-describedby tests. */\n id?: string;\n children: ReactElement;\n className?: string;\n}\n\ninterface Coords {\n top: number;\n left: number;\n /** The actual side the tooltip ended up on after any flip. */\n position: TooltipPosition;\n}\n\nconst FLIP: Record<TooltipPosition, TooltipPosition> = {\n top: \"bottom\",\n bottom: \"top\",\n left: \"right\",\n right: \"left\",\n};\n\nfunction placeOn(\n rect: DOMRect,\n tipRect: DOMRect,\n position: TooltipPosition,\n offset: number,\n): { top: number; left: number } {\n const cx = rect.left + rect.width / 2;\n const cy = rect.top + rect.height / 2;\n switch (position) {\n case \"top\":\n return {\n top: rect.top - tipRect.height - offset,\n left: cx - tipRect.width / 2,\n };\n case \"bottom\":\n return { top: rect.bottom + offset, left: cx - tipRect.width / 2 };\n case \"left\":\n return {\n top: cy - tipRect.height / 2,\n left: rect.left - tipRect.width - offset,\n };\n case \"right\":\n return { top: cy - tipRect.height / 2, left: rect.right + offset };\n }\n}\n\n/** Resolve the final placement: flip if the preferred side overflows. */\nfunction computePosition(\n rect: DOMRect,\n tipRect: DOMRect,\n position: TooltipPosition,\n offset: number,\n viewport: { width: number; height: number },\n): Coords {\n const tryAt = (p: TooltipPosition) => {\n const c = placeOn(rect, tipRect, p, offset);\n const fits =\n c.top >= 0 &&\n c.left >= 0 &&\n c.top + tipRect.height <= viewport.height &&\n c.left + tipRect.width <= viewport.width;\n return { ...c, position: p, fits };\n };\n\n const preferred = tryAt(position);\n if (preferred.fits) return preferred;\n const flipped = tryAt(FLIP[position]);\n if (flipped.fits) return flipped;\n\n // Neither fits cleanly — fall back to the preferred side but clamp into\n // the viewport so the arrow target is still close to the trigger.\n const fallback = preferred;\n const clampedLeft = Math.max(\n 4,\n Math.min(fallback.left, viewport.width - tipRect.width - 4),\n );\n const clampedTop = Math.max(\n 4,\n Math.min(fallback.top, viewport.height - tipRect.height - 4),\n );\n return { top: clampedTop, left: clampedLeft, position: fallback.position };\n}\n\n// Framer-motion's `initial` / `animate` accept rich variant types we\n// don't need to spell out — plain objects with `opacity` + `x`/`y` are\n// the documented shorthand and avoid pulling in the library's union.\ntype MotionFrame = Record<string, number | string>;\nconst animVariants: Record<\n TooltipPosition,\n { initial: MotionFrame; animate: MotionFrame }\n> = {\n top: { initial: { opacity: 0, y: 4 }, animate: { opacity: 1, y: 0 } },\n bottom: { initial: { opacity: 0, y: -4 }, animate: { opacity: 1, y: 0 } },\n left: { initial: { opacity: 0, x: 4 }, animate: { opacity: 1, x: 0 } },\n right: { initial: { opacity: 0, x: -4 }, animate: { opacity: 1, x: 0 } },\n};\n\ninterface ContentProps {\n state: ReturnType<typeof useTooltipTriggerState>;\n content: ReactNode;\n position: TooltipPosition;\n triggerRef: RefObject<HTMLElement | null>;\n className?: string;\n offset: number;\n tooltipId: string;\n}\n\nfunction TooltipContent({\n state,\n content,\n position,\n triggerRef,\n className,\n offset,\n tooltipId,\n}: ContentProps) {\n const { tooltipProps } = useTooltip({ isOpen: state.isOpen }, state);\n const tipRef = useRef<HTMLDivElement | null>(null);\n const [coords, setCoords] = useState<Coords | null>(null);\n\n const reposition = useCallback(() => {\n if (!triggerRef.current || !tipRef.current) return;\n const trigRect = triggerRef.current.getBoundingClientRect();\n const tipRect = tipRef.current.getBoundingClientRect();\n const viewport = {\n width: window.innerWidth || document.documentElement.clientWidth,\n height: window.innerHeight || document.documentElement.clientHeight,\n };\n setCoords(computePosition(trigRect, tipRect, position, offset, viewport));\n }, [triggerRef, position, offset]);\n\n // The first measure happens before the tip has rendered its content, so\n // its rect is empty. Measure again on the next frame for accurate placement.\n useLayoutEffect(() => {\n if (!state.isOpen) return;\n reposition();\n const id = requestAnimationFrame(reposition);\n return () => cancelAnimationFrame(id);\n }, [state.isOpen, reposition]);\n\n useEffect(() => {\n if (!state.isOpen) return;\n const handler = () => reposition();\n window.addEventListener(\"scroll\", handler, true);\n window.addEventListener(\"resize\", handler);\n return () => {\n window.removeEventListener(\"scroll\", handler, true);\n window.removeEventListener(\"resize\", handler);\n };\n }, [state.isOpen, reposition]);\n\n const resolvedPos = coords?.position ?? position;\n const variants = animVariants[resolvedPos];\n\n // react-aria's tooltip props include onMouseEnter/onMouseLeave for the\n // tooltip itself plus drag-related handlers that conflict with framer-\n // motion's prop signatures. Strip the ones framer-motion claims so the\n // intersection is type-clean.\n const {\n onDrag: _onDrag,\n onDragStart: _onDragStart,\n onDragEnd: _onDragEnd,\n onAnimationStart: _onAnimationStart,\n ...safeTipProps\n } = tooltipProps as DOMAttributes<HTMLDivElement> & Record<string, unknown>;\n\n const portalContent = (\n <AnimatePresence>\n {state.isOpen && (\n <div\n className=\"ods-tooltip__wrapper\"\n style={{\n position: \"fixed\",\n zIndex: 1500,\n top: coords?.top ?? -9999,\n left: coords?.left ?? -9999,\n visibility: coords ? \"visible\" : \"hidden\",\n pointerEvents: \"none\",\n }}\n >\n <motion.div\n ref={tipRef}\n {...safeTipProps}\n id={tooltipId}\n role=\"tooltip\"\n data-position={resolvedPos}\n className={cn(\"ods-tooltip\", className)}\n initial={variants.initial}\n animate={variants.animate}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.15, ease: \"easeOut\" }}\n >\n {content}\n <span className=\"ods-tooltip__arrow\" aria-hidden=\"true\" />\n </motion.div>\n </div>\n )}\n </AnimatePresence>\n );\n\n if (typeof document === \"undefined\") return null;\n return createPortal(portalContent, document.body);\n}\n\n/** Compose two refs into one — preserves the child's existing ref. */\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>): (node: T | null) => void {\n return (node) => {\n for (const r of refs) {\n if (!r) continue;\n if (typeof r === \"function\") r(node);\n else (r as { current: T | null }).current = node;\n }\n };\n}\n\n/** Compose a child handler with one from react-aria — both fire, child first. */\nfunction mergeHandler<E extends React.SyntheticEvent>(\n childHandler: ((e: E) => void) | undefined,\n ariaHandler: ((e: E) => void) | undefined,\n): ((e: E) => void) | undefined {\n if (!childHandler && !ariaHandler) return undefined;\n return (e: E) => {\n childHandler?.(e);\n if (!e.defaultPrevented) ariaHandler?.(e);\n };\n}\n\nexport function Tooltip({\n content,\n position = \"top\",\n delay = 200,\n offset = 8,\n disabled = false,\n id: providedId,\n children,\n className,\n}: TooltipProps) {\n const reactId = useId();\n const tooltipId = providedId ?? `ods-tooltip-${reactId}`;\n const triggerRef = useRef<HTMLElement>(null);\n const state = useTooltipTriggerState({ delay });\n const { triggerProps } = useTooltipTrigger(\n { delay, isDisabled: disabled },\n state,\n triggerRef,\n );\n\n if (!isValidElement(children)) {\n // Bail out gracefully — without a valid element child there's nothing\n // to clone props onto. Render the children as-is so we don't crash\n // consumer trees that pass a string by mistake.\n return <>{children}</>;\n }\n\n // Pull the existing ref + handlers off the child so we can compose them\n // with react-aria's. Without this merge the child loses its ref\n // (e.g. ref forwarding in a wrapped Button) and any user-supplied\n // onMouseEnter / onFocus etc. is silently overwritten.\n const childProps = children.props as ComponentPropsWithRef<\"button\"> &\n Record<string, unknown>;\n // React 19: `ref` is a regular prop on the child's props. We still\n // fall back to the legacy `element.ref` to support intermediates that\n // re-emit the older shape.\n const childRef =\n (childProps as { ref?: Ref<HTMLElement> }).ref ??\n (children as unknown as { ref?: Ref<HTMLElement> }).ref;\n\n // Merge every handler prop from react-aria with whatever the child\n // already had, so a child that passes its own onFocus/onMouseEnter\n // doesn't lose them when we attach the trigger props.\n const merged: Record<string, unknown> = { ...childProps };\n for (const [key, value] of Object.entries(\n triggerProps as Record<string, unknown>,\n )) {\n if (key.startsWith(\"on\") && typeof value === \"function\") {\n merged[key] = mergeHandler(\n childProps[key] as never,\n value as never,\n );\n } else {\n merged[key] = value;\n }\n }\n merged.ref = mergeRefs<HTMLElement>(triggerRef, childRef);\n merged[\"aria-describedby\"] =\n [childProps[\"aria-describedby\"], tooltipId].filter(Boolean).join(\" \");\n\n return (\n <>\n {cloneElement(children, merged)}\n {!disabled && (\n <TooltipContent\n state={state}\n content={content}\n position={position}\n triggerRef={triggerRef}\n offset={offset}\n className={className}\n tooltipId={tooltipId}\n />\n )}\n </>\n );\n}\n\nTooltip.displayName = \"Tooltip\";\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 React, {SetStateAction, useCallback, useEffect, useReducer, useRef, useState} from 'react';\n\n// Use the earliest effect possible to reset the ref below.\nconst useEarlyEffect: typeof React.useLayoutEffect = typeof document !== 'undefined'\n ? React['useInsertionEffect'] ?? React.useLayoutEffect\n : () => {};\n\nexport function useControlledState<T, C = T>(value: Exclude<T, undefined>, defaultValue: Exclude<T, undefined> | undefined, onChange?: (v: C, ...args: any[]) => void): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(value: Exclude<T, undefined> | undefined, defaultValue: Exclude<T, undefined>, onChange?: (v: C, ...args: any[]) => void): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(value: T, defaultValue: T, onChange?: (v: C, ...args: any[]) => void): [T, (value: SetStateAction<T>, ...args: any[]) => void] {\n // Store the value in both state and a ref. The state value will only be used when uncontrolled.\n // The ref is used to track the most current value, which is passed to the function setState callback.\n let [stateValue, setStateValue] = useState(value || defaultValue);\n let valueRef = useRef(stateValue);\n\n let isControlledRef = useRef(value !== undefined);\n let isControlled = value !== undefined;\n useEffect(() => {\n let wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') {\n console.warn(`WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`);\n }\n isControlledRef.current = isControlled;\n }, [isControlled]);\n\n // After each render, update the ref to the current value.\n // This ensures that the setState callback argument is reset.\n // Note: the effect should not have any dependencies so that controlled values always reset.\n let currentValue = isControlled ? value : stateValue;\n useEarlyEffect(() => {\n valueRef.current = currentValue;\n });\n\n let [, forceUpdate] = useReducer(() => ({}), {});\n let setValue = useCallback((value: SetStateAction<T>, ...args: any[]) => {\n // @ts-ignore - TS doesn't know that T cannot be a function.\n let newValue = typeof value === 'function' ? value(valueRef.current) : value;\n if (!Object.is(valueRef.current, newValue)) {\n // Update the ref so that the next setState callback has the most recent value.\n valueRef.current = newValue;\n\n setStateValue(newValue);\n\n // Always trigger a re-render, even when controlled, so that the layout effect above runs to reset the value.\n forceUpdate();\n\n // Trigger onChange. Note that if setState is called multiple times in a single event,\n // onChange will be called for each one instead of only once.\n onChange?.(newValue, ...args);\n }\n }, [onChange]);\n\n return [currentValue, setValue];\n}\n","/*\n * Copyright 2023 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 {Context, createContext, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {Validation, ValidationErrors, ValidationFunction, ValidationResult} from '@react-types/shared';\n\nexport const VALID_VALIDITY_STATE: ValidityState = {\n badInput: false,\n customError: false,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n typeMismatch: false,\n valueMissing: false,\n valid: true\n};\n\nconst CUSTOM_VALIDITY_STATE: ValidityState = {\n ...VALID_VALIDITY_STATE,\n customError: true,\n valid: false\n};\n\nexport const DEFAULT_VALIDATION_RESULT: ValidationResult = {\n isInvalid: false,\n validationDetails: VALID_VALIDITY_STATE,\n validationErrors: []\n};\n\nexport const FormValidationContext: Context<ValidationErrors> = createContext<ValidationErrors>({});\n\n// Private props that we pass from useFormValidationState to children.\n// Ideally we'd use a Symbol for this, but React doesn't support them: https://github.com/facebook/react/issues/7552\n// This needs to be stable across server and client module evaluation for SSR hydration.\nexport const privateValidationStateProp: string = '__reactAriaFormValidationState';\n\ninterface FormValidationProps<T> extends Validation<T> {\n builtinValidation?: ValidationResult,\n name?: string | string[],\n value: T | null\n}\n\nexport interface FormValidationState {\n /** Realtime validation results, updated as the user edits the value. */\n realtimeValidation: ValidationResult,\n /** Currently displayed validation results, updated when the user commits their changes. */\n displayValidation: ValidationResult,\n /** Updates the current validation result. Not displayed to the user until `commitValidation` is called. */\n updateValidation(result: ValidationResult): void,\n /** Resets the displayed validation state to valid when the user resets the form. */\n resetValidation(): void,\n /** Commits the realtime validation so it is displayed to the user. */\n commitValidation(): void\n}\n\nexport function useFormValidationState<T>(props: FormValidationProps<T>): FormValidationState {\n // Private prop for parent components to pass state to children.\n if (props[privateValidationStateProp]) {\n let {realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation} = props[privateValidationStateProp] as FormValidationState;\n return {realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation};\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useFormValidationStateImpl(props);\n}\n\nfunction useFormValidationStateImpl<T>(props: FormValidationProps<T>): FormValidationState {\n let {isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = 'aria'} = props;\n\n // backward compatibility.\n if (validationState) {\n isInvalid ||= validationState === 'invalid';\n }\n\n // If the isInvalid prop is controlled, update validation result in realtime.\n let controlledError: ValidationResult | null = isInvalid !== undefined ? {\n isInvalid,\n validationErrors: [],\n validationDetails: CUSTOM_VALIDITY_STATE\n } : null;\n\n // Perform custom client side validation.\n let clientError: ValidationResult | null = useMemo(() => {\n if (!validate || value == null) {\n return null;\n }\n let validateErrors = runValidate(validate, value);\n return getValidationResult(validateErrors);\n }, [validate, value]);\n\n if (builtinValidation?.validationDetails.valid) {\n builtinValidation = undefined;\n }\n\n // Get relevant server errors from the form.\n let serverErrors = useContext(FormValidationContext);\n let serverErrorMessages = useMemo(() => {\n if (name) {\n return Array.isArray(name) ? name.flatMap(name => asArray(serverErrors[name])) : asArray(serverErrors[name]);\n }\n return [];\n }, [serverErrors, name]);\n\n // Show server errors when the form gets a new value, and clear when the user changes the value.\n let [lastServerErrors, setLastServerErrors] = useState(serverErrors);\n let [isServerErrorCleared, setServerErrorCleared] = useState(false);\n if (serverErrors !== lastServerErrors) {\n setLastServerErrors(serverErrors);\n setServerErrorCleared(false);\n }\n\n let serverError: ValidationResult | null = useMemo(() =>\n getValidationResult(isServerErrorCleared ? [] : serverErrorMessages),\n [isServerErrorCleared, serverErrorMessages]\n );\n\n // Track the next validation state in a ref until commitValidation is called.\n let nextValidation = useRef(DEFAULT_VALIDATION_RESULT);\n let [currentValidity, setCurrentValidity] = useState(DEFAULT_VALIDATION_RESULT);\n\n let lastError = useRef(DEFAULT_VALIDATION_RESULT);\n let commitValidation = () => {\n if (!commitQueued) {\n return;\n }\n\n setCommitQueued(false);\n let error = clientError || builtinValidation || nextValidation.current;\n if (!isEqualValidation(error, lastError.current)) {\n lastError.current = error;\n setCurrentValidity(error);\n }\n };\n\n let [commitQueued, setCommitQueued] = useState(false);\n useEffect(commitValidation);\n\n // realtimeValidation is used to update the native input element's state based on custom validation logic.\n // displayValidation is the currently displayed validation state that the user sees (e.g. on input change/form submit).\n // With validationBehavior=\"aria\", all errors are displayed in realtime rather than on submit.\n let realtimeValidation = controlledError || serverError || clientError || builtinValidation || DEFAULT_VALIDATION_RESULT;\n let displayValidation = validationBehavior === 'native'\n ? controlledError || serverError || currentValidity\n : controlledError || serverError || clientError || builtinValidation || currentValidity;\n\n return {\n realtimeValidation,\n displayValidation,\n updateValidation(value) {\n // If validationBehavior is 'aria', update in realtime. Otherwise, store in a ref until commit.\n if (validationBehavior === 'aria' && !isEqualValidation(currentValidity, value)) {\n setCurrentValidity(value);\n } else {\n nextValidation.current = value;\n }\n },\n resetValidation() {\n // Update the currently displayed validation state to valid on form reset,\n // even if the native validity says it isn't. It'll show again on the next form submit.\n let error = DEFAULT_VALIDATION_RESULT;\n if (!isEqualValidation(error, lastError.current)) {\n lastError.current = error;\n setCurrentValidity(error);\n }\n\n // Do not commit validation after the next render. This avoids a condition where\n // useSelect calls commitValidation inside an onReset handler.\n if (validationBehavior === 'native') {\n setCommitQueued(false);\n }\n\n setServerErrorCleared(true);\n },\n commitValidation() {\n // Commit validation state so the user sees it on blur/change/submit. Also clear any server errors.\n // Wait until after the next render to commit so that the latest value has been validated.\n if (validationBehavior === 'native') {\n setCommitQueued(true);\n }\n setServerErrorCleared(true);\n }\n };\n}\n\nfunction asArray<T>(v: T | T[]): T[] {\n if (!v) {\n return [];\n }\n\n return Array.isArray(v) ? v : [v];\n}\n\nfunction runValidate<T>(validate: ValidationFunction<T>, value: T): string[] {\n if (typeof validate === 'function') {\n let e = validate(value);\n if (e && typeof e !== 'boolean') {\n return asArray(e);\n }\n }\n\n return [];\n}\n\nfunction getValidationResult(errors: string[]): ValidationResult | null {\n return errors.length ? {\n isInvalid: true,\n validationErrors: errors,\n validationDetails: CUSTOM_VALIDITY_STATE\n } : null;\n}\n\nfunction isEqualValidation(a: ValidationResult | null, b: ValidationResult | null): boolean {\n if (a === b) {\n return true;\n }\n\n return !!a && !!b\n && a.isInvalid === b.isInvalid\n && a.validationErrors.length === b.validationErrors.length\n && a.validationErrors.every((a, i) => a === b.validationErrors[i])\n && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);\n}\n\nexport function mergeValidation(...results: ValidationResult[]): ValidationResult {\n let errors = new Set<string>();\n let isInvalid = false;\n let validationDetails = {\n ...VALID_VALIDITY_STATE\n };\n\n for (let v of results) {\n for (let e of v.validationErrors) {\n errors.add(e);\n }\n\n // Only these properties apply for checkboxes.\n isInvalid ||= v.isInvalid;\n for (let key in validationDetails) {\n validationDetails[key] ||= v.validationDetails[key];\n }\n }\n\n validationDetails.valid = !isInvalid;\n return {\n isInvalid,\n validationErrors: [...errors],\n validationDetails\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 type {Collection, Node} from '@react-types/shared';\n\nexport function getChildNodes<T>(node: Node<T>, collection: Collection<Node<T>>): Iterable<Node<T>> {\n // New API: call collection.getChildren with the node key.\n if (typeof collection.getChildren === 'function') {\n return collection.getChildren(node.key);\n }\n\n // Old API: access childNodes directly.\n return node.childNodes;\n}\n\nexport function getFirstItem<T>(iterable: Iterable<T>): T | undefined {\n return getNthItem(iterable, 0);\n}\n\nexport function getNthItem<T>(iterable: Iterable<T>, index: number): T | undefined {\n if (index < 0) {\n return undefined;\n }\n\n let i = 0;\n for (let item of iterable) {\n if (i === index) {\n return item;\n }\n\n i++;\n }\n}\n\nexport function getLastItem<T>(iterable: Iterable<T>): T | undefined {\n let lastItem: T | undefined = undefined;\n for (let value of iterable) {\n lastItem = value;\n }\n\n return lastItem;\n}\n\nexport function compareNodeOrder<T>(collection: Collection<Node<T>>, a: Node<T>, b: Node<T>): number {\n // If the two nodes have the same parent, compare their indices.\n if (a.parentKey === b.parentKey) {\n return a.index - b.index;\n }\n\n // Otherwise, collect all of the ancestors from each node, and find the first one that doesn't match starting from the root.\n // Include the base nodes in case we are comparing nodes of different levels so that we can compare the higher node to the lower level node's\n // ancestor of the same level\n let aAncestors = [...getAncestors(collection, a), a];\n let bAncestors = [...getAncestors(collection, b), b];\n let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a, i) => a !== bAncestors[i]);\n if (firstNonMatchingAncestor !== -1) {\n // Compare the indices of two children within the common ancestor.\n a = aAncestors[firstNonMatchingAncestor];\n b = bAncestors[firstNonMatchingAncestor];\n return a.index - b.index;\n }\n\n // If there isn't a non matching ancestor, we might be in a case where one of the nodes is the ancestor of the other.\n if (aAncestors.findIndex(node => node === b) >= 0) {\n return 1;\n } else if (bAncestors.findIndex(node => node === a) >= 0) {\n return -1;\n }\n\n // 🤷\n return -1;\n}\n\nfunction getAncestors<T>(collection: Collection<Node<T>>, node: Node<T>): Node<T>[] {\n let parents: Node<T>[] = [];\n\n let currNode: Node<T> | null = node;\n while (currNode?.parentKey != null) {\n currNode = collection.getItem(currNode.parentKey);\n if (currNode) {\n parents.unshift(currNode);\n }\n }\n\n return parents;\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 {Collection, Key, Node} from '@react-types/shared';\n\nexport class ListCollection<T> implements Collection<Node<T>> {\n private keyMap: Map<Key, Node<T>> = new Map();\n private iterable: Iterable<Node<T>>;\n private firstKey: Key | null = null;\n private lastKey: Key | null = null;\n private _size: number;\n\n constructor(nodes: Iterable<Node<T>>) {\n this.iterable = nodes;\n\n let visit = (node: Node<T>) => {\n this.keyMap.set(node.key, node);\n\n if (node.childNodes && node.type === 'section') {\n for (let child of node.childNodes) {\n visit(child);\n }\n }\n };\n\n for (let node of nodes) {\n visit(node);\n }\n\n let last: Node<T> | null = null;\n let index = 0;\n let size = 0;\n for (let [key, node] of this.keyMap) {\n if (last) {\n last.nextKey = key;\n node.prevKey = last.key;\n } else {\n this.firstKey = key;\n node.prevKey = undefined;\n }\n\n if (node.type === 'item') {\n node.index = index++;\n }\n\n // Only count sections and items when determining size so that\n // loaders and separators in RAC/S2 don't influence the emptyState determination\n if (node.type === 'section' || node.type === 'item') {\n size++;\n }\n\n last = node;\n\n // Set nextKey as undefined since this might be the last node\n // If it isn't the last node, last.nextKey will properly set at start of new loop\n last.nextKey = undefined;\n }\n this._size = size;\n this.lastKey = last?.key ?? null;\n }\n\n *[Symbol.iterator](): IterableIterator<Node<T>> {\n yield* this.iterable;\n }\n\n get size(): number {\n return this._size;\n }\n\n getKeys(): IterableIterator<Key> {\n return this.keyMap.keys();\n }\n\n getKeyBefore(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? node.prevKey ?? null : null;\n }\n\n getKeyAfter(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? node.nextKey ?? null : null;\n }\n\n getFirstKey(): Key | null {\n return this.firstKey;\n }\n\n getLastKey(): Key | null {\n return this.lastKey;\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) ?? null;\n }\n\n at(idx: number): Node<T> | null {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\n }\n\n getChildren(key: Key): Iterable<Node<T>> {\n let node = this.keyMap.get(key);\n return node?.childNodes || [];\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 {Key} from '@react-types/shared';\n\n/**\n * A Selection is a special Set containing Keys, which also has an anchor\n * and current selected key for use when range selecting.\n */\nexport class Selection extends Set<Key> {\n anchorKey: Key | null;\n currentKey: Key | null;\n\n constructor(keys?: Iterable<Key> | Selection, anchorKey?: Key | null, currentKey?: Key | null) {\n super(keys);\n if (keys instanceof Selection) {\n this.anchorKey = anchorKey ?? keys.anchorKey;\n this.currentKey = currentKey ?? keys.currentKey;\n } else {\n this.anchorKey = anchorKey ?? null;\n this.currentKey = currentKey ?? null;\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 {DisabledBehavior, FocusStrategy, Key, MultipleSelection, SelectionBehavior, SelectionMode} from '@react-types/shared';\nimport {MultipleSelectionState} from './types';\nimport {Selection} from './Selection';\nimport {useControlledState} from '../utils/useControlledState';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\nfunction equalSets(setA, setB) {\n if (setA.size !== setB.size) {\n return false;\n }\n\n for (let item of setA) {\n if (!setB.has(item)) {\n return false;\n }\n }\n\n return true;\n}\n\nexport interface MultipleSelectionStateProps extends MultipleSelection {\n /**\n * How multiple selection should behave in the collection.\n * @default 'toggle'\n */\n selectionBehavior?: SelectionBehavior,\n /** Whether onSelectionChange should fire even if the new set of keys is the same as the last. */\n allowDuplicateSelectionEvents?: boolean,\n /**\n * Whether `disabledKeys` applies to all interactions, or only selection.\n * @default 'all'\n */\n disabledBehavior?: DisabledBehavior\n}\n\n/**\n * Manages state for multiple selection and focus in a collection.\n */\nexport function useMultipleSelectionState(props: MultipleSelectionStateProps): MultipleSelectionState {\n let {\n selectionMode = 'none' as SelectionMode,\n disallowEmptySelection = false,\n allowDuplicateSelectionEvents,\n selectionBehavior: selectionBehaviorProp = 'toggle',\n disabledBehavior = 'all'\n } = props;\n\n // We want synchronous updates to `isFocused` and `focusedKey` after their setters are called.\n // But we also need to trigger a react re-render. So, we have both a ref (sync) and state (async).\n let isFocusedRef = useRef(false);\n let [, setFocused] = useState(false);\n let focusedKeyRef = useRef<Key | null>(null);\n let childFocusStrategyRef = useRef<FocusStrategy | null>(null);\n let [, setFocusedKey] = useState<Key | null>(null);\n let selectedKeysProp = useMemo(() => convertSelection(props.selectedKeys), [props.selectedKeys]);\n let defaultSelectedKeys = useMemo(() => convertSelection(props.defaultSelectedKeys, new Selection()), [props.defaultSelectedKeys]);\n let [selectedKeys, setSelectedKeys] = useControlledState(\n selectedKeysProp,\n defaultSelectedKeys!,\n props.onSelectionChange\n );\n let disabledKeysProp = useMemo(() =>\n props.disabledKeys ? new Set(props.disabledKeys) : new Set<Key>()\n , [props.disabledKeys]);\n let [selectionBehavior, setSelectionBehavior] = useState(selectionBehaviorProp);\n\n // If the selectionBehavior prop is set to replace, but the current state is toggle (e.g. due to long press\n // to enter selection mode on touch), and the selection becomes empty, reset the selection behavior.\n if (selectionBehaviorProp === 'replace' && selectionBehavior === 'toggle' && typeof selectedKeys === 'object' && selectedKeys.size === 0) {\n setSelectionBehavior('replace');\n }\n\n // If the selectionBehavior prop changes, update the state as well.\n let lastSelectionBehavior = useRef(selectionBehaviorProp);\n useEffect(() => {\n if (selectionBehaviorProp !== lastSelectionBehavior.current) {\n setSelectionBehavior(selectionBehaviorProp);\n lastSelectionBehavior.current = selectionBehaviorProp;\n }\n }, [selectionBehaviorProp]);\n\n return {\n selectionMode,\n disallowEmptySelection,\n selectionBehavior,\n setSelectionBehavior,\n get isFocused() {\n return isFocusedRef.current;\n },\n setFocused(f) {\n isFocusedRef.current = f;\n setFocused(f);\n },\n get focusedKey() {\n return focusedKeyRef.current;\n },\n get childFocusStrategy() {\n return childFocusStrategyRef.current;\n },\n setFocusedKey(k, childFocusStrategy = 'first') {\n focusedKeyRef.current = k;\n childFocusStrategyRef.current = childFocusStrategy;\n setFocusedKey(k);\n },\n selectedKeys,\n setSelectedKeys(keys) {\n if (allowDuplicateSelectionEvents || !equalSets(keys, selectedKeys)) {\n setSelectedKeys(keys);\n }\n },\n disabledKeys: disabledKeysProp,\n disabledBehavior\n };\n}\n\nfunction convertSelection(selection: 'all' | Iterable<Key> | null | undefined, defaultValue?: Selection): 'all' | Set<Key> | undefined {\n if (!selection) {\n return defaultValue;\n }\n\n return selection === 'all'\n ? 'all'\n : new Selection(selection);\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 {\n Collection, DisabledBehavior,\n FocusStrategy,\n Selection as ISelection,\n Key,\n LayoutDelegate,\n LongPressEvent,\n Node,\n PressEvent,\n SelectionBehavior,\n SelectionMode\n} from '@react-types/shared';\nimport {compareNodeOrder, getChildNodes, getFirstItem} from '../collections/getChildNodes';\nimport {MultipleSelectionManager, MultipleSelectionState} from './types';\nimport {Selection} from './Selection';\n\ninterface SelectionManagerOptions {\n allowsCellSelection?: boolean,\n layoutDelegate?: LayoutDelegate,\n fullCollection?: Collection<Node<unknown>>\n}\n\n/**\n * An interface for reading and updating multiple selection state.\n */\nexport class SelectionManager implements MultipleSelectionManager {\n collection: Collection<Node<unknown>>;\n private state: MultipleSelectionState;\n private allowsCellSelection: boolean;\n private _isSelectAll: boolean | null;\n private layoutDelegate: LayoutDelegate | null;\n private fullCollection: Collection<Node<unknown>> | null;\n\n constructor(collection: Collection<Node<unknown>>, state: MultipleSelectionState, options?: SelectionManagerOptions) {\n this.collection = collection;\n this.state = state;\n this.allowsCellSelection = options?.allowsCellSelection ?? false;\n this._isSelectAll = null;\n this.layoutDelegate = options?.layoutDelegate || null;\n this.fullCollection = options?.fullCollection || null;\n }\n\n /**\n * The type of selection that is allowed in the collection.\n */\n get selectionMode(): SelectionMode {\n return this.state.selectionMode;\n }\n\n /**\n * Whether the collection allows empty selection.\n */\n get disallowEmptySelection(): boolean {\n return this.state.disallowEmptySelection;\n }\n\n /**\n * The selection behavior for the collection.\n */\n get selectionBehavior(): SelectionBehavior {\n return this.state.selectionBehavior;\n }\n\n /**\n * Sets the selection behavior for the collection.\n */\n setSelectionBehavior(selectionBehavior: SelectionBehavior): void {\n this.state.setSelectionBehavior(selectionBehavior);\n }\n\n /**\n * Whether the collection is currently focused.\n */\n get isFocused(): boolean {\n return this.state.isFocused;\n }\n\n /**\n * Sets whether the collection is focused.\n */\n setFocused(isFocused: boolean): void {\n this.state.setFocused(isFocused);\n }\n\n /**\n * The current focused key in the collection.\n */\n get focusedKey(): Key | null {\n return this.state.focusedKey;\n }\n\n /** Whether the first or last child of the focused key should receive focus. */\n get childFocusStrategy(): FocusStrategy | null {\n return this.state.childFocusStrategy;\n }\n\n /**\n * Sets the focused key.\n */\n setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void {\n if (key == null || this.collection.getItem(key)) {\n this.state.setFocusedKey(key, childFocusStrategy);\n }\n }\n\n /**\n * The currently selected keys in the collection.\n */\n get selectedKeys(): Set<Key> {\n return this.state.selectedKeys === 'all'\n ? new Set(this.getSelectAllKeys())\n : this.state.selectedKeys;\n }\n\n /**\n * The raw selection value for the collection.\n * Either 'all' for select all, or a set of keys.\n */\n get rawSelection(): ISelection {\n return this.state.selectedKeys;\n }\n\n /**\n * Returns whether a key is selected.\n */\n isSelected(key: Key): boolean {\n if (this.state.selectionMode === 'none') {\n return false;\n }\n\n let mappedKey = this.getKey(key);\n if (mappedKey == null) {\n return false;\n }\n return this.state.selectedKeys === 'all'\n ? this.canSelectItem(mappedKey)\n : this.state.selectedKeys.has(mappedKey);\n }\n\n /**\n * Whether the selection is empty.\n */\n get isEmpty(): boolean {\n return this.state.selectedKeys !== 'all' && this.state.selectedKeys.size === 0;\n }\n\n /**\n * Whether all items in the collection are selected.\n */\n get isSelectAll(): boolean {\n if (this.isEmpty) {\n return false;\n }\n\n if (this.state.selectedKeys === 'all') {\n return true;\n }\n\n if (this._isSelectAll != null) {\n return this._isSelectAll;\n }\n\n let allKeys = this.getSelectAllKeys();\n let selectedKeys = this.state.selectedKeys;\n this._isSelectAll = allKeys.every(k => selectedKeys.has(k));\n return this._isSelectAll;\n }\n\n get firstSelectedKey(): Key | null {\n let first: Node<unknown> | null = null;\n for (let key of this.state.selectedKeys) {\n let item = this.collection.getItem(key);\n if (!first || (item && compareNodeOrder(this.collection, item, first) < 0)) {\n first = item;\n }\n }\n\n return first?.key ?? null;\n }\n\n get lastSelectedKey(): Key | null {\n let last: Node<unknown> | null = null;\n for (let key of this.state.selectedKeys) {\n let item = this.collection.getItem(key);\n if (!last || (item && compareNodeOrder(this.collection, item, last) > 0)) {\n last = item;\n }\n }\n\n return last?.key ?? null;\n }\n\n get disabledKeys(): Set<Key> {\n return this.state.disabledKeys;\n }\n\n get disabledBehavior(): DisabledBehavior {\n return this.state.disabledBehavior;\n }\n\n /**\n * Extends the selection to the given key.\n */\n extendSelection(toKey: Key): void {\n if (this.selectionMode === 'none') {\n return;\n }\n\n if (this.selectionMode === 'single') {\n this.replaceSelection(toKey);\n return;\n }\n\n let mappedToKey = this.getKey(toKey);\n if (mappedToKey == null) {\n return;\n }\n\n let selection: Selection;\n\n // Only select the one key if coming from a select all.\n if (this.state.selectedKeys === 'all') {\n selection = new Selection([mappedToKey], mappedToKey, mappedToKey);\n } else {\n let selectedKeys = this.state.selectedKeys as Selection;\n let anchorKey = selectedKeys.anchorKey ?? mappedToKey;\n selection = new Selection(selectedKeys, anchorKey, mappedToKey);\n for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey ?? mappedToKey)) {\n selection.delete(key);\n }\n\n for (let key of this.getKeyRange(mappedToKey, anchorKey)) {\n if (this.canSelectItem(key)) {\n selection.add(key);\n }\n }\n }\n\n this.state.setSelectedKeys(selection);\n }\n\n private getKeyRange(from: Key, to: Key) {\n let fromItem = this.collection.getItem(from);\n let toItem = this.collection.getItem(to);\n if (fromItem && toItem) {\n if (compareNodeOrder(this.collection, fromItem, toItem) <= 0) {\n return this.getKeyRangeInternal(from, to);\n }\n\n return this.getKeyRangeInternal(to, from);\n }\n\n return [];\n }\n\n private getKeyRangeInternal(from: Key, to: Key) {\n if (this.layoutDelegate?.getKeyRange) {\n return this.layoutDelegate.getKeyRange(from, to);\n }\n\n let keys: Key[] = [];\n let key: Key | null = from;\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item && (item.type === 'item' || (item.type === 'cell' && this.allowsCellSelection))) {\n keys.push(key);\n }\n\n if (key === to) {\n return keys;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return [];\n }\n\n private getKey(key: Key) {\n let item = this.collection.getItem(key);\n if (!item) {\n // ¯\\_(ツ)_/¯\n return key;\n }\n\n // If cell selection is allowed, just return the key.\n if (item.type === 'cell' && this.allowsCellSelection) {\n return key;\n }\n\n // Find a parent item to select\n while (item && item.type !== 'item' && item.parentKey != null) {\n item = this.collection.getItem(item.parentKey);\n }\n\n if (!item || item.type !== 'item') {\n return null;\n }\n\n return item.key;\n }\n\n /**\n * Toggles whether the given key is selected.\n */\n toggleSelection(key: Key): void {\n if (this.selectionMode === 'none') {\n return;\n }\n\n if (this.selectionMode === 'single' && !this.isSelected(key)) {\n this.replaceSelection(key);\n return;\n }\n\n let mappedKey = this.getKey(key);\n if (mappedKey == null) {\n return;\n }\n\n let keys = new Selection(this.state.selectedKeys === 'all' ? this.getSelectAllKeys() : this.state.selectedKeys);\n if (keys.has(mappedKey)) {\n keys.delete(mappedKey);\n // TODO: move anchor to last selected key...\n // Does `current` need to move here too?\n } else if (this.canSelectItem(mappedKey)) {\n keys.add(mappedKey);\n keys.anchorKey = mappedKey;\n keys.currentKey = mappedKey;\n }\n\n if (this.disallowEmptySelection && keys.size === 0) {\n return;\n }\n\n this.state.setSelectedKeys(keys);\n }\n\n /**\n * Replaces the selection with only the given key.\n */\n replaceSelection(key: Key): void {\n if (this.selectionMode === 'none') {\n return;\n }\n\n let mappedKey = this.getKey(key);\n if (mappedKey == null) {\n return;\n }\n\n let selection = this.canSelectItem(mappedKey)\n ? new Selection([mappedKey], mappedKey, mappedKey)\n : new Selection();\n\n this.state.setSelectedKeys(selection);\n }\n\n /**\n * Replaces the selection with the given keys.\n */\n setSelectedKeys(keys: Iterable<Key>): void {\n if (this.selectionMode === 'none') {\n return;\n }\n\n let selection = new Selection();\n for (let key of keys) {\n let mappedKey = this.getKey(key);\n if (mappedKey != null) {\n selection.add(mappedKey);\n if (this.selectionMode === 'single') {\n break;\n }\n }\n }\n\n this.state.setSelectedKeys(selection);\n }\n\n private getSelectAllKeys() {\n // Use the full (unfiltered) collection when available so that materializing\n // the 'all' selection includes items that are currently filtered out (e.g. by Autocomplete).\n let collection = this.fullCollection ?? this.collection;\n let keys: Key[] = [];\n let addKeys = (key: Key | null) => {\n while (key != null) {\n if (this.canSelectItemIn(key, collection)) {\n let item = collection.getItem(key);\n if (item?.type === 'item') {\n keys.push(key);\n }\n\n // Add child keys. If cell selection is allowed, then include item children too.\n if (item?.hasChildNodes && (this.allowsCellSelection || item.type !== 'item')) {\n addKeys(getFirstItem(getChildNodes(item, collection))?.key ?? null);\n }\n }\n\n key = collection.getKeyAfter(key);\n }\n };\n\n addKeys(collection.getFirstKey());\n return keys;\n }\n\n /**\n * Selects all items in the collection.\n */\n selectAll(): void {\n if (!this.isSelectAll && this.selectionMode === 'multiple') {\n this.state.setSelectedKeys('all');\n }\n }\n\n /**\n * Removes all keys from the selection.\n */\n clearSelection(): void {\n if (!this.disallowEmptySelection && (this.state.selectedKeys === 'all' || this.state.selectedKeys.size > 0)) {\n this.state.setSelectedKeys(new Selection());\n }\n }\n\n /**\n * Toggles between select all and an empty selection.\n */\n toggleSelectAll(): void {\n if (this.isSelectAll) {\n this.clearSelection();\n } else {\n this.selectAll();\n }\n }\n\n select(key: Key, e?: PressEvent | LongPressEvent | PointerEvent): void {\n if (this.selectionMode === 'none') {\n return;\n }\n\n if (this.selectionMode === 'single') {\n if (this.isSelected(key) && !this.disallowEmptySelection) {\n this.toggleSelection(key);\n } else {\n this.replaceSelection(key);\n }\n } else if (this.selectionBehavior === 'toggle' || (e && (e.pointerType === 'touch' || e.pointerType === 'virtual'))) {\n // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys\n this.toggleSelection(key);\n } else {\n this.replaceSelection(key);\n }\n }\n\n /**\n * Returns whether the current selection is equal to the given selection.\n */\n isSelectionEqual(selection: Set<Key>): boolean {\n if (selection === this.state.selectedKeys) {\n return true;\n }\n\n // Check if the set of keys match.\n let selectedKeys = this.selectedKeys;\n if (selection.size !== selectedKeys.size) {\n return false;\n }\n\n for (let key of selection) {\n if (!selectedKeys.has(key)) {\n return false;\n }\n }\n\n for (let key of selectedKeys) {\n if (!selection.has(key)) {\n return false;\n }\n }\n\n return true;\n }\n\n canSelectItem(key: Key): boolean {\n return this.canSelectItemIn(key, this.collection);\n }\n\n private canSelectItemIn(key: Key, collection: Collection<Node<unknown>>): boolean {\n if (this.state.selectionMode === 'none' || this.state.disabledKeys.has(key)) {\n return false;\n }\n\n let item = collection.getItem(key);\n if (!item || item?.props?.isDisabled || (item.type === 'cell' && !this.allowsCellSelection)) {\n return false;\n }\n\n return true;\n }\n\n isDisabled(key: Key): boolean {\n return this.state.disabledBehavior === 'all' && (this.state.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled);\n }\n\n isLink(key: Key): boolean {\n return !!this.collection.getItem(key)?.props?.href;\n }\n\n getItemProps(key: Key): any {\n return this.collection.getItem(key)?.props;\n }\n\n withCollection(collection: Collection<Node<unknown>>): SelectionManager {\n return new SelectionManager(collection, this.state, {\n allowsCellSelection: this.allowsCellSelection,\n layoutDelegate: this.layoutDelegate || undefined,\n fullCollection: this.fullCollection ?? this.collection\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 {CollectionBase, CollectionElement, Key, Node} from '@react-types/shared';\nimport {PartialNode} from './types';\nimport React, {ReactElement} from 'react';\n\ninterface CollectionBuilderState {\n renderer?: (value: any) => ReactElement | null\n}\n\ninterface CollectReactElement<T> extends ReactElement {\n getCollectionNode(props: any, context: any): Generator<PartialNode<T>, void, Node<T>[]>\n}\n\nexport class CollectionBuilder<T extends object> {\n private context?: unknown;\n private cache: WeakMap<T, Node<T>> = new WeakMap();\n\n build(props: Partial<CollectionBase<T>>, context?: unknown): Iterable<Node<T>> {\n this.context = context;\n return iterable(() => this.iterateCollection(props));\n }\n\n private *iterateCollection(props: Partial<CollectionBase<T>>): Generator<Node<T>> {\n let {children, items} = props;\n\n if (React.isValidElement<{children: CollectionElement<T>}>(children) && children.type === React.Fragment) {\n yield* this.iterateCollection({\n children: children.props.children,\n items\n });\n } else if (typeof children === 'function') {\n if (!items) {\n throw new Error('props.children was a function but props.items is missing');\n }\n\n let index = 0;\n for (let item of items) {\n yield* this.getFullNode({\n value: item,\n index\n }, {renderer: children});\n index++;\n }\n } else {\n let items: CollectionElement<T>[] = [];\n React.Children.forEach(children, child => {\n if (child) {\n items.push(child);\n }\n });\n\n let index = 0;\n for (let item of items) {\n let nodes = this.getFullNode({\n element: item,\n index: index\n }, {});\n\n for (let node of nodes) {\n index++;\n yield node;\n }\n }\n }\n }\n\n private getKey(item: NonNullable<CollectionElement<T>>, partialNode: PartialNode<T>, state: CollectionBuilderState, parentKey?: Key | null): Key {\n if (item.key != null) {\n return item.key;\n }\n\n if (partialNode.type === 'cell' && partialNode.key != null) {\n return `${parentKey}${partialNode.key}`;\n }\n\n let v = partialNode.value as any;\n if (v != null) {\n let key = v.key ?? v.id;\n if (key == null) {\n throw new Error('No key found for item');\n }\n\n return key;\n }\n\n return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;\n }\n\n private getChildState(state: CollectionBuilderState, partialNode: PartialNode<T>) {\n return {\n renderer: partialNode.renderer || state.renderer\n };\n }\n\n private *getFullNode(partialNode: PartialNode<T> & {index: number}, state: CollectionBuilderState, parentKey?: Key | null, parentNode?: Node<T>): Generator<Node<T>> {\n if (React.isValidElement<{children: CollectionElement<T>}>(partialNode.element) && partialNode.element.type === React.Fragment) {\n let children: CollectionElement<T>[] = [];\n\n React.Children.forEach(partialNode.element.props.children, child => {\n children.push(child);\n });\n\n let index = partialNode.index ?? 0;\n\n for (const child of children) {\n yield* this.getFullNode({\n element: child,\n index: index++\n }, state, parentKey, parentNode);\n }\n\n return;\n }\n\n // If there's a value instead of an element on the node, and a parent renderer function is available,\n // use it to render an element for the value.\n let element = partialNode.element;\n if (!element && partialNode.value && state && state.renderer) {\n let cached = this.cache.get(partialNode.value);\n if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {\n cached.index = partialNode.index;\n cached.parentKey = parentNode ? parentNode.key : null;\n yield cached;\n return;\n }\n\n element = state.renderer(partialNode.value);\n }\n\n // If there's an element with a getCollectionNode function on its type, then it's a supported component.\n // Call this function to get a partial node, and recursively build a full node from there.\n if (React.isValidElement(element)) {\n let type = element.type as unknown as CollectReactElement<T>;\n if (typeof type !== 'function' && typeof type.getCollectionNode !== 'function') {\n let name = element.type;\n throw new Error(`Unknown element <${name}> in collection.`);\n }\n\n let childNodes = type.getCollectionNode(element.props, this.context) as Generator<PartialNode<T>, void, Node<T>[]>;\n let index = partialNode.index ?? 0;\n let result = childNodes.next();\n while (!result.done && result.value) {\n let childNode = result.value;\n\n partialNode.index = index;\n\n let nodeKey = childNode.key ?? null;\n if (nodeKey == null) {\n nodeKey = childNode.element ? null : this.getKey(element as NonNullable<CollectionElement<T>>, partialNode, state, parentKey);\n }\n\n let nodes = this.getFullNode({\n ...childNode,\n key: nodeKey,\n index,\n wrapper: compose(partialNode.wrapper, childNode.wrapper)\n }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);\n\n let children = [...nodes];\n for (let node of children) {\n // Cache the node based on its value\n node.value = childNode.value ?? partialNode.value ?? null;\n if (node.value) {\n this.cache.set(node.value, node);\n }\n\n // The partial node may have specified a type for the child in order to specify a constraint.\n // Verify that the full node that was built recursively matches this type.\n if (partialNode.type && node.type !== partialNode.type) {\n throw new Error(`Unsupported type <${capitalize(node.type)}> in <${capitalize(parentNode?.type ?? 'unknown parent type')}>. Only <${capitalize(partialNode.type)}> is supported.`);\n }\n\n index++;\n yield node;\n }\n\n result = childNodes.next(children);\n }\n\n return;\n }\n\n // Ignore invalid elements\n if (partialNode.key == null || partialNode.type == null) {\n return;\n }\n\n // Create full node\n let builder = this;\n let node: Node<T> = {\n type: partialNode.type,\n props: partialNode.props,\n key: partialNode.key,\n parentKey: parentNode ? parentNode.key : null,\n value: partialNode.value ?? null,\n level: (parentNode?.level ?? 0) + (parentNode?.type === 'item' ? 1 : 0),\n index: partialNode.index,\n rendered: partialNode.rendered,\n textValue: partialNode.textValue ?? '',\n 'aria-label': partialNode['aria-label'],\n wrapper: partialNode.wrapper,\n shouldInvalidate: partialNode.shouldInvalidate,\n hasChildNodes: partialNode.hasChildNodes || false,\n childNodes: iterable(function *() {\n if (!partialNode.hasChildNodes || !partialNode.childNodes) {\n return;\n }\n\n let index = 0;\n for (let child of partialNode.childNodes()) {\n // Ensure child keys are globally unique by prepending the parent node's key\n if (child.key != null) {\n // TODO: Remove this line entirely and enforce that users always provide unique keys.\n // Currently this line will have issues when a parent has a key `a` and a child with key `bc`\n // but another parent has key `ab` and its child has a key `c`. The combined keys would result in both\n // children having a key of `abc`.\n child.key = `${node.key}${child.key}`;\n }\n\n let nodes = builder.getFullNode({...child, index}, builder.getChildState(state, child), node.key, node);\n for (let node of nodes) {\n index++;\n yield node;\n }\n }\n })\n };\n\n yield node;\n }\n}\n\n// Wraps an iterator function as an iterable object, and caches the results.\nfunction iterable<T>(iterator: () => IterableIterator<Node<T>>): Iterable<Node<T>> {\n let cache: Array<Node<T>> = [];\n let iterable: null | IterableIterator<Node<T>> = null;\n return {\n *[Symbol.iterator]() {\n for (let item of cache) {\n yield item;\n }\n\n if (!iterable) {\n iterable = iterator();\n }\n\n for (let item of iterable) {\n cache.push(item);\n yield item;\n }\n }\n };\n}\n\ntype Wrapper = (element: ReactElement) => ReactElement;\nfunction compose(outer: Wrapper | void, inner: Wrapper | void): Wrapper | undefined {\n if (outer && inner) {\n return (element) => outer(inner(element));\n }\n\n if (outer) {\n return outer;\n }\n\n if (inner) {\n return inner;\n }\n}\n\nfunction capitalize(str: string) {\n return str[0].toUpperCase() + str.slice(1);\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 {Collection, CollectionStateBase, Node} from '@react-types/shared';\nimport {CollectionBuilder} from './CollectionBuilder';\nimport {ReactElement, useMemo} from 'react';\n\ninterface CollectionOptions<T, C extends Collection<Node<T>>> extends Omit<CollectionStateBase<T, C>, 'children'> {\n children?: ReactElement<any> | null | (ReactElement<any> | null)[] | ((item: T) => ReactElement<any> | null)\n}\n\ntype CollectionFactory<T, C extends Collection<Node<T>>> = (node: Iterable<Node<T>>) => C;\n\nexport function useCollection<T extends object, C extends Collection<Node<T>> = Collection<Node<T>>>(props: CollectionOptions<T, C>, factory: CollectionFactory<T, C>, context?: unknown): C {\n let builder = useMemo(() => new CollectionBuilder<T>(), []);\n let {children, items, collection} = props;\n let result = useMemo(() => {\n if (collection) {\n return collection;\n }\n let nodes = builder.build({children, items}, context);\n return factory(nodes);\n }, [builder, children, items, collection, context, factory]);\n return result;\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 {Collection, CollectionStateBase, Key, LayoutDelegate, Node} from '@react-types/shared';\nimport {ListCollection} from './ListCollection';\nimport {MultipleSelectionStateProps, useMultipleSelectionState} from '../selection/useMultipleSelectionState';\nimport {SelectionManager} from '../selection/SelectionManager';\nimport {useCallback, useEffect, useMemo, useRef} from 'react';\nimport {useCollection} from '../collections/useCollection';\n\nexport interface ListProps<T> extends CollectionStateBase<T>, MultipleSelectionStateProps {\n /** Filter function to generate a filtered list of nodes. */\n filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>,\n /** @private */\n suppressTextValueWarning?: boolean,\n /**\n * A delegate object that provides layout information for items in the collection.\n * This can be used to override the behavior of shift selection.\n */\n layoutDelegate?: LayoutDelegate\n}\n\nexport interface ListState<T> {\n /** A collection of items in the list. */\n collection: Collection<Node<T>>,\n\n /** A set of items that are disabled. */\n disabledKeys: Set<Key>,\n\n /** A selection manager to read and update multiple selection state. */\n selectionManager: SelectionManager\n}\n\n/**\n * Provides state management for list-like components. Handles building a collection\n * of items from props, and manages multiple selection state.\n */\nexport function useListState<T extends object>(props: ListProps<T>): ListState<T> {\n let {filter, layoutDelegate} = props;\n\n let selectionState = useMultipleSelectionState(props);\n let disabledKeys = useMemo(() =>\n props.disabledKeys ? new Set(props.disabledKeys) : new Set<Key>()\n , [props.disabledKeys]);\n\n let factory = useCallback(nodes => filter ? new ListCollection(filter(nodes)) : new ListCollection(nodes as Iterable<Node<T>>), [filter]);\n let context = useMemo(() => ({suppressTextValueWarning: props.suppressTextValueWarning}), [props.suppressTextValueWarning]);\n\n let collection = useCollection(props, factory, context);\n\n let selectionManager = useMemo(() =>\n new SelectionManager(collection, selectionState, {layoutDelegate})\n , [collection, selectionState, layoutDelegate]\n );\n\n useFocusedKeyReset(collection, selectionManager);\n\n return {\n collection,\n disabledKeys,\n selectionManager\n };\n}\n\n/**\n * Filters a collection using the provided filter function and returns a new ListState.\n */\nexport function UNSTABLE_useFilteredListState<T extends object>(state: ListState<T>, filterFn: ((nodeValue: string, node: Node<T>) => boolean) | null | undefined): ListState<T> {\n let collection = useMemo(() => filterFn ? state.collection.filter!(filterFn) : state.collection, [state.collection, filterFn]);\n let selectionManager = state.selectionManager.withCollection(collection);\n useFocusedKeyReset(collection, selectionManager);\n return {\n collection,\n selectionManager,\n disabledKeys: state.disabledKeys\n };\n}\n\nfunction useFocusedKeyReset<T>(collection: Collection<Node<T>>, selectionManager: SelectionManager) {\n // Reset focused key if that item is deleted from the collection.\n const cachedCollection = useRef<Collection<Node<T>> | null>(null);\n useEffect(() => {\n if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {\n // Walk forward in the old collection to find the next key that still exists in the new collection.\n let key = cachedCollection.current.getKeyAfter(selectionManager.focusedKey);\n let nextFocusedKey: Key | null = null;\n while (key != null) {\n let node = collection.getItem(key);\n if (node && node.type === 'item' && !selectionManager.isDisabled(key)) {\n nextFocusedKey = key;\n break;\n }\n\n key = cachedCollection.current.getKeyAfter(key);\n }\n\n // If no such key exists, walk backward.\n if (nextFocusedKey == null) {\n key = cachedCollection.current.getKeyBefore(selectionManager.focusedKey);\n while (key != null) {\n let node = collection.getItem(key);\n if (node && node.type === 'item' && !selectionManager.isDisabled(key)) {\n nextFocusedKey = key;\n break;\n }\n\n key = cachedCollection.current.getKeyBefore(key);\n }\n }\n\n selectionManager.setFocusedKey(nextFocusedKey);\n }\n cachedCollection.current = collection;\n }, [collection, selectionManager]);\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 {useCallback} from 'react';\nimport {useControlledState} from '../utils/useControlledState';\n\nexport interface OverlayTriggerProps {\n /** Whether the overlay is open by default (controlled). */\n isOpen?: boolean,\n /** Whether the overlay is open by default (uncontrolled). */\n defaultOpen?: boolean,\n /** Handler that is called when the overlay's open state changes. */\n onOpenChange?: (isOpen: boolean) => void\n}\n\nexport interface OverlayTriggerState {\n /** Whether the overlay is currently open. */\n readonly isOpen: boolean,\n /** Sets whether the overlay is open. */\n setOpen(isOpen: boolean): void,\n /** Opens the overlay. */\n open(): void,\n /** Closes the overlay. */\n close(): void,\n /** Toggles the overlay's visibility. */\n toggle(): void\n}\n\n/**\n * Manages state for an overlay trigger. Tracks whether the overlay is open, and provides\n * methods to toggle this state.\n */\nexport function useOverlayTriggerState(props: OverlayTriggerProps): OverlayTriggerState {\n let [isOpen, setOpen] = useControlledState(props.isOpen, props.defaultOpen || false, props.onOpenChange);\n\n const open = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const close = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const toggle = useCallback(() => {\n setOpen(!isOpen);\n }, [setOpen, isOpen]);\n\n return {\n isOpen,\n setOpen,\n open,\n close,\n toggle\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 {ItemElement, ItemProps} from '@react-types/shared';\nimport {PartialNode} from './types';\nimport React, {JSX, ReactElement} from 'react';\n\nfunction Item<T>(props: ItemProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nItem.getCollectionNode = function* getCollectionNode<T>(props: ItemProps<T>, context: any): Generator<PartialNode<T>> {\n let {childItems, title, children} = props;\n\n let rendered = props.title || props.children;\n let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'] || '';\n\n // suppressTextValueWarning is used in components like Tabs, which don't have type to select support.\n if (!textValue && !context?.suppressTextValueWarning && process.env.NODE_ENV !== 'production') {\n console.warn('<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.');\n }\n\n yield {\n type: 'item',\n props: props,\n rendered,\n textValue,\n 'aria-label': props['aria-label'],\n hasChildNodes: hasChildItems(props),\n *childNodes() {\n if (childItems) {\n for (let child of childItems) {\n yield {\n type: 'item',\n value: child\n };\n }\n } else if (title) {\n let items: PartialNode<T>[] = [];\n React.Children.forEach(children, child => {\n items.push({\n type: 'item',\n element: child as ItemElement<T>\n });\n });\n\n yield* items;\n }\n }\n };\n};\n\nfunction hasChildItems<T>(props: ItemProps<T>) {\n if (props.hasChildItems != null) {\n return props.hasChildItems;\n }\n\n if (props.childItems) {\n return true;\n }\n\n if (props.title && React.Children.count(props.children) > 0) {\n return true;\n }\n\n return false;\n}\n\n// We don't want getCollectionNode to show up in the type definition\nlet _Item = Item as <T>(props: ItemProps<T>) => JSX.Element;\nexport {_Item as Item};\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 {CollectionStateBase, Key, Node, Selection, SingleSelection} from '@react-types/shared';\nimport {ListState, useListState} from './useListState';\nimport {useControlledState} from '../utils/useControlledState';\nimport {useMemo} from 'react';\n\nexport interface SingleSelectListProps<T> extends CollectionStateBase<T>, Omit<SingleSelection, 'disallowEmptySelection'> {\n /** Filter function to generate a filtered list of nodes. */\n filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>,\n /** @private */\n suppressTextValueWarning?: boolean\n}\n\nexport interface SingleSelectListState<T> extends ListState<T> {\n /** The key for the currently selected item. */\n readonly selectedKey: Key | null,\n\n /** Sets the selected key. */\n setSelectedKey(key: Key | null): void,\n\n /** The value of the currently selected item. */\n readonly selectedItem: Node<T> | null\n}\n\n/**\n * Provides state management for list-like components with single selection.\n * Handles building a collection of items from props, and manages selection state.\n */\nexport function useSingleSelectListState<T extends object>(props: SingleSelectListProps<T>): SingleSelectListState<T> {\n let [selectedKey, setSelectedKey] = useControlledState(props.selectedKey, props.defaultSelectedKey ?? null, props.onSelectionChange);\n let selectedKeys = useMemo(() => selectedKey != null ? [selectedKey] : [], [selectedKey]);\n let {collection, disabledKeys, selectionManager} = useListState({\n ...props,\n selectionMode: 'single',\n disallowEmptySelection: true,\n allowDuplicateSelectionEvents: true,\n selectedKeys,\n onSelectionChange: (keys: Selection) => {\n // impossible, but TS doesn't know that\n if (keys === 'all') {\n return;\n }\n let key = keys.values().next().value ?? null;\n\n // Always fire onSelectionChange, even if the key is the same\n // as the current key (useControlledState does not).\n if (key === selectedKey && props.onSelectionChange) {\n props.onSelectionChange(key);\n }\n\n setSelectedKey(key);\n }\n });\n\n let selectedItem = selectedKey != null\n ? collection.getItem(selectedKey)\n : null;\n\n return {\n collection,\n disabledKeys,\n selectionManager,\n selectedKey,\n setSelectedKey,\n selectedItem\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 {FocusStrategy, Key} from '@react-types/shared';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {useState} from 'react';\n\nexport type MenuTriggerType = 'press' | 'longPress';\n\nexport interface MenuTriggerProps extends OverlayTriggerProps {\n /**\n * How the menu is triggered.\n * @default 'press'\n */\n trigger?: MenuTriggerType\n}\n\nexport interface MenuTriggerState extends OverlayTriggerState {\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy | null,\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void,\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void\n}\n\nexport interface RootMenuTriggerState extends MenuTriggerState {\n /** Opens a specific submenu tied to a specific menu item at a specific level. */\n openSubmenu: (triggerKey: Key, level: number) => void,\n\n /** Closes a specific submenu tied to a specific menu item at a specific level. */\n closeSubmenu: (triggerKey: Key, level: number) => void,\n\n /** An array of open submenu trigger keys within the menu tree.\n * The index of key within array matches the submenu level in the tree.\n */\n expandedKeysStack: Key[],\n\n /** Closes the menu and all submenus in the menu tree. */\n close: () => void\n}\n\n/**\n * Manages state for a menu trigger. Tracks whether the menu is currently open,\n * and controls which item will receive focus when it opens. Also tracks the open submenus within\n * the menu tree via their trigger keys.\n */\nexport function useMenuTriggerState(props: MenuTriggerProps): RootMenuTriggerState {\n let overlayTriggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n let [expandedKeysStack, setExpandedKeysStack] = useState<Key[]>([]);\n\n let closeAll = () => {\n setExpandedKeysStack([]);\n overlayTriggerState.close();\n };\n\n let openSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n if (level > oldStack.length) {\n return oldStack;\n }\n\n return [...oldStack.slice(0, level), triggerKey];\n });\n };\n\n let closeSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n let key = oldStack[level];\n if (key === triggerKey) {\n return oldStack.slice(0, level);\n } else {\n return oldStack;\n }\n });\n };\n\n return {\n focusStrategy,\n ...overlayTriggerState,\n open(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.open();\n },\n toggle(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.toggle();\n },\n close() {\n closeAll();\n },\n expandedKeysStack,\n openSubmenu,\n closeSubmenu\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 {FocusEvents, HelpTextProps, InputBase, InputDOMProps, LabelableProps, Orientation, Validation, ValidationState, ValueBase} from '@react-types/shared';\nimport {FormValidationState, useFormValidationState} from '../form/useFormValidationState';\nimport {useControlledState} from '../utils/useControlledState';\nimport {useMemo, useState} from 'react';\n\nexport interface RadioGroupProps extends ValueBase<string|null, string>, InputBase, Pick<InputDOMProps, 'name'>, Validation<string>, LabelableProps, HelpTextProps, FocusEvents {\n /**\n * The axis the Radio Button(s) should align with.\n * @default 'vertical'\n */\n orientation?: Orientation\n}\n\nexport interface RadioGroupState extends FormValidationState {\n /**\n * The name for the group, used for native form submission.\n * @deprecated\n * @private\n */\n readonly name: string,\n\n /** Whether the radio group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the radio group is read only. */\n readonly isReadOnly: boolean,\n\n /** Whether the radio group is required. */\n readonly isRequired: boolean,\n\n /**\n * Whether the radio group is valid or invalid.\n * @deprecated Use `isInvalid` instead.\n */\n readonly validationState: ValidationState | null,\n\n /** Whether the radio group is invalid. */\n readonly isInvalid: boolean,\n\n /** The currently selected value. */\n readonly selectedValue: string | null,\n\n /** The default selected value. */\n readonly defaultSelectedValue: string | null,\n\n /** Sets the selected value. */\n setSelectedValue(value: string | null): void,\n\n /** The value of the last focused radio. */\n readonly lastFocusedValue: string | null,\n\n /** Sets the last focused value. */\n setLastFocusedValue(value: string | null): void\n}\n\nlet instance = Math.round(Math.random() * 10000000000);\nlet i = 0;\n\n/**\n * Provides state management for a radio group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useRadioGroupState(props: RadioGroupProps): RadioGroupState {\n // Preserved here for backward compatibility. React Aria now generates the name instead of stately.\n let name = useMemo(() => props.name || `radio-group-${instance}-${++i}`, [props.name]);\n let [selectedValue, setSelected] = useControlledState(props.value, props.defaultValue ?? null, props.onChange);\n let [initialValue] = useState(selectedValue);\n let [lastFocusedValue, setLastFocusedValue] = useState<string | null>(null);\n\n let validation = useFormValidationState({\n ...props,\n value: selectedValue\n });\n\n let setSelectedValue = (value) => {\n if (!props.isReadOnly && !props.isDisabled) {\n setSelected(value);\n validation.commitValidation();\n }\n };\n\n let isInvalid = validation.displayValidation.isInvalid;\n\n return {\n ...validation,\n name,\n selectedValue: selectedValue,\n defaultSelectedValue: props.value !== undefined ? initialValue : props.defaultValue ?? null,\n setSelectedValue,\n lastFocusedValue,\n setLastFocusedValue,\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false,\n validationState: props.validationState || (isInvalid ? 'invalid' : null),\n isInvalid\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 {CollectionBase, CollectionStateBase, FocusableProps, FocusStrategy, HelpTextProps, InputBase, Key, LabelableProps, Node, Selection, TextInputBase, Validation, ValueBase} from '@react-types/shared';\nimport {FormValidationState, useFormValidationState} from '../form/useFormValidationState';\nimport {ListState, useListState} from '../list/useListState';\nimport {OverlayTriggerState, useOverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {useControlledState} from '../utils/useControlledState';\nimport {useMemo, useState} from 'react';\n\nexport type SelectionMode = 'single' | 'multiple';\nexport type ValueType<M extends SelectionMode> = M extends 'single' ? Key | null : readonly Key[];\nexport type ChangeValueType<M extends SelectionMode> = M extends 'single' ? Key | null : Key[];\ntype ValidationType<M extends SelectionMode> = M extends 'single' ? Key : Key[];\n\nexport interface SelectProps<T, M extends SelectionMode = 'single'> extends CollectionBase<T>, Omit<InputBase, 'isReadOnly'>, ValueBase<ValueType<M>, ChangeValueType<M>>, Validation<ValidationType<M>>, HelpTextProps, LabelableProps, TextInputBase, FocusableProps {\n /**\n * Whether single or multiple selection is enabled.\n * @default 'single'\n */\n selectionMode?: M,\n /**\n * The currently selected key in the collection (controlled).\n * @deprecated\n */\n selectedKey?: Key | null,\n /**\n * The initial selected key in the collection (uncontrolled).\n * @deprecated\n */\n defaultSelectedKey?: Key | null,\n /**\n * Handler that is called when the selection changes.\n * @deprecated\n */\n onSelectionChange?: (key: Key | null) => void,\n /** Sets the open state of the menu. */\n isOpen?: boolean,\n /** Sets the default open state of the menu. */\n defaultOpen?: boolean,\n /** Method that is called when the open state of the menu changes. */\n onOpenChange?: (isOpen: boolean) => void,\n /** Whether the Select should close when an item is selected. Defaults to true if selectionMode is single, false otherwise. */\n shouldCloseOnSelect?: boolean,\n /** Whether the select should be allowed to be open when the collection is empty. */\n allowsEmptyCollection?: boolean\n}\n\nexport interface SelectStateOptions<T, M extends SelectionMode = 'single'> extends Omit<SelectProps<T, M>, 'children'>, CollectionStateBase<T> {}\n\nexport interface SelectState<T, M extends SelectionMode = 'single'> extends ListState<T>, OverlayTriggerState, FormValidationState {\n /**\n * The key for the first selected item.\n * @deprecated\n */\n readonly selectedKey: Key | null,\n\n /**\n * The default selected key.\n * @deprecated\n */\n readonly defaultSelectedKey: Key | null,\n\n /**\n * Sets the selected key.\n * @deprecated\n */\n setSelectedKey(key: Key | null): void,\n\n /** The current select value. */\n readonly value: ValueType<M>,\n\n /** The default select value. */\n readonly defaultValue: ValueType<M>,\n\n /** Sets the select value. */\n setValue(value: Key | readonly Key[] | null): void,\n\n /**\n * The value of the first selected item.\n * @deprecated\n */\n readonly selectedItem: Node<T> | null,\n\n /** The value of the selected items. */\n readonly selectedItems: Node<T>[],\n\n /** Whether the select is currently focused. */\n readonly isFocused: boolean,\n\n /** Sets whether the select is focused. */\n setFocused(isFocused: boolean): void,\n\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy | null,\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void,\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void\n}\n\n/**\n * Provides state management for a select component. Handles building a collection\n * of items from props, handles the open state for the popup menu, and manages\n * multiple selection state.\n */\nexport function useSelectState<T extends object, M extends SelectionMode = 'single'>(props: SelectStateOptions<T, M>): SelectState<T, M> {\n let {\n selectionMode = 'single' as M,\n shouldCloseOnSelect = selectionMode === 'single'\n } = props;\n let triggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n let defaultValue = useMemo(() => {\n return props.defaultValue !== undefined ? props.defaultValue : (selectionMode === 'single' ? props.defaultSelectedKey ?? null : []) as ValueType<M>;\n }, [props.defaultValue, props.defaultSelectedKey, selectionMode]);\n let value = useMemo(() => {\n return props.value !== undefined ? props.value : (selectionMode === 'single' ? props.selectedKey : undefined) as ValueType<M>;\n }, [props.value, props.selectedKey, selectionMode]);\n let [controlledValue, setControlledValue] = useControlledState<Key | readonly Key[] | null>(value, defaultValue, props.onChange as any);\n // Only display the first selected item if in single selection mode but the value is an array.\n let displayValue = selectionMode === 'single' && Array.isArray(controlledValue) ? controlledValue[0] : controlledValue;\n let setValue = (value: Key | Key[] | null) => {\n if (selectionMode === 'single') {\n let key = Array.isArray(value) ? value[0] ?? null : value;\n setControlledValue(key);\n if (key !== displayValue) {\n props.onSelectionChange?.(key);\n }\n } else {\n let keys: Key[] = [];\n if (Array.isArray(value)) {\n keys = value;\n } else if (value != null) {\n keys = [value];\n }\n\n setControlledValue(keys);\n }\n };\n\n let listState = useListState({\n ...props,\n selectionMode,\n disallowEmptySelection: selectionMode === 'single',\n allowDuplicateSelectionEvents: true,\n selectedKeys: useMemo(() => convertValue(displayValue), [displayValue]),\n onSelectionChange: (keys: Selection) => {\n // impossible, but TS doesn't know that\n if (keys === 'all') {\n return;\n }\n\n if (selectionMode === 'single') {\n let key = keys.values().next().value ?? null;\n setValue(key);\n } else {\n setValue([...keys]);\n }\n if (shouldCloseOnSelect) {\n triggerState.close();\n }\n\n validationState.commitValidation();\n }\n });\n\n let selectedKey = listState.selectionManager.firstSelectedKey;\n let selectedItems = useMemo(() => {\n return [...listState.selectionManager.selectedKeys].map(key => listState.collection.getItem(key)).filter(item => item != null);\n }, [listState.selectionManager.selectedKeys, listState.collection]);\n\n let validationState = useFormValidationState({\n ...props,\n value: Array.isArray(displayValue) && displayValue.length === 0 ? null : displayValue as any\n });\n\n let [isFocused, setFocused] = useState(false);\n let [initialValue] = useState(displayValue);\n\n return {\n ...validationState,\n ...listState,\n ...triggerState,\n value: displayValue as ValueType<M>,\n defaultValue: defaultValue ?? initialValue as ValueType<M>,\n setValue,\n selectedKey,\n setSelectedKey: setValue,\n selectedItem: selectedItems[0] ?? null,\n selectedItems,\n defaultSelectedKey: props.defaultSelectedKey ?? (props.selectionMode === 'single' ? initialValue as Key : null),\n focusStrategy,\n open(focusStrategy: FocusStrategy | null = null) {\n // Don't open if the collection is empty.\n if (listState.collection.size !== 0 || props.allowsEmptyCollection) {\n setFocusStrategy(focusStrategy);\n triggerState.open();\n }\n },\n toggle(focusStrategy: FocusStrategy | null = null) {\n if (listState.collection.size !== 0 || props.allowsEmptyCollection) {\n setFocusStrategy(focusStrategy);\n triggerState.toggle();\n }\n },\n isFocused,\n setFocused\n };\n}\n\nfunction convertValue(value: Key | Key[] | null | undefined) {\n if (value === undefined) {\n return undefined;\n }\n if (value === null) {\n return [];\n }\n return Array.isArray(value) ? value : [value];\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 {Collection, CollectionBase, CollectionStateBase, Key, Node, SingleSelection} from '@react-types/shared';\nimport {SingleSelectListState, useSingleSelectListState} from '../list/useSingleSelectListState';\nimport {useEffect, useRef} from 'react';\n\nexport interface TabListProps<T> extends CollectionBase<T>, Omit<SingleSelection, 'disallowEmptySelection' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange'> {\n /**\n * Whether the TabList is disabled.\n * Shows that a selection exists, but is not available in that circumstance.\n */\n isDisabled?: boolean,\n /** The currently selected key in the collection (controlled). */\n selectedKey?: Key,\n /** The initial selected keys in the collection (uncontrolled). */\n defaultSelectedKey?: Key,\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (key: Key) => void\n}\n\nexport interface TabListStateOptions<T> extends Omit<TabListProps<T>, 'children'>, CollectionStateBase<T> {}\n\nexport interface TabListState<T> extends SingleSelectListState<T> {\n /** Whether the tab list is disabled. */\n isDisabled: boolean\n}\n\n/**\n * Provides state management for a Tabs component. Tabs include a TabList which tracks\n * which tab is currently selected and displays the content associated with that Tab in a TabPanel.\n */\nexport function useTabListState<T extends object>(props: TabListStateOptions<T>): TabListState<T> {\n let state = useSingleSelectListState<T>({\n ...props,\n onSelectionChange: props.onSelectionChange ? (key => {\n if (key != null) {\n props.onSelectionChange?.(key);\n }\n }) : undefined,\n suppressTextValueWarning: true,\n defaultSelectedKey: props.defaultSelectedKey ?? findDefaultSelectedKey(props.collection, props.disabledKeys ? new Set(props.disabledKeys) : new Set()) ?? undefined\n });\n\n let {\n selectionManager,\n collection,\n selectedKey: currentSelectedKey\n } = state;\n\n let lastSelectedKey = useRef(currentSelectedKey);\n useEffect(() => {\n // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)\n let selectedKey = currentSelectedKey;\n if (props.selectedKey == null && (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey))) {\n selectedKey = findDefaultSelectedKey(collection, state.disabledKeys);\n if (selectedKey != null) {\n // directly set selection because replace/toggle selection won't consider disabled keys\n selectionManager.setSelectedKeys([selectedKey]);\n }\n }\n\n // If the tablist doesn't have focus and the selected key changes or if there isn't a focused key yet, change focused key to the selected key if it exists.\n if (selectedKey != null && selectionManager.focusedKey == null || (!selectionManager.isFocused && selectedKey !== lastSelectedKey.current)) {\n selectionManager.setFocusedKey(selectedKey);\n }\n lastSelectedKey.current = selectedKey;\n });\n\n return {\n ...state,\n isDisabled: props.isDisabled || false\n };\n}\n\nfunction findDefaultSelectedKey<T>(collection: Collection<Node<T>> | undefined, disabledKeys: Set<Key>) {\n let selectedKey: Key | null = null;\n if (collection) {\n selectedKey = collection.getFirstKey();\n // loop over tabs until we find one that isn't disabled and select that\n while (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey !== collection.getLastKey()) {\n selectedKey = collection.getKeyAfter(selectedKey);\n }\n // if this check is true, then every item is disabled, it makes more sense to default to the first key than the last\n if (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey === collection.getLastKey()) {\n selectedKey = collection.getFirstKey();\n }\n }\n\n return selectedKey;\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 {FocusableProps, InputBase, Validation} from '@react-types/shared';\nimport {ReactNode, useState} from 'react';\nimport {useControlledState} from '../utils/useControlledState';\n\nexport interface ToggleStateOptions extends InputBase {\n /**\n * Whether the element should be selected (uncontrolled).\n */\n defaultSelected?: boolean,\n /**\n * Whether the element should be selected (controlled).\n */\n isSelected?: boolean,\n /**\n * Handler that is called when the element's selection state changes.\n */\n onChange?: (isSelected: boolean) => void\n}\n\nexport interface ToggleProps extends ToggleStateOptions, Validation<boolean>, FocusableProps {\n /**\n * The label for the element.\n */\n children?: ReactNode,\n /**\n * The value of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue).\n */\n value?: string\n}\n\nexport interface ToggleState {\n /** Whether the toggle is selected. */\n readonly isSelected: boolean,\n\n /** Whether the toggle is selected by default. */\n readonly defaultSelected: boolean,\n\n /** Updates selection state. */\n setSelected(isSelected: boolean): void,\n\n /** Toggle the selection state. */\n toggle(): void\n}\n\n/**\n * Provides state management for toggle components like checkboxes and switches.\n */\nexport function useToggleState(props: ToggleStateOptions = {}): ToggleState {\n let {isReadOnly} = props;\n\n // have to provide an empty function so useControlledState doesn't throw a fit\n // can't use useControlledState's prop calling because we need the event object from the change\n let [isSelected, setSelected] = useControlledState(props.isSelected, props.defaultSelected || false, props.onChange);\n let [initialValue] = useState(isSelected);\n\n function updateSelected(value) {\n if (!isReadOnly) {\n setSelected(value);\n }\n }\n\n function toggleState() {\n if (!isReadOnly) {\n setSelected(!isSelected);\n }\n }\n\n return {\n isSelected,\n defaultSelected: props.defaultSelected ?? initialValue,\n setSelected: updateSelected,\n toggle: toggleState\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 {OverlayTriggerProps, useOverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {useEffect, useMemo, useRef} from 'react';\n\nexport interface TooltipTriggerProps extends OverlayTriggerProps {\n /**\n * Whether the tooltip should be disabled, independent from the trigger.\n */\n isDisabled?: boolean,\n\n /**\n * The delay time for the tooltip to show up. [See guidelines](https://spectrum.adobe.com/page/tooltip/#Immediate-or-delayed-appearance).\n * @default 1500\n */\n delay?: number,\n\n /**\n * The delay time for the tooltip to close. [See guidelines](https://spectrum.adobe.com/page/tooltip/#Warmup-and-cooldown).\n * @default 500\n */\n closeDelay?: number,\n\n /**\n * By default, opens for both focus and hover. Can be made to open only for focus.\n * @default 'hover'\n */\n trigger?: 'hover' | 'focus',\n\n /**\n * Whether the tooltip should close when the trigger is pressed.\n * @default true\n */\n shouldCloseOnPress?: boolean\n}\n\nconst TOOLTIP_DELAY = 1500; // this seems to be a 1.5 second delay, check with design\nconst TOOLTIP_COOLDOWN = 500;\n\nexport interface TooltipTriggerState {\n /** Whether the tooltip is currently showing. */\n isOpen: boolean,\n /**\n * Shows the tooltip. By default, the tooltip becomes visible after a delay\n * depending on a global warmup timer. The `immediate` option shows the\n * tooltip immediately instead.\n */\n open(immediate?: boolean): void,\n /** Hides the tooltip. */\n close(immediate?: boolean): void\n}\n\nlet tooltips = {};\nlet tooltipId = 0;\nlet globalWarmedUp = false;\nlet globalWarmUpTimeout: ReturnType<typeof setTimeout> | null = null;\nlet globalCooldownTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides\n * methods to toggle this state. Ensures only one tooltip is open at a time and controls\n * the delay for showing a tooltip.\n */\nexport function useTooltipTriggerState(props: TooltipTriggerProps = {}): TooltipTriggerState {\n let {delay = TOOLTIP_DELAY, closeDelay = TOOLTIP_COOLDOWN} = props;\n let {isOpen, open, close} = useOverlayTriggerState(props);\n let id = useMemo(() => `${++tooltipId}`, []);\n let closeTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n let closeCallback = useRef<() => void>(close);\n\n let ensureTooltipEntry = () => {\n tooltips[id] = hideTooltip;\n };\n\n let closeOpenTooltips = () => {\n for (let hideTooltipId in tooltips) {\n if (hideTooltipId !== id) {\n tooltips[hideTooltipId](true);\n delete tooltips[hideTooltipId];\n }\n }\n };\n\n let showTooltip = () => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeOpenTooltips();\n ensureTooltipEntry();\n globalWarmedUp = true;\n open();\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n globalCooldownTimeout = null;\n }\n };\n\n let hideTooltip = (immediate?: boolean) => {\n if (immediate || closeDelay <= 0) {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeCallback.current();\n } else if (!closeTimeout.current) {\n closeTimeout.current = setTimeout(() => {\n closeTimeout.current = null;\n closeCallback.current();\n }, closeDelay);\n }\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalWarmedUp) {\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n }\n globalCooldownTimeout = setTimeout(() => {\n delete tooltips[id];\n globalCooldownTimeout = null;\n globalWarmedUp = false;\n }, Math.max(TOOLTIP_COOLDOWN, closeDelay));\n }\n };\n\n let warmupTooltip = () => {\n closeOpenTooltips();\n ensureTooltipEntry();\n if (!isOpen && !globalWarmedUp) {\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n }\n\n globalWarmUpTimeout = setTimeout(() => {\n globalWarmUpTimeout = null;\n globalWarmedUp = true;\n showTooltip();\n }, delay);\n } else if (!isOpen) {\n showTooltip();\n }\n };\n\n useEffect(() => {\n closeCallback.current = close;\n }, [close]);\n\n\n useEffect(() => {\n return () => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n let tooltip = tooltips[id];\n if (tooltip) {\n delete tooltips[id];\n }\n };\n }, [id]);\n\n return {\n isOpen,\n open: (immediate) => {\n if (!immediate && delay > 0 && !closeTimeout.current) {\n warmupTooltip();\n } else {\n showTooltip();\n }\n },\n close: hideTooltip\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 {Collection, Key, Node} from '@react-types/shared';\n\nexport class TreeCollection<T> implements Collection<Node<T>> {\n private keyMap: Map<Key, Node<T>> = new Map();\n private iterable: Iterable<Node<T>>;\n private firstKey: Key | null = null;\n private lastKey: Key | null = null;\n\n constructor(nodes: Iterable<Node<T>>, {expandedKeys}: {expandedKeys?: Set<Key>} = {}) {\n this.iterable = nodes;\n expandedKeys = expandedKeys || new Set();\n\n let visit = (node: Node<T>) => {\n this.keyMap.set(node.key, node);\n\n if (node.childNodes && (node.type === 'section' || expandedKeys.has(node.key))) {\n for (let child of node.childNodes) {\n visit(child);\n }\n }\n };\n\n for (let node of nodes) {\n visit(node);\n }\n\n let last: Node<T> | null = null;\n let index = 0;\n for (let [key, node] of this.keyMap) {\n if (last) {\n last.nextKey = key;\n node.prevKey = last.key;\n } else {\n this.firstKey = key;\n node.prevKey = undefined;\n }\n\n if (node.type === 'item') {\n node.index = index++;\n }\n\n last = node;\n\n // Set nextKey as undefined since this might be the last node\n // If it isn't the last node, last.nextKey will properly set at start of new loop\n last.nextKey = undefined;\n }\n\n this.lastKey = last?.key ?? null;\n }\n\n *[Symbol.iterator](): IterableIterator<Node<T>> {\n yield* this.iterable;\n }\n\n get size(): number {\n return this.keyMap.size;\n }\n\n getKeys(): IterableIterator<Key> {\n return this.keyMap.keys();\n }\n\n getKeyBefore(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? node.prevKey ?? null : null;\n }\n\n getKeyAfter(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? node.nextKey ?? null : null;\n }\n\n getFirstKey(): Key | null {\n return this.firstKey;\n }\n\n getLastKey(): Key | null {\n return this.lastKey;\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) ?? null;\n }\n\n at(idx: number): Node<T> | null {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\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 {\n Collection,\n CollectionStateBase,\n DisabledBehavior,\n Expandable,\n Key,\n MultipleSelection,\n Node\n} from '@react-types/shared';\nimport {SelectionManager} from '../selection/SelectionManager';\nimport {TreeCollection} from './TreeCollection';\nimport {useCallback, useEffect, useMemo} from 'react';\nimport {useCollection} from '../collections/useCollection';\nimport {useControlledState} from '../utils/useControlledState';\nimport {useMultipleSelectionState} from '../selection/useMultipleSelectionState';\n\nexport interface TreeProps<T>\n extends CollectionStateBase<T>,\n Expandable,\n MultipleSelection {\n /** Whether `disabledKeys` applies to all interactions, or only selection. */\n disabledBehavior?: DisabledBehavior\n}\nexport interface TreeState<T> {\n /** A collection of items in the tree. */\n readonly collection: Collection<Node<T>>,\n\n /** A set of keys for items that are disabled. */\n readonly disabledKeys: Set<Key>,\n\n /** A set of keys for items that are expanded. */\n readonly expandedKeys: Set<Key>,\n\n /** Toggles the expanded state for an item by its key. */\n toggleKey(key: Key): void,\n\n /** Replaces the set of expanded keys. */\n setExpandedKeys(keys: Set<Key>): void,\n\n /** A selection manager to read and update multiple selection state. */\n readonly selectionManager: SelectionManager\n}\n\n/**\n * Provides state management for tree-like components. Handles building a collection\n * of items from props, item expanded state, and manages multiple selection state.\n */\nexport function useTreeState<T extends object>(props: TreeProps<T>): TreeState<T> {\n let {\n onExpandedChange\n } = props;\n\n let [expandedKeys, setExpandedKeys] = useControlledState(\n props.expandedKeys ? new Set(props.expandedKeys) : undefined,\n props.defaultExpandedKeys ? new Set(props.defaultExpandedKeys) : new Set(),\n onExpandedChange\n );\n\n let selectionState = useMultipleSelectionState(props);\n let disabledKeys = useMemo(() =>\n props.disabledKeys ? new Set(props.disabledKeys) : new Set<Key>()\n , [props.disabledKeys]);\n\n let tree = useCollection(props, useCallback(nodes => new TreeCollection(nodes, {expandedKeys}), [expandedKeys]), null);\n\n // Reset focused key if that item is deleted from the collection.\n useEffect(() => {\n if (selectionState.focusedKey != null && !tree.getItem(selectionState.focusedKey)) {\n selectionState.setFocusedKey(null);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [tree, selectionState.focusedKey]);\n\n let onToggle = (key: Key) => {\n setExpandedKeys(toggleKey(expandedKeys, key));\n };\n\n return {\n collection: tree,\n expandedKeys,\n disabledKeys,\n toggleKey: onToggle,\n setExpandedKeys,\n selectionManager: new SelectionManager(tree, selectionState)\n };\n}\n\nfunction toggleKey(set: Set<Key>, key: Key): Set<Key> {\n let res = new Set(set);\n if (res.has(key)) {\n res.delete(key);\n } else {\n res.add(key);\n }\n\n return res;\n}\n","\"use client\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport {\n forwardRef,\n type MouseEvent as ReactMouseEvent,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { HiddenSelect, useButton, useListBox, useOption, useSelect } from \"react-aria\";\nimport { createPortal } from \"react-dom\";\nimport { Item, useSelectState } from \"react-stately\";\nimport { CheckmarkIcon, ChevronDownIcon } from \"@octaviaflow/icons\";\nimport { resolveAccessibleName } from \"../../utils/a11y\";\nimport { cn } from \"../../utils/cn\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\n\nexport interface SelectOption {\n value: string;\n label: string;\n icon?: ReactNode;\n description?: string;\n disabled?: boolean;\n}\n\nexport interface SelectProps {\n options: SelectOption[];\n value?: string;\n defaultValue?: string;\n onChange?: (value: string) => void;\n placeholder?: string;\n searchable?: boolean;\n label?: string;\n error?: boolean;\n errorMessage?: string;\n disabled?: boolean;\n size?: \"sm\" | \"md\" | \"lg\";\n className?: string;\n /** Name for form submission (forwarded to the HiddenSelect element). */\n name?: string;\n /** Required flag for form submission (forwarded to HiddenSelect). */\n required?: boolean;\n /** Stable id for the trigger button (and the source for label htmlFor). */\n id?: string;\n /** Associate this control with an external <form id=\"...\"> element. */\n form?: string;\n /** Auto-focus the trigger on mount. */\n autoFocus?: boolean;\n /** Optional aria-label when no visible label is provided. */\n \"aria-label\"?: string;\n /** Optional aria-labelledby override. */\n \"aria-labelledby\"?: string;\n /** Optional aria-describedby (e.g. for helper text outside the component). */\n \"aria-describedby\"?: string;\n /** Helper text rendered below the trigger. Suppressed when `error`\n * is set (the error message takes the slot). */\n helperText?: ReactNode;\n /**\n * Render a check-mark glyph next to the currently selected option in\n * the dropdown. Defaults to `false` — the highlighted background is\n * already a strong visual cue, so doubling up reads as visual noise\n * in dense menus. Re-enable when the menu sits in a context where the\n * highlight isn't enough (e.g. extremely tall menus).\n */\n showCheckmark?: boolean;\n /**\n * Close the popover when the user clicks anywhere outside the trigger\n * + menu. Defaults to `true` — set to `false` for cases where the\n * caller manages dismissal explicitly (e.g. a modal that wraps the\n * select and owns its own close logic).\n */\n closeOnOutsideClick?: boolean;\n /** Show our design-system `<Tooltip>` on hover over options whose\n * label may be truncated. Default `false` — opt-in via this flag per\n * the platform's \"chrome stays quiet unless explicitly enabled\"\n * convention. The popover surfaces the full label plus the\n * description on a second line when present. */\n showOverflowTooltips?: boolean;\n /**\n * Floor for the dropdown popover width in pixels. The popover is\n * normally pinned to the trigger's width (visual alignment); pass\n * a number here when the trigger is narrow but option labels are\n * long — e.g. Calendar's compact `size=\"sm\"` month/year caption\n * where the trigger is ~70 px but month names like \"September\"\n * need ~110 px. Defaults to the trigger width (no override).\n */\n dropdownMinWidth?: number;\n}\n\n/* ------------------------------------------------------------------ */\n/* OverflowTooltip helper */\n/* ------------------------------------------------------------------ */\n\n/** Wraps `children` in our design-system Tooltip only when the flag is\n * on AND there's content to surface. Mirrors the MultiSelect pattern\n * so both pickers stay consistent. */\nfunction OverflowTooltip({\n enabled,\n content,\n children,\n}: {\n enabled: boolean;\n content: ReactNode;\n children: React.ReactElement;\n}) {\n if (!enabled || content == null || content === \"\") return children;\n return <Tooltip content={content}>{children}</Tooltip>;\n}\n\n/* ------------------------------------------------------------------ */\n/* Internal ListBox rendered inside the dropdown */\n/* ------------------------------------------------------------------ */\n\nfunction ListBox(props: any) {\n const ref = useRef<HTMLUListElement>(null);\n const {\n listBoxRef = ref,\n state,\n showCheckmark,\n showOverflowTooltips,\n } = props;\n const { listBoxProps } = useListBox(props, state, listBoxRef);\n\n return (\n <ul {...listBoxProps} ref={listBoxRef} className={\"ods-select__options\"}>\n {[...state.collection].map((item: any) => (\n <Option\n key={item.key}\n item={item}\n state={state}\n showCheckmark={showCheckmark}\n showOverflowTooltips={showOverflowTooltips}\n />\n ))}\n </ul>\n );\n}\n\nfunction Option({\n item,\n state,\n showCheckmark,\n showOverflowTooltips,\n}: {\n item: any;\n state: any;\n showCheckmark?: boolean;\n showOverflowTooltips?: boolean;\n}) {\n const ref = useRef<HTMLLIElement>(null);\n const { optionProps, isSelected, isFocused, isDisabled } = useOption(\n { key: item.key },\n state,\n ref,\n );\n\n // item.value is the items-array object; the actual SelectOption is nested inside\n const raw = item.value;\n const option: SelectOption | undefined = raw?.value ?? raw;\n\n // Tooltip content — label by itself, OR label + description on two\n // lines so the popover surfaces everything the row contains.\n const tooltipContent: ReactNode = option?.description ? (\n <>\n <span>{option.label}</span>\n <br />\n <span style={{ opacity: 0.75 }}>{option.description}</span>\n </>\n ) : (\n option?.label\n );\n\n return (\n <OverflowTooltip\n enabled={!!showOverflowTooltips}\n content={tooltipContent}\n >\n <li\n {...optionProps}\n ref={ref}\n className={cn(\n \"ods-select__option\",\n isFocused && \"ods-select__option--highlighted\",\n isSelected && \"ods-select__option--selected\",\n isDisabled && \"ods-select__option--disabled\",\n )}\n >\n {option?.icon && <span className={\"ods-select__option-icon\"}>{option.icon}</span>}\n <span className={\"ods-select__option-text\"}>\n <span className={\"ods-select__option-label\"}>{item.rendered}</span>\n {option?.description && (\n <span className={\"ods-select__option-desc\"}>{option.description}</span>\n )}\n </span>\n {isSelected && showCheckmark && (\n <span className={\"ods-select__check\"} aria-hidden=\"true\">\n <CheckmarkIcon size=\"xs\" tone=\"accent\" />\n </span>\n )}\n </li>\n </OverflowTooltip>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Main Select component */\n/* ------------------------------------------------------------------ */\n\n// Generic default placeholder. A select left on THIS placeholder with no\n// label is a genuine a11y gap (we still warn). But a CUSTOM placeholder\n// (e.g. \"Search channels and people…\") describes the control's purpose, so\n// it's used as the accessible-name fallback — see ariaNameProps below.\nconst DEFAULT_SELECT_PLACEHOLDER = \"Select an option...\";\n\nexport const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n options,\n value,\n defaultValue,\n onChange,\n placeholder = DEFAULT_SELECT_PLACEHOLDER,\n searchable = false,\n label,\n error = false,\n errorMessage,\n helperText,\n disabled = false,\n size = \"md\",\n className,\n name,\n required,\n id: providedId,\n form,\n autoFocus,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": consumerDescribedBy,\n showCheckmark = false,\n closeOnOutsideClick = true,\n showOverflowTooltips = false,\n dropdownMinWidth,\n },\n forwardedRef,\n) {\n const triggerRef = useRef<HTMLButtonElement>(null);\n const listBoxRef = useRef<HTMLUListElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [dropdownPos, setDropdownPos] = useState<{\n top?: number;\n bottom?: number;\n left: number;\n width: number;\n maxHeight: number;\n /** \"down\" = popover hangs below the trigger; \"up\" = it stacks above. */\n direction: \"down\" | \"up\";\n }>({ left: 0, width: 0, maxHeight: 240, direction: \"down\" });\n\n // Compose the forwarded ref with our internal trigger ref so consumers\n // can `.focus()` the button while react-aria's internal needs still work.\n const setTriggerRef = (node: HTMLButtonElement | null) => {\n (triggerRef as { current: HTMLButtonElement | null }).current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef)\n (forwardedRef as { current: HTMLButtonElement | null }).current = node;\n };\n\n const reactId = useId();\n const baseId = providedId ?? `ods-select-${reactId}`;\n const hintId = error || helperText ? `${baseId}-hint` : undefined;\n const describedBy =\n [consumerDescribedBy, hintId].filter(Boolean).join(\" \") || undefined;\n\n // Build react-stately items from options, applying search filter\n const filteredOptions = useMemo(() => {\n if (!searchable || !searchQuery) return options;\n const q = searchQuery.toLowerCase();\n return options.filter(\n (o) => o.label.toLowerCase().includes(q) || o.description?.toLowerCase().includes(q),\n );\n }, [options, searchQuery, searchable]);\n\n // Build collection props for useSelectState\n // Resolve accessible name from {label, aria-label, aria-labelledby}. Removes\n // the literal \"Select\" fallback that was masking the real \"no label\" bug.\n // A CUSTOM placeholder is accepted as a last-resort accessible name (a\n // placeholder like \"Search channels and people…\" is a meaningful control\n // description); the generic default placeholder is NOT, so a truly\n // unlabeled select still trips the dev warning.\n const ariaNameProps = useMemo(\n () =>\n resolveAccessibleName({\n label,\n ariaLabel,\n ariaLabelledby: ariaLabelledBy,\n componentName: \"Select\",\n fallbacks: [\n placeholder && placeholder !== DEFAULT_SELECT_PLACEHOLDER ? placeholder : undefined,\n ],\n }),\n [label, ariaLabel, ariaLabelledBy, placeholder],\n );\n\n const ariaProps = useMemo(() => {\n const items = filteredOptions.map((o) => ({\n key: o.value,\n label: o.label,\n value: o,\n isDisabled: o.disabled,\n }));\n\n const props: any = {\n // Visible string label when present; otherwise rely on the aria-*\n // props for screen-reader name.\n label: typeof label === \"string\" ? label : undefined,\n ...ariaNameProps,\n items,\n children: (item: any) => (\n <Item key={item.key} textValue={item.label}>\n {item.label}\n </Item>\n ),\n isDisabled: disabled,\n onSelectionChange: (key: any) => {\n onChange?.(String(key));\n setSearchQuery(\"\");\n },\n };\n\n if (value !== undefined) {\n props.selectedKey = value;\n }\n if (defaultValue !== undefined) {\n props.defaultSelectedKey = defaultValue;\n }\n\n return props;\n }, [filteredOptions, label, disabled, value, defaultValue, onChange, ariaNameProps]);\n\n const state = useSelectState(ariaProps);\n\n const { triggerProps, menuProps } = useSelect(ariaProps, state, triggerRef);\n const { buttonProps } = useButton(triggerProps, triggerRef);\n\n // Position dropdown using getBoundingClientRect (fixed positioning to\n // escape stacking contexts). Now viewport-aware: when the trigger sits\n // near the bottom of the screen we flip the popover upward; either\n // way we cap its height to what's actually available so option lists\n // never spill off-screen (the prior behavior on tall pages).\n const updatePosition = useCallback(() => {\n if (!triggerRef.current) return;\n const rect = triggerRef.current.getBoundingClientRect();\n const viewportH = window.innerHeight;\n const margin = 8; // breathing room at the viewport edge\n const gap = 4; // gap between trigger and popover\n const spaceBelow = viewportH - rect.bottom - gap - margin;\n const spaceAbove = rect.top - gap - margin;\n // Prefer downward; flip up when below is cramped AND above has more\n // room. Falls back to whichever side has more space if both are tight.\n const PREFERRED_MIN = 200;\n const openUp =\n spaceBelow < PREFERRED_MIN && spaceAbove > spaceBelow;\n setDropdownPos({\n ...(openUp\n ? { bottom: viewportH - rect.top + gap }\n : { top: rect.bottom + gap }),\n left: rect.left,\n width: rect.width,\n maxHeight: Math.max(120, openUp ? spaceAbove : spaceBelow),\n direction: openUp ? \"up\" : \"down\",\n });\n }, []);\n\n useEffect(() => {\n if (state.isOpen) {\n updatePosition();\n window.addEventListener(\"scroll\", updatePosition, true);\n window.addEventListener(\"resize\", updatePosition);\n return () => {\n window.removeEventListener(\"scroll\", updatePosition, true);\n window.removeEventListener(\"resize\", updatePosition);\n };\n }\n }, [state.isOpen, updatePosition]);\n\n // Focus search input when dropdown opens\n useEffect(() => {\n if (state.isOpen && searchable && searchRef.current) {\n // Small delay to allow animation frame\n requestAnimationFrame(() => searchRef.current?.focus());\n }\n }, [state.isOpen, searchable]);\n\n // Outside-click + Escape close. react-aria's `useSelect` wires Escape\n // when the trigger keeps focus, but because the dropdown is portaled\n // to <body> and we move focus into the search input on open, the\n // built-in dismiss does not fire on document-level outside clicks.\n // Wire it here ourselves; the `closeOnOutsideClick` prop lets a\n // consumer opt out for modal-managed selects.\n useEffect(() => {\n if (!state.isOpen || !closeOnOutsideClick) return;\n const onPointer = (e: MouseEvent) => {\n const target = e.target as Node;\n if (dropdownRef.current?.contains(target)) return;\n if (triggerRef.current?.contains(target)) return;\n state.close();\n };\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") state.close();\n };\n document.addEventListener(\"mousedown\", onPointer);\n document.addEventListener(\"keydown\", onKey);\n return () => {\n document.removeEventListener(\"mousedown\", onPointer);\n document.removeEventListener(\"keydown\", onKey);\n };\n }, [state.isOpen, state.close, closeOnOutsideClick]);\n\n // Find currently selected option for display\n const selectedOption = options.find((o) => o.value === String(state.selectedKey ?? \"\"));\n\n // ── Close-on-re-click ──────────────────────────────────────────────\n // react-aria's `useSelect` opens on press but does NOT toggle when\n // the trigger is pressed again with the menu open — that's the\n // \"click trigger again\" close pattern users expect from every other\n // select on the web. We restore it here: stash the open state right\n // before the press, and on the trailing click, if it was open AND\n // still is open (meaning react-aria didn't auto-close), force close.\n const wasOpenBeforePressRef = useRef(false);\n const handleTriggerPointerDown = (e: ReactPointerEvent<HTMLButtonElement>) => {\n wasOpenBeforePressRef.current = state.isOpen;\n // Forward to react-aria's own handler if present.\n const baseHandler = (buttonProps as { onPointerDown?: (e: ReactPointerEvent<HTMLButtonElement>) => void }).onPointerDown;\n baseHandler?.(e);\n };\n const handleTriggerClick = (e: ReactMouseEvent<HTMLButtonElement>) => {\n const baseHandler = (buttonProps as { onClick?: (e: ReactMouseEvent<HTMLButtonElement>) => void }).onClick;\n baseHandler?.(e);\n if (wasOpenBeforePressRef.current && state.isOpen) {\n state.close();\n }\n wasOpenBeforePressRef.current = false;\n };\n\n return (\n <div\n className={cn(\n \"ods-select\",\n `ods-select--${size}`,\n error && \"ods-select--error\",\n disabled && \"ods-select--disabled\",\n className,\n )}\n >\n {label && (\n <label className={\"ods-select__label\"} htmlFor={baseId}>\n {label}\n </label>\n )}\n\n <HiddenSelect state={state} triggerRef={triggerRef} label={label} name={name} />\n\n <button\n {...buttonProps}\n onPointerDown={handleTriggerPointerDown}\n onClick={handleTriggerClick}\n ref={setTriggerRef}\n id={baseId}\n form={form}\n autoFocus={autoFocus}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={describedBy}\n aria-required={required || undefined}\n aria-invalid={error ? true : undefined}\n className={cn(\"ods-select__trigger\", state.isOpen && \"ods-select__trigger--open\")}\n >\n <span className={\"ods-select__value\"}>\n {selectedOption ? (\n <>\n {selectedOption.icon && (\n <span className={\"ods-select__value-icon\"}>{selectedOption.icon}</span>\n )}\n {selectedOption.label}\n </>\n ) : (\n <span className={\"ods-select__placeholder\"}>{placeholder}</span>\n )}\n </span>\n <span\n className={cn(\n \"ods-select__chevron\",\n state.isOpen && \"ods-select__chevron--open\",\n )}\n aria-hidden=\"true\"\n >\n <ChevronDownIcon size=\"xs\" />\n </span>\n </button>\n\n {typeof document !== \"undefined\" &&\n createPortal(\n <AnimatePresence>\n {state.isOpen && (\n <motion.div\n ref={dropdownRef}\n data-ods-floating=\"\"\n className={\"ods-select__dropdown\"}\n style={{\n position: \"fixed\",\n ...(dropdownPos.top !== undefined && { top: dropdownPos.top }),\n ...(dropdownPos.bottom !== undefined && { bottom: dropdownPos.bottom }),\n left: dropdownPos.left,\n // `minWidth` (not `width`) keeps the popover at\n // least as wide as the trigger — preserves visual\n // alignment — but allows the consumer to widen it\n // explicitly when option labels demand more room\n // (pass `dropdownMinWidth` to set a higher floor).\n // Avoids the previous `max-content` recipe which\n // made the popover grow uncomfortably wide on\n // searchable / long-option menus.\n minWidth: Math.max(dropdownPos.width, dropdownMinWidth ?? 0),\n // Bound the popover to the available viewport edge so\n // it never spills off-screen on tall pages. Pairs with\n // `overflow-y: auto` from the .ods-select__dropdown\n // SCSS so long option lists scroll internally.\n maxHeight: dropdownPos.maxHeight,\n }}\n initial={{ opacity: 0, scale: 0.95 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.95 }}\n transition={{ duration: 0.2, ease: [0.16, 1, 0.3, 1] }}\n >\n {searchable && (\n <div className={\"ods-select__search-wrap\"}>\n <input\n ref={searchRef}\n className={\"ods-select__search\"}\n type=\"text\"\n placeholder=\"Search...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n aria-label=\"Search options\"\n onKeyDown={(e) => {\n // Allow Escape to close the dropdown\n if (e.key === \"Escape\") {\n state.close();\n }\n }}\n />\n </div>\n )}\n <ListBox\n {...menuProps}\n listBoxRef={listBoxRef}\n state={state}\n showCheckmark={showCheckmark}\n showOverflowTooltips={showOverflowTooltips}\n />\n {filteredOptions.length === 0 && (\n <div className={\"ods-select__empty\"}>No results found</div>\n )}\n </motion.div>\n )}\n </AnimatePresence>,\n document.body,\n )}\n\n {error && errorMessage ? (\n <span\n id={hintId}\n className={\"ods-select__error\"}\n role=\"alert\"\n >\n {errorMessage}\n </span>\n ) : helperText ? (\n <span id={hintId} className={\"ods-select__hint\"}>\n {helperText}\n </span>\n ) : null}\n </div>\n );\n});\n\nSelect.displayName = \"Select\";\n","\"use client\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n} from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/* ---------------------------------------------------------------------------\n * Types\n * ------------------------------------------------------------------------- */\n\nexport type SpinnerSize = \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type SpinnerTone =\n | \"accent\"\n | \"muted\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"error\"\n | \"inverse\";\n\ntype SvgPropsBase = Omit<\n ComponentPropsWithoutRef<\"svg\">,\n \"color\" | \"viewBox\" | \"fill\" | \"size\"\n>;\n\nexport interface SpinnerProps extends SvgPropsBase {\n /** Keyword size OR custom pixel number. Default `\"md\"`. */\n size?: SpinnerSize | number;\n /** Token-driven colour. Defaults to `\"accent\"`. Consumers can also\n * set `color` directly via `style` if they need a one-off. */\n tone?: SpinnerTone;\n /** Accessible label. Default `\"Loading\"`. */\n label?: string;\n}\n\nconst SIZE_PX: Record<SpinnerSize, number> = {\n sm: 16,\n md: 24,\n lg: 32,\n xl: 48,\n};\n\n/* ---------------------------------------------------------------------------\n * Component\n * ------------------------------------------------------------------------- */\n\nexport const Spinner = forwardRef<SVGSVGElement, SpinnerProps>(function Spinner(\n {\n size = \"md\",\n tone = \"accent\",\n label = \"Loading\",\n className,\n style,\n ...rest\n },\n ref,\n) {\n const px = typeof size === \"number\" ? size : SIZE_PX[size];\n const isKeyword = typeof size === \"string\";\n\n return (\n <svg\n {...rest}\n ref={ref}\n className={cn(\n \"ods-spinner\",\n isKeyword && `ods-spinner--${size}`,\n `ods-spinner--${tone}`,\n className,\n )}\n width={px}\n height={px}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n role=\"status\"\n aria-label={label}\n style={style}\n >\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeDasharray=\"31.4 31.4\"\n className=\"ods-spinner__circle\"\n />\n </svg>\n );\n});\n\nSpinner.displayName = \"Spinner\";\n"],"mappings":";;;;;AACA,SAAS,uBAAuB;AAChC,SAAS,iBAAiB,QAAQ,wBAAwB;AAC1D;AAAA,EAEE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA8MW,cAOF,YAPE;AA/HX,IAAM,YAAY;AAAA,EACvB,SAASA,WACP;AAAA,IACE;AAAA,IACA,OAAO;AAAA,IACP,OAAO;AAAA,IAC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C,YAAA;AA3CN,IAAM,UAAuC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAMO,IAAM,UAAUC,YAAwC,SAASC,SACtE;AAAA,EACE,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,KAAK,OAAO,SAAS,WAAW,OAAO,QAAQ,IAAI;AACzD,QAAM,YAAY,OAAO,SAAS;AAElC,SACE,gBAAAF;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,aAAa,gBAAgB,IAAI;AAAA,QACjC,gBAAgB,IAAI;AAAA,QACpB;AAAA,MACF;AAAA,MACA,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,MAAK;AAAA,MACL,cAAY;AAAA,MACZ;AAAA,MAEA,0BAAAA;AAAA,QAAC;AAAA;AAAA,UACC,IAAG;AAAA,UACH,IAAG;AAAA,UACH,GAAE;AAAA,UACF,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,iBAAgB;AAAA,UAChB,WAAU;AAAA;AAAA,MACZ;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,QAAQ,cAAc;","names":["Accordion","motion","useReducedMotion","forwardRef","forwardRef","isValidElement","forwardRef","Slot","isValidElement","jsx","jsxs","forwardRef","Button","useReducedMotion","motion","forwardRef","useId","useImperativeHandle","useRef","jsx","jsxs","forwardRef","useRef","useImperativeHandle","useId","AnimatePresence","motion","cloneElement","isValidElement","useCallback","useId","useRef","useState","value","name","value","a","a","items","node","focusStrategy","value","focusStrategy","jsx","jsxs","useRef","useState","useCallback","AnimatePresence","motion","useId","isValidElement","cloneElement","AnimatePresence","motion","forwardRef","useCallback","useEffect","useId","useRef","useState","useButton","createPortal","ChevronDownIcon","Fragment","jsx","jsxs","useRef","forwardRef","Select","useState","useId","useButton","useCallback","useEffect","ChevronDownIcon","createPortal","AnimatePresence","motion","forwardRef","jsx","forwardRef","Spinner"]}
|