@bazza-ui/react 0.1.0-canary.10 → 0.1.0-canary.12
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-5T5B5SPR.cjs.map +1 -1
- package/dist/{chunk-BFOY762U.js → chunk-65TSJ7MA.js} +2 -2
- package/dist/{chunk-BFOY762U.js.map → chunk-65TSJ7MA.js.map} +1 -1
- package/dist/{chunk-W4ACKMIZ.cjs → chunk-EYMK7XHC.cjs} +2 -2
- package/dist/chunk-EYMK7XHC.cjs.map +1 -0
- package/dist/chunk-JFEVUUPC.cjs.map +1 -1
- package/dist/chunk-M4G6J7DP.cjs.map +1 -1
- package/dist/chunk-SCDHQZFI.cjs.map +1 -1
- package/dist/chunk-XMZZ62VJ.cjs.map +1 -1
- package/dist/combobox/index.cjs +1 -1
- package/dist/combobox/index.cjs.map +1 -1
- package/dist/combobox/index.js +1 -1
- package/dist/command-menu/index.cjs +1 -1
- package/dist/command-menu/index.cjs.map +1 -1
- package/dist/command-menu/index.js +1 -1
- package/dist/context-menu/index.cjs +1 -1
- package/dist/context-menu/index.cjs.map +1 -1
- package/dist/context-menu/index.js +1 -1
- package/dist/dropdown-menu/index.cjs +1 -1
- package/dist/dropdown-menu/index.cjs.map +1 -1
- package/dist/dropdown-menu/index.js +1 -1
- package/dist/dropdown-menu/index.js.map +1 -1
- package/dist/internal/listbox/index.cjs.map +1 -1
- package/dist/internal/popup-menu/index.cjs +1 -1
- package/dist/internal/popup-menu/index.cjs.map +1 -1
- package/dist/internal/popup-menu/index.js +1 -1
- package/dist/kbd/index.cjs.map +1 -1
- package/dist/loaders/index.cjs.map +1 -1
- package/dist/select/index.cjs +1 -1
- package/dist/select/index.cjs.map +1 -1
- package/dist/select/index.d.cts +22 -2
- package/dist/select/index.d.ts +22 -2
- package/dist/select/index.js +1 -1
- package/dist/select/index.js.map +1 -1
- package/dist/video-player/index.cjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-W4ACKMIZ.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/combobox/index.cjs","../../src/combobox/index.parts.ts","../../src/combobox/clear/clear.tsx","../../src/combobox/clear/clear.data-attrs.ts","../../src/combobox/contexts/combobox-positioner-context.ts","../../src/combobox/input/input.tsx","../../src/combobox/input-wrapper/input-wrapper-context.ts","../../src/combobox/input/input.data-attrs.ts","../../src/combobox/input/use-combobox-display-value.ts"],"names":["index_parts_exports","__export","PopupMenuArrow","PopupMenuBackdrop","ComboboxClear","PopupMenuEmpty","PopupMenuGroup","PopupMenuGroupLabel","PopupMenuIcon","ComboboxInput","ComboboxInputWrapper","ComboboxItem","ComboboxItemIndicator","ComboboxItemLabel","PopupMenuList","PopupMenuPopup","PopupMenuPortal","ComboboxPositioner","ComboboxRoot","PopupMenuScrollDownArrow","PopupMenuScrollUpArrow","PopupMenuSeparator","ComboboxSurface","useComboboxPositionerContext","ComboboxClearDataAttributes","props","forwardedRef","keepMounted","disabledProp","render","className","style","onClick","onPointerDown","rest","comboboxContext","useComboboxContext","disabled","hasValue","handleClick","event","handlePointerDown","state","element","useRender","ComboboxPositionerContext","ComboboxInputWrapperContext","useIsInsideInputWrapper","ComboboxInputDataAttributes","useComboboxDisplayValue","params","open","isValueEmpty","getValueText","value","serializedValue","stringifyAsValue","registryText","itemsLabel","resolveLabelFromItems","resolvedLabel","resolveLabel","selectedLabel","texts","v","text"],"mappings":"AAAA,4/BAA0F,yDAA+P,yDAAmF,yDAA2C,ICAvdA,EAAAA,CAAA,CAAA,CAAA,CAAAC,iCAAAA,EAAAD,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAE,mBAAAA,CAAA,QAAA,CAAA,CAAA,CAAA,EAAAC,mBAAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAC,mBAAAA,CAAA,KAAA,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esContent":[null,"// ============================================================================\n// Combobox Parts\n// ============================================================================\n// Re-exports shared components from internal/popup-menu with Combobox-specific\n// Root, Input, Item, ItemLabel, and ItemIndicator components.\n\n// Re-export VirtualItem type from internal/listbox\nexport type { VirtualItem } from '../internal/listbox/index.js'\n\n// Re-export shared components from internal/popup-menu\nexport {\n PopupMenuArrow as Arrow,\n PopupMenuBackdrop as Backdrop,\n PopupMenuEmpty as Empty,\n // Structure\n PopupMenuGroup as Group,\n PopupMenuGroupLabel as GroupLabel,\n // Icon\n PopupMenuIcon as Icon,\n PopupMenuList as List,\n PopupMenuPopup as Popup,\n // Positioning & Container\n PopupMenuPortal as Portal,\n // Scroll indicators\n PopupMenuScrollDownArrow as ScrollDownArrow,\n PopupMenuScrollUpArrow as ScrollUpArrow,\n PopupMenuSeparator as Separator,\n} from '../internal/popup-menu/index.js'\nexport { ComboboxClear as Clear } from './clear/clear.js'\nexport { useComboboxPositionerContext } from './contexts/combobox-positioner-context.js'\nexport { ComboboxInput as Input } from './input/input.js'\nexport { ComboboxInputWrapper as InputWrapper } from './input-wrapper/input-wrapper.js'\nexport { ComboboxItem as Item } from './item/item.js'\nexport { ComboboxItemIndicator as ItemIndicator } from './item-indicator/item-indicator.js'\nexport { ComboboxItemLabel as ItemLabel } from './item-label/item-label.js'\nexport { ComboboxPositioner as Positioner } from './positioner/positioner.js'\n// Combobox-specific components\nexport { ComboboxRoot as Root } from './root/root.js'\nexport { ComboboxSurface as Surface } from './surface/surface.js'\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { ComboboxClearDataAttributes } from './clear.data-attrs.js'\n\nexport { ComboboxClearDataAttributes }\n\nexport interface ComboboxClearState extends Record<string, unknown> {\n /**\n * Whether the combobox has a value (clear button is actionable).\n */\n hasValue: boolean\n /**\n * Whether the combobox is disabled.\n */\n disabled: boolean\n}\n\nexport interface ComboboxClearProps\n extends ComponentProps<'button', ComboboxClear.State> {\n /**\n * Whether to render the button even when there's no value to clear.\n * @default false\n */\n keepMounted?: boolean\n}\n\n/**\n * A button that clears the selected value(s) when clicked.\n * Renders a `<button>` element.\n */\nexport const ComboboxClear = React.forwardRef<\n HTMLButtonElement,\n ComboboxClear.Props\n>(function ComboboxClear(props, forwardedRef) {\n const {\n keepMounted = false,\n disabled: disabledProp,\n render,\n className,\n style,\n onClick,\n onPointerDown,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n\n const disabled = disabledProp ?? comboboxContext.disabled\n\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : comboboxContext.value !== ''\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (event.defaultPrevented) return\n\n if (comboboxContext.multiple) {\n comboboxContext.onValuesChange([])\n } else {\n comboboxContext.onValueChange('')\n }\n\n // Also clear the input value\n comboboxContext.onInputValueChange('')\n },\n [onClick, comboboxContext],\n )\n\n // Prevent pointer down from stealing focus from the input\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent<HTMLButtonElement>) => {\n event.preventDefault()\n onPointerDown?.(event)\n },\n [onPointerDown],\n )\n\n const state: ComboboxClear.State = React.useMemo(\n () => ({\n hasValue,\n disabled,\n }),\n [hasValue, disabled],\n )\n\n const element = useRender({\n render,\n ref: forwardedRef,\n state,\n props: {\n ...rest,\n [ComboboxClearDataAttributes.slot]: '',\n type: 'button',\n tabIndex: -1, // Not tabbable - use keyboard shortcuts instead\n 'aria-label': 'Clear selection',\n disabled: disabled || !hasValue,\n className,\n style,\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n },\n enabled: keepMounted || hasValue,\n defaultTagName: 'button',\n })\n\n // Don't render if no value and not keepMounted\n if (!keepMounted && !hasValue) {\n return null\n }\n\n return element\n})\n\nexport namespace ComboboxClear {\n export type State = ComboboxClearState\n export interface Props extends ComboboxClearProps {}\n}\n","/**\n * Data attributes for ComboboxClear component.\n */\nexport const ComboboxClearDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-clear'}\n */\n slot: 'bazzaui-combobox-clear',\n} as const\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Types\n// ============================================================================\n\n// Types matching Base UI's positioning types\nexport type Side = 'top' | 'bottom' | 'left' | 'right'\nexport type Align = 'start' | 'center' | 'end'\n\n/**\n * Layout mode for the combobox popup.\n * - `'floating'` - Standard dropdown positioning below/above the input\n * - `'input-embedded'` - Popup wraps around the input (macOS-style)\n */\nexport type ComboboxLayout = 'floating' | 'input-embedded'\n\n/**\n * Context value for Combobox Positioner.\n * Provides alignment state for coordinating positioning behavior.\n */\nexport interface ComboboxPositionerContextValue {\n /**\n * The layout mode being used.\n * - `'floating'` - Standard dropdown positioning\n * - `'input-embedded'` - Popup wraps around the input\n */\n layout: ComboboxLayout\n\n /**\n * The side of the popup relative to the input.\n */\n side: Side\n\n /**\n * The alignment of the popup.\n */\n align: Align\n\n /**\n * Height of the input element in pixels.\n * Use this to add appropriate padding to the popup.\n */\n inputHeight: number\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\nconst ComboboxPositionerContext =\n React.createContext<ComboboxPositionerContextValue | null>(null)\n\n/**\n * Hook to access the Combobox Positioner context.\n * Returns null if used outside a ComboboxPositioner.\n */\nexport function useComboboxPositionerContext(): ComboboxPositionerContextValue | null {\n return React.useContext(ComboboxPositionerContext)\n}\n\nexport { ComboboxPositionerContext }\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { useFocusOwner } from '../../internal/popup-menu/contexts/focus-owner-context.js'\nimport { usePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\nimport { resolveLabelFromItems } from '../../utils/items.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { useIsInsideInputWrapper } from '../input-wrapper/input-wrapper-context.js'\nimport { ComboboxInputDataAttributes } from './input.data-attrs.js'\nimport { useComboboxDisplayValue } from './use-combobox-display-value.js'\nimport { useComboboxInputBehavior } from './use-combobox-input-behavior.js'\n\nexport { ComboboxInputDataAttributes }\n\nexport interface ComboboxInputState extends Record<string, unknown> {\n /**\n * Whether the combobox popup is open.\n */\n open: boolean\n /**\n * Whether the input is disabled.\n */\n disabled: boolean\n /**\n * Whether the input currently shows placeholder (no value selected).\n */\n placeholder: boolean\n}\n\n/**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n */\nexport type ComboboxInputCursorBehavior = 'none' | 'end' | 'select-all'\n\nexport interface ComboboxInputProps\n extends Omit<\n ComponentProps<'input', ComboboxInput.State>,\n 'value' | 'onChange' | 'type'\n > {\n /**\n * Placeholder text shown when no value is selected and input is empty.\n * Overrides the placeholder set on Combobox.Root.\n */\n placeholder?: string\n\n /**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n *\n * @default 'none'\n */\n cursorBehavior?: ComboboxInputCursorBehavior\n}\n\n/**\n * An input that acts as both the trigger and search field for the combobox.\n * Renders an `<input>` element with combobox ARIA semantics.\n */\nexport const ComboboxInput = React.forwardRef<\n HTMLInputElement,\n ComboboxInput.Props\n>(function ComboboxInput(props, forwardedRef) {\n const {\n placeholder: placeholderProp,\n disabled: disabledProp,\n cursorBehavior = 'none',\n render,\n className,\n style,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n const popupMenuContext = usePopupMenuContext()\n const focusOwnerStore = useFocusOwner()\n const isInsideInputWrapper = useIsInsideInputWrapper()\n\n const disabled =\n (disabledProp ?? comboboxContext.disabled) || popupMenuContext.disabled\n\n // A `null` item's label (looked up under the empty-string key) acts as the\n // placeholder, taking precedence over the Root placeholder but not an\n // explicit `placeholder` prop on the input.\n const nullItemLabel = resolveLabelFromItems(comboboxContext.items, '')\n const placeholder =\n placeholderProp ??\n (typeof nullItemLabel === 'string' ? nullItemLabel : undefined) ??\n comboboxContext.placeholder\n\n // Get open state\n const open = popupMenuContext.store.useState('open')\n\n // Use display value hook\n const { hasValue, displayValue, getValueText } = useComboboxDisplayValue({\n comboboxContext,\n open,\n })\n\n // Use input behavior hook\n const { handleChange, handleFocus, handleBlur, handleClick, handleKeyDown } =\n useComboboxInputBehavior({\n comboboxContext,\n store: popupMenuContext.store,\n focusOwnerStore,\n open,\n disabled,\n cursorBehavior,\n hasValue,\n getValueText,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n })\n\n // Build data attributes\n const dataAttrs: Record<string, string> = {\n [ComboboxInputDataAttributes.slot]: '',\n }\n if (open) {\n dataAttrs[ComboboxInputDataAttributes.open] = ''\n } else {\n dataAttrs[ComboboxInputDataAttributes.closed] = ''\n }\n if (disabled) {\n dataAttrs[ComboboxInputDataAttributes.disabled] = ''\n }\n if (!hasValue) {\n dataAttrs[ComboboxInputDataAttributes.placeholder] = ''\n }\n // Add input-embedded data attribute when layout is input-embedded\n if (comboboxContext.layout === 'input-embedded') {\n dataAttrs['data-input-embedded'] = ''\n }\n\n // Register input element for positioning\n const mergedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n comboboxContext.setInputElement(node)\n if (typeof forwardedRef === 'function') {\n forwardedRef(node)\n } else if (forwardedRef) {\n forwardedRef.current = node\n }\n },\n [forwardedRef, comboboxContext],\n )\n\n const state: ComboboxInput.State = React.useMemo(\n () => ({\n open,\n disabled,\n placeholder: !hasValue,\n }),\n [open, disabled, hasValue],\n )\n\n // When input-embedded layout, apply styles to position input above the popup\n // Skip z-index if inside an InputWrapper (the wrapper handles z-index)\n const inputEmbeddedStyles: React.CSSProperties | undefined =\n comboboxContext.layout === 'input-embedded' && !isInsideInputWrapper\n ? { position: 'relative', zIndex: 1 }\n : undefined\n\n const element = useRender({\n render,\n ref: mergedRef,\n state,\n props: {\n ...rest,\n ...dataAttrs,\n type: 'text',\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': open,\n 'aria-controls': comboboxContext.listId,\n 'aria-haspopup': 'listbox',\n autoComplete: 'off',\n autoCorrect: 'off',\n spellCheck: false,\n disabled,\n placeholder: !hasValue ? placeholder : undefined,\n className,\n style: { ...inputEmbeddedStyles, ...style },\n value: displayValue,\n onChange: handleChange,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n },\n defaultTagName: 'input',\n })\n\n return element\n})\n\nexport namespace ComboboxInput {\n export interface Props extends ComboboxInputProps {}\n export type State = ComboboxInputState\n}\n","import * as React from 'react'\n\n/**\n * Context to indicate that children are inside an InputWrapper.\n * When true, Input should not apply its own z-index styles for input-embedded layout.\n */\nexport const ComboboxInputWrapperContext = React.createContext<boolean>(false)\n\n/**\n * Hook to check if component is inside a ComboboxInputWrapper.\n */\nexport function useIsInsideInputWrapper(): boolean {\n return React.useContext(ComboboxInputWrapperContext)\n}\n","/**\n * Data attributes for ComboboxInput component.\n */\nexport const ComboboxInputDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-input'}\n */\n slot: 'bazzaui-combobox-input',\n /** Present when the combobox popup is open. */\n open: 'data-open',\n /** Present when the combobox popup is closed. */\n closed: 'data-closed',\n /** Present when the input is disabled. */\n disabled: 'data-disabled',\n /** Present when no value is selected (showing placeholder). */\n placeholder: 'data-placeholder',\n} as const\n","'use client'\n\nimport * as React from 'react'\nimport { resolveLabelFromItems } from '../../utils/items.js'\nimport {\n isValueEmpty,\n resolveLabel,\n stringifyAsValue,\n} from '../../utils/resolve-value-label.js'\nimport type { ComboboxContextValue } from '../contexts/combobox-context.js'\n\nexport interface UseComboboxDisplayValueParams<Value = unknown> {\n comboboxContext: ComboboxContextValue<Value>\n open: boolean\n}\n\nexport interface UseComboboxDisplayValueReturn<Value = unknown> {\n /** Whether a value is selected */\n hasValue: boolean\n /** The value to display in the input */\n displayValue: string\n /** The label of the selected value(s) */\n selectedLabel: string\n /** Get the display text for a value */\n getValueText: (value: Value) => string | undefined\n}\n\n/**\n * Hook to compute the display value for the combobox input.\n *\n * Handles:\n * - Determining if a value is selected (single or multi-select)\n * - Computing the display label for selected values\n * - Switching between selected label (closed) and input value (open)\n */\nexport function useComboboxDisplayValue<Value = unknown>(\n params: UseComboboxDisplayValueParams<Value>,\n): UseComboboxDisplayValueReturn<Value> {\n const { comboboxContext, open } = params\n\n // Determine if showing placeholder (no value selected)\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : !isValueEmpty(comboboxContext.value)\n\n // Get the display text for selected value\n const getValueText = React.useCallback(\n (value: Value): string | undefined => {\n // Serialize for registry lookup\n const serializedValue = stringifyAsValue(\n value,\n comboboxContext.itemToStringValue,\n )\n\n // First try the registry (populated when items mount)\n const registryText = comboboxContext.itemTextRegistry.get(serializedValue)\n if (registryText !== undefined) {\n return registryText\n }\n\n // Fall back to the items prop (for initial render before popup opens).\n // The input can only display strings, so ignore non-string labels here.\n const itemsLabel = resolveLabelFromItems(\n comboboxContext.items,\n serializedValue,\n )\n if (typeof itemsLabel === 'string') {\n return itemsLabel\n }\n\n // Fall back to itemToStringLabel for object values\n const resolvedLabel = resolveLabel(\n value,\n comboboxContext.itemToStringLabel,\n )\n // Only return if it's different from the serialized value (meaning we got a real label)\n if (resolvedLabel && resolvedLabel !== serializedValue) {\n return resolvedLabel\n }\n\n return undefined\n },\n [\n comboboxContext.itemTextRegistry,\n comboboxContext.items,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n ],\n )\n\n // Get the label for the selected value (used when closed or just opened)\n const selectedLabel = React.useMemo(() => {\n if (!hasValue) {\n return ''\n }\n if (comboboxContext.multiple) {\n // For multi-select, show comma-separated values or count\n const texts = comboboxContext.values\n .map((v) => {\n const text = getValueText(v)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(v, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(v, comboboxContext.itemToStringValue)\n )\n })\n .filter(Boolean)\n if (texts.length <= 2) {\n return texts.join(', ')\n }\n return `${texts.length} selected`\n }\n // Single-select: show the value's text.\n // Empty-string values are already handled by the `!hasValue` guard above;\n // this null check also narrows `Value | null` down to `Value`.\n const value = comboboxContext.value\n if (value == null) return ''\n\n const text = getValueText(value)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(value, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(value, comboboxContext.itemToStringValue)\n )\n }, [\n hasValue,\n comboboxContext.multiple,\n comboboxContext.value,\n comboboxContext.values,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n getValueText,\n ])\n\n // Determine the display value for the input\n // When closed: show selected value's text\n // When open: show the search/filter text (inputValue)\n const displayValue = React.useMemo(() => {\n if (!open) {\n // When closed, show the selected value's label\n return selectedLabel\n }\n // When open, use the input value for filtering\n return comboboxContext.inputValue\n }, [open, selectedLabel, comboboxContext.inputValue])\n\n return {\n hasValue,\n displayValue,\n selectedLabel,\n getValueText,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/combobox/index.cjs","../../src/combobox/index.parts.ts","../../src/combobox/clear/clear.tsx","../../src/combobox/clear/clear.data-attrs.ts","../../src/combobox/contexts/combobox-positioner-context.ts","../../src/combobox/input/input.tsx","../../src/combobox/input-wrapper/input-wrapper-context.ts","../../src/combobox/input/input.data-attrs.ts","../../src/combobox/input/use-combobox-display-value.ts"],"names":["index_parts_exports","__export","PopupMenuArrow","PopupMenuBackdrop","ComboboxClear","PopupMenuEmpty","PopupMenuGroup","PopupMenuGroupLabel","PopupMenuIcon","ComboboxInput","ComboboxInputWrapper","ComboboxItem","ComboboxItemIndicator","ComboboxItemLabel","PopupMenuList","PopupMenuPopup","PopupMenuPortal","ComboboxPositioner","ComboboxRoot","PopupMenuScrollDownArrow","PopupMenuScrollUpArrow","PopupMenuSeparator","ComboboxSurface","useComboboxPositionerContext","ComboboxClearDataAttributes","props","forwardedRef","keepMounted","disabledProp","render","className","style","onClick","onPointerDown","rest","comboboxContext","useComboboxContext","disabled","hasValue","handleClick","event","handlePointerDown","state","element","useRender","ComboboxPositionerContext","ComboboxInputWrapperContext","useIsInsideInputWrapper","ComboboxInputDataAttributes","useComboboxDisplayValue","params","open","isValueEmpty","getValueText","value","serializedValue","stringifyAsValue","registryText","itemsLabel","resolveLabelFromItems","resolvedLabel","resolveLabel","selectedLabel","texts","v","text"],"mappings":"AAAA,4/BAA0F,yDAA+P,yDAAmF,yDAA2C,ICAvdA,EAAAA,CAAA,CAAA,CAAA,CAAAC,iCAAAA,EAAAD,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAE,mBAAAA,CAAA,QAAA,CAAA,CAAA,CAAA,EAAAC,mBAAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAC,mBAAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAC,oBAAAA,CAAA,UAAA,CAAA,CAAA,CAAA,EAAAC,mBAAAA,CAAA,IAAA,CAAA,CAAA,CAAA,EAAAC,mBAAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,YAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,IAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,aAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,SAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,IAAA,CAAA,CAAA,CAAA,EAAAC,oBAAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAC,mBAAAA,CAAA,MAAA,CAAA,CAAA,CAAA,EAAAC,mBAAAA,CAAA,UAAA,CAAA,CAAA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,CAAAA,CAAgB,iBAClB,CACF,CAAA,CAGM2B,CAAAA,CAAsB,EAAA,CAAA,OAAA,CAAQ,CAAA,CAAA,EAAM,CACxC,EAAA,CAAI,CAACxB,CAAAA,CACH,MAAO,EAAA,CAET,EAAA,CAAIH,CAAAA,CAAgB,QAAA,CAAU,CAE5B,IAAM4B,CAAAA,CAAQ5B,CAAAA,CAAgB,MAAA,CAC3B,GAAA,CAAK6B,CAAAA,EAAM,CACV,IAAMC,CAAAA,CAAOZ,CAAAA,CAAaW,CAAC,CAAA,CAC3B,OAAIC,CAAAA,GAAS,KAAA,CAAA,CAAkBA,CAAAA,CAG7BJ,iCAAAA,CAAaG,CAAG7B,CAAAA,CAAgB,iBAAiB,CAAA,EACjDqB,iCAAAA,CAAiBQ,CAAG7B,CAAAA,CAAgB,iBAAiB,CAEzD,CAAC,CAAA,CACA,MAAA,CAAO,OAAO,CAAA,CACjB,OAAI4B,CAAAA,CAAM,MAAA,EAAU,CAAA,CACXA,CAAAA,CAAM,IAAA,CAAK,IAAI,CAAA,CAEjB,CAAA,EAAA","file":"/home/runner/work/ui/ui/packages/react/dist/combobox/index.cjs","sourcesContent":[null,"// ============================================================================\n// Combobox Parts\n// ============================================================================\n// Re-exports shared components from internal/popup-menu with Combobox-specific\n// Root, Input, Item, ItemLabel, and ItemIndicator components.\n\n// Re-export VirtualItem type from internal/listbox\nexport type { VirtualItem } from '../internal/listbox/index.js'\n\n// Re-export shared components from internal/popup-menu\nexport {\n PopupMenuArrow as Arrow,\n PopupMenuBackdrop as Backdrop,\n PopupMenuEmpty as Empty,\n // Structure\n PopupMenuGroup as Group,\n PopupMenuGroupLabel as GroupLabel,\n // Icon\n PopupMenuIcon as Icon,\n PopupMenuList as List,\n PopupMenuPopup as Popup,\n // Positioning & Container\n PopupMenuPortal as Portal,\n // Scroll indicators\n PopupMenuScrollDownArrow as ScrollDownArrow,\n PopupMenuScrollUpArrow as ScrollUpArrow,\n PopupMenuSeparator as Separator,\n} from '../internal/popup-menu/index.js'\nexport { ComboboxClear as Clear } from './clear/clear.js'\nexport { useComboboxPositionerContext } from './contexts/combobox-positioner-context.js'\nexport { ComboboxInput as Input } from './input/input.js'\nexport { ComboboxInputWrapper as InputWrapper } from './input-wrapper/input-wrapper.js'\nexport { ComboboxItem as Item } from './item/item.js'\nexport { ComboboxItemIndicator as ItemIndicator } from './item-indicator/item-indicator.js'\nexport { ComboboxItemLabel as ItemLabel } from './item-label/item-label.js'\nexport { ComboboxPositioner as Positioner } from './positioner/positioner.js'\n// Combobox-specific components\nexport { ComboboxRoot as Root } from './root/root.js'\nexport { ComboboxSurface as Surface } from './surface/surface.js'\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { ComboboxClearDataAttributes } from './clear.data-attrs.js'\n\nexport { ComboboxClearDataAttributes }\n\nexport interface ComboboxClearState extends Record<string, unknown> {\n /**\n * Whether the combobox has a value (clear button is actionable).\n */\n hasValue: boolean\n /**\n * Whether the combobox is disabled.\n */\n disabled: boolean\n}\n\nexport interface ComboboxClearProps\n extends ComponentProps<'button', ComboboxClear.State> {\n /**\n * Whether to render the button even when there's no value to clear.\n * @default false\n */\n keepMounted?: boolean\n}\n\n/**\n * A button that clears the selected value(s) when clicked.\n * Renders a `<button>` element.\n */\nexport const ComboboxClear = React.forwardRef<\n HTMLButtonElement,\n ComboboxClear.Props\n>(function ComboboxClear(props, forwardedRef) {\n const {\n keepMounted = false,\n disabled: disabledProp,\n render,\n className,\n style,\n onClick,\n onPointerDown,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n\n const disabled = disabledProp ?? comboboxContext.disabled\n\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : comboboxContext.value !== ''\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (event.defaultPrevented) return\n\n if (comboboxContext.multiple) {\n comboboxContext.onValuesChange([])\n } else {\n comboboxContext.onValueChange('')\n }\n\n // Also clear the input value\n comboboxContext.onInputValueChange('')\n },\n [onClick, comboboxContext],\n )\n\n // Prevent pointer down from stealing focus from the input\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent<HTMLButtonElement>) => {\n event.preventDefault()\n onPointerDown?.(event)\n },\n [onPointerDown],\n )\n\n const state: ComboboxClear.State = React.useMemo(\n () => ({\n hasValue,\n disabled,\n }),\n [hasValue, disabled],\n )\n\n const element = useRender({\n render,\n ref: forwardedRef,\n state,\n props: {\n ...rest,\n [ComboboxClearDataAttributes.slot]: '',\n type: 'button',\n tabIndex: -1, // Not tabbable - use keyboard shortcuts instead\n 'aria-label': 'Clear selection',\n disabled: disabled || !hasValue,\n className,\n style,\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n },\n enabled: keepMounted || hasValue,\n defaultTagName: 'button',\n })\n\n // Don't render if no value and not keepMounted\n if (!keepMounted && !hasValue) {\n return null\n }\n\n return element\n})\n\nexport namespace ComboboxClear {\n export type State = ComboboxClearState\n export interface Props extends ComboboxClearProps {}\n}\n","/**\n * Data attributes for ComboboxClear component.\n */\nexport const ComboboxClearDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-clear'}\n */\n slot: 'bazzaui-combobox-clear',\n} as const\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Types\n// ============================================================================\n\n// Types matching Base UI's positioning types\nexport type Side = 'top' | 'bottom' | 'left' | 'right'\nexport type Align = 'start' | 'center' | 'end'\n\n/**\n * Layout mode for the combobox popup.\n * - `'floating'` - Standard dropdown positioning below/above the input\n * - `'input-embedded'` - Popup wraps around the input (macOS-style)\n */\nexport type ComboboxLayout = 'floating' | 'input-embedded'\n\n/**\n * Context value for Combobox Positioner.\n * Provides alignment state for coordinating positioning behavior.\n */\nexport interface ComboboxPositionerContextValue {\n /**\n * The layout mode being used.\n * - `'floating'` - Standard dropdown positioning\n * - `'input-embedded'` - Popup wraps around the input\n */\n layout: ComboboxLayout\n\n /**\n * The side of the popup relative to the input.\n */\n side: Side\n\n /**\n * The alignment of the popup.\n */\n align: Align\n\n /**\n * Height of the input element in pixels.\n * Use this to add appropriate padding to the popup.\n */\n inputHeight: number\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\nconst ComboboxPositionerContext =\n React.createContext<ComboboxPositionerContextValue | null>(null)\n\n/**\n * Hook to access the Combobox Positioner context.\n * Returns null if used outside a ComboboxPositioner.\n */\nexport function useComboboxPositionerContext(): ComboboxPositionerContextValue | null {\n return React.useContext(ComboboxPositionerContext)\n}\n\nexport { ComboboxPositionerContext }\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { useFocusOwner } from '../../internal/popup-menu/contexts/focus-owner-context.js'\nimport { usePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\nimport { resolveLabelFromItems } from '../../utils/items.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { useIsInsideInputWrapper } from '../input-wrapper/input-wrapper-context.js'\nimport { ComboboxInputDataAttributes } from './input.data-attrs.js'\nimport { useComboboxDisplayValue } from './use-combobox-display-value.js'\nimport { useComboboxInputBehavior } from './use-combobox-input-behavior.js'\n\nexport { ComboboxInputDataAttributes }\n\nexport interface ComboboxInputState extends Record<string, unknown> {\n /**\n * Whether the combobox popup is open.\n */\n open: boolean\n /**\n * Whether the input is disabled.\n */\n disabled: boolean\n /**\n * Whether the input currently shows placeholder (no value selected).\n */\n placeholder: boolean\n}\n\n/**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n */\nexport type ComboboxInputCursorBehavior = 'none' | 'end' | 'select-all'\n\nexport interface ComboboxInputProps\n extends Omit<\n ComponentProps<'input', ComboboxInput.State>,\n 'value' | 'onChange' | 'type'\n > {\n /**\n * Placeholder text shown when no value is selected and input is empty.\n * Overrides the placeholder set on Combobox.Root.\n */\n placeholder?: string\n\n /**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n *\n * @default 'none'\n */\n cursorBehavior?: ComboboxInputCursorBehavior\n}\n\n/**\n * An input that acts as both the trigger and search field for the combobox.\n * Renders an `<input>` element with combobox ARIA semantics.\n */\nexport const ComboboxInput = React.forwardRef<\n HTMLInputElement,\n ComboboxInput.Props\n>(function ComboboxInput(props, forwardedRef) {\n const {\n placeholder: placeholderProp,\n disabled: disabledProp,\n cursorBehavior = 'none',\n render,\n className,\n style,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n const popupMenuContext = usePopupMenuContext()\n const focusOwnerStore = useFocusOwner()\n const isInsideInputWrapper = useIsInsideInputWrapper()\n\n const disabled =\n (disabledProp ?? comboboxContext.disabled) || popupMenuContext.disabled\n\n // A `null` item's label (looked up under the empty-string key) acts as the\n // placeholder, taking precedence over the Root placeholder but not an\n // explicit `placeholder` prop on the input.\n const nullItemLabel = resolveLabelFromItems(comboboxContext.items, '')\n const placeholder =\n placeholderProp ??\n (typeof nullItemLabel === 'string' ? nullItemLabel : undefined) ??\n comboboxContext.placeholder\n\n // Get open state\n const open = popupMenuContext.store.useState('open')\n\n // Use display value hook\n const { hasValue, displayValue, getValueText } = useComboboxDisplayValue({\n comboboxContext,\n open,\n })\n\n // Use input behavior hook\n const { handleChange, handleFocus, handleBlur, handleClick, handleKeyDown } =\n useComboboxInputBehavior({\n comboboxContext,\n store: popupMenuContext.store,\n focusOwnerStore,\n open,\n disabled,\n cursorBehavior,\n hasValue,\n getValueText,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n })\n\n // Build data attributes\n const dataAttrs: Record<string, string> = {\n [ComboboxInputDataAttributes.slot]: '',\n }\n if (open) {\n dataAttrs[ComboboxInputDataAttributes.open] = ''\n } else {\n dataAttrs[ComboboxInputDataAttributes.closed] = ''\n }\n if (disabled) {\n dataAttrs[ComboboxInputDataAttributes.disabled] = ''\n }\n if (!hasValue) {\n dataAttrs[ComboboxInputDataAttributes.placeholder] = ''\n }\n // Add input-embedded data attribute when layout is input-embedded\n if (comboboxContext.layout === 'input-embedded') {\n dataAttrs['data-input-embedded'] = ''\n }\n\n // Register input element for positioning\n const mergedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n comboboxContext.setInputElement(node)\n if (typeof forwardedRef === 'function') {\n forwardedRef(node)\n } else if (forwardedRef) {\n forwardedRef.current = node\n }\n },\n [forwardedRef, comboboxContext],\n )\n\n const state: ComboboxInput.State = React.useMemo(\n () => ({\n open,\n disabled,\n placeholder: !hasValue,\n }),\n [open, disabled, hasValue],\n )\n\n // When input-embedded layout, apply styles to position input above the popup\n // Skip z-index if inside an InputWrapper (the wrapper handles z-index)\n const inputEmbeddedStyles: React.CSSProperties | undefined =\n comboboxContext.layout === 'input-embedded' && !isInsideInputWrapper\n ? { position: 'relative', zIndex: 1 }\n : undefined\n\n const element = useRender({\n render,\n ref: mergedRef,\n state,\n props: {\n ...rest,\n ...dataAttrs,\n type: 'text',\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': open,\n 'aria-controls': comboboxContext.listId,\n 'aria-haspopup': 'listbox',\n autoComplete: 'off',\n autoCorrect: 'off',\n spellCheck: false,\n disabled,\n placeholder: !hasValue ? placeholder : undefined,\n className,\n style: { ...inputEmbeddedStyles, ...style },\n value: displayValue,\n onChange: handleChange,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n },\n defaultTagName: 'input',\n })\n\n return element\n})\n\nexport namespace ComboboxInput {\n export interface Props extends ComboboxInputProps {}\n export type State = ComboboxInputState\n}\n","import * as React from 'react'\n\n/**\n * Context to indicate that children are inside an InputWrapper.\n * When true, Input should not apply its own z-index styles for input-embedded layout.\n */\nexport const ComboboxInputWrapperContext = React.createContext<boolean>(false)\n\n/**\n * Hook to check if component is inside a ComboboxInputWrapper.\n */\nexport function useIsInsideInputWrapper(): boolean {\n return React.useContext(ComboboxInputWrapperContext)\n}\n","/**\n * Data attributes for ComboboxInput component.\n */\nexport const ComboboxInputDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-input'}\n */\n slot: 'bazzaui-combobox-input',\n /** Present when the combobox popup is open. */\n open: 'data-open',\n /** Present when the combobox popup is closed. */\n closed: 'data-closed',\n /** Present when the input is disabled. */\n disabled: 'data-disabled',\n /** Present when no value is selected (showing placeholder). */\n placeholder: 'data-placeholder',\n} as const\n","'use client'\n\nimport * as React from 'react'\nimport { resolveLabelFromItems } from '../../utils/items.js'\nimport {\n isValueEmpty,\n resolveLabel,\n stringifyAsValue,\n} from '../../utils/resolve-value-label.js'\nimport type { ComboboxContextValue } from '../contexts/combobox-context.js'\n\nexport interface UseComboboxDisplayValueParams<Value = unknown> {\n comboboxContext: ComboboxContextValue<Value>\n open: boolean\n}\n\nexport interface UseComboboxDisplayValueReturn<Value = unknown> {\n /** Whether a value is selected */\n hasValue: boolean\n /** The value to display in the input */\n displayValue: string\n /** The label of the selected value(s) */\n selectedLabel: string\n /** Get the display text for a value */\n getValueText: (value: Value) => string | undefined\n}\n\n/**\n * Hook to compute the display value for the combobox input.\n *\n * Handles:\n * - Determining if a value is selected (single or multi-select)\n * - Computing the display label for selected values\n * - Switching between selected label (closed) and input value (open)\n */\nexport function useComboboxDisplayValue<Value = unknown>(\n params: UseComboboxDisplayValueParams<Value>,\n): UseComboboxDisplayValueReturn<Value> {\n const { comboboxContext, open } = params\n\n // Determine if showing placeholder (no value selected)\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : !isValueEmpty(comboboxContext.value)\n\n // Get the display text for selected value\n const getValueText = React.useCallback(\n (value: Value): string | undefined => {\n // Serialize for registry lookup\n const serializedValue = stringifyAsValue(\n value,\n comboboxContext.itemToStringValue,\n )\n\n // First try the registry (populated when items mount)\n const registryText = comboboxContext.itemTextRegistry.get(serializedValue)\n if (registryText !== undefined) {\n return registryText\n }\n\n // Fall back to the items prop (for initial render before popup opens).\n // The input can only display strings, so ignore non-string labels here.\n const itemsLabel = resolveLabelFromItems(\n comboboxContext.items,\n serializedValue,\n )\n if (typeof itemsLabel === 'string') {\n return itemsLabel\n }\n\n // Fall back to itemToStringLabel for object values\n const resolvedLabel = resolveLabel(\n value,\n comboboxContext.itemToStringLabel,\n )\n // Only return if it's different from the serialized value (meaning we got a real label)\n if (resolvedLabel && resolvedLabel !== serializedValue) {\n return resolvedLabel\n }\n\n return undefined\n },\n [\n comboboxContext.itemTextRegistry,\n comboboxContext.items,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n ],\n )\n\n // Get the label for the selected value (used when closed or just opened)\n const selectedLabel = React.useMemo(() => {\n if (!hasValue) {\n return ''\n }\n if (comboboxContext.multiple) {\n // For multi-select, show comma-separated values or count\n const texts = comboboxContext.values\n .map((v) => {\n const text = getValueText(v)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(v, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(v, comboboxContext.itemToStringValue)\n )\n })\n .filter(Boolean)\n if (texts.length <= 2) {\n return texts.join(', ')\n }\n return `${texts.length} selected`\n }\n // Single-select: show the value's text.\n // Empty-string values are already handled by the `!hasValue` guard above;\n // this null check also narrows `Value | null` down to `Value`.\n const value = comboboxContext.value\n if (value == null) return ''\n\n const text = getValueText(value)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(value, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(value, comboboxContext.itemToStringValue)\n )\n }, [\n hasValue,\n comboboxContext.multiple,\n comboboxContext.value,\n comboboxContext.values,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n getValueText,\n ])\n\n // Determine the display value for the input\n // When closed: show selected value's text\n // When open: show the search/filter text (inputValue)\n const displayValue = React.useMemo(() => {\n if (!open) {\n // When closed, show the selected value's label\n return selectedLabel\n }\n // When open, use the input value for filtering\n return comboboxContext.inputValue\n }, [open, selectedLabel, comboboxContext.inputValue])\n\n return {\n hasValue,\n displayValue,\n selectedLabel,\n getValueText,\n }\n}\n"]}
|
package/dist/combobox/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as vo,b as Vo,c as Mo,d as Eo,e as Lo,f as te,g as wo}from"../chunk-KO3DXT3Y.js";import{J as io,K as po,L as Ct,N as mo,O as co,P as bo,Q as xo,R as N,S as F,T as fo,U as Co,W as go,a as ro,aa as gt,ba as ho,d as de,da as Po,ea as Io,fa as Ro,pa as So,q as ao,s as so,sa as yo,t as lo,v as uo,w as D,x as ft}from"../chunk-BFOY762U.js";import{a as oe,p as mt,q as ct,w as bt,x as dt,y as xt}from"../chunk-A4Z5BY7H.js";import{a as pt}from"../chunk-4C666HHU.js";var zo={};pt(zo,{Arrow:()=>so,Backdrop:()=>lo,Clear:()=>Me,Empty:()=>Co,Group:()=>So,GroupLabel:()=>go,Icon:()=>fo,Input:()=>we,InputWrapper:()=>ke,Item:()=>Te,ItemIndicator:()=>He,ItemLabel:()=>Oe,List:()=>ho,Popup:()=>io,Portal:()=>po,Positioner:()=>De,Root:()=>Ae,ScrollDownArrow:()=>Io,ScrollUpArrow:()=>Po,Separator:()=>yo,Surface:()=>Fe,useComboboxPositionerContext:()=>Ee});import{useRender as ht}from"@base-ui/react/use-render";import*as _ from"react";var ko={slot:"bazzaui-combobox-clear"};var Me=_.forwardRef(function(e,o){let{keepMounted:i=!1,disabled:u,render:s,className:p,style:c,onClick:a,onPointerDown:t,...P}=e,m=D(),b=u??m.disabled,I=m.multiple?m.values.length>0:m.value!=="",d=_.useCallback(R=>{a?.(R),!R.defaultPrevented&&(m.multiple?m.onValuesChange([]):m.onValueChange(""),m.onInputValueChange(""))},[a,m]),g=_.useCallback(R=>{R.preventDefault(),t?.(R)},[t]),l=_.useMemo(()=>({hasValue:I,disabled:b}),[I,b]),S=ht({render:s,ref:o,state:l,props:{...P,[ko.slot]:"",type:"button",tabIndex:-1,"aria-label":"Clear selection",disabled:b||!I,className:p,style:c,onClick:d,onPointerDown:g},enabled:i||I,defaultTagName:"button"});return!i&&!I?null:S});import*as xe from"react";var fe=xe.createContext(null);function Ee(){return xe.useContext(fe)}import{useRender as Pt}from"@base-ui/react/use-render";import*as ne from"react";import*as Ce from"react";var Le=Ce.createContext(!1);function To(){return Ce.useContext(Le)}var Q={slot:"bazzaui-combobox-input",open:"data-open",closed:"data-closed",disabled:"data-disabled",placeholder:"data-placeholder"};import*as se from"react";function Ho(x){let{comboboxContext:e,open:o}=x,i=e.multiple?e.values.length>0:!xo(e.value),u=se.useCallback(c=>{let a=F(c,e.itemToStringValue),t=e.itemTextRegistry.get(a);if(t!==void 0)return t;let P=te(e.items,a);if(typeof P=="string")return P;let m=N(c,e.itemToStringLabel);if(m&&m!==a)return m},[e.itemTextRegistry,e.items,e.itemToStringLabel,e.itemToStringValue]),s=se.useMemo(()=>{if(!i)return"";if(e.multiple){let t=e.values.map(P=>{let m=u(P);return m!==void 0?m:N(P,e.itemToStringLabel)||F(P,e.itemToStringValue)}).filter(Boolean);return t.length<=2?t.join(", "):`${t.length} selected`}let c=e.value;if(c==null)return"";let a=u(c);return a!==void 0?a:N(c,e.itemToStringLabel)||F(c,e.itemToStringValue)},[i,e.multiple,e.value,e.values,e.itemToStringLabel,e.itemToStringValue,u]),p=se.useMemo(()=>o?e.inputValue:s,[o,s,e.inputValue]);return{hasValue:i,displayValue:p,selectedLabel:s,getValueText:u}}import*as T from"react";function Oo(x){let{comboboxContext:e,store:o,focusOwnerStore:i,open:u,disabled:s,cursorBehavior:p,hasValue:c,getValueText:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}=x,I=T.useRef(!1),d=T.useRef(!1),g=T.useRef(!1),l=T.useRef(null),S=T.useRef(null),R=T.useRef(null);T.useEffect(()=>{if(!u)return;let n=f=>{let r=e.inputRef.current,v=e.inputWrapperRef.current,y=document.getElementById(e.listId),O=f.target,W=r?.contains(O),z=v?.contains(O),ee=y?.contains(O);!W&&!z&&!ee&&(R.current=f)};return document.addEventListener("pointerdown",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),R.current=null}},[u,e.inputRef,e.inputWrapperRef,e.listId]),T.useLayoutEffect(()=>{let n=e.inputRef.current;if(n&&u&&S.current){let{start:f,end:r}=S.current,v=n.selectionStart,y=n.value.length;v===y&&f!==y&&n.setSelectionRange(f,r),S.current=null}});let L=T.useRef(u);T.useLayoutEffect(()=>{if(u&&!L.current){if(I.current){I.current=!1,L.current=u;return}if(g.current){g.current=!1,d.current=!1,l.current=null,L.current=u;return}if(d.current&&p==="none"){let f=e.inputRef.current,r=l.current;f&&r!==null&&requestAnimationFrame(()=>{let v=f.value.length,y=Math.min(r,v);f.setSelectionRange(y,y)}),d.current=!1,l.current=null,L.current=u;return}c&&e.multiple&&e.onInputValueChange("");let n=e.inputRef.current;if(n){let f=n.value.length;p==="select-all"&&f>0?requestAnimationFrame(()=>{n.setSelectionRange(0,n.value.length)}):p==="end"&&f>0&&requestAnimationFrame(()=>{n.setSelectionRange(n.value.length,n.value.length)})}}L.current=u},[u,e,c,p]);let w=T.useCallback(n=>{let f=n.target,r=f.value,v=f.selectionStart,y=f.selectionEnd;v!==null&&y!==null&&(S.current={start:v,end:y}),e.onInputValueChange(r),e.setFilterActive(),o.setSearch(r),o.state.open||(I.current=!0,e.openCombobox())},[e,o]),k=T.useCallback(n=>{if(t?.(n),n.defaultPrevented)return;let f=o.state.open;if(f&&(g.current=!0),e.openOnFocus&&!s&&!f){if(c&&!e.multiple){let r=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(r)}e.openCombobox()}},[t,e,s,o,c,a]),V=T.useCallback(n=>{P?.(n),!n.defaultPrevented&&requestAnimationFrame(()=>{let f=document.activeElement,v=document.getElementById(e.listId)?.contains(f),y=f===e.inputRef.current;if(!v&&!y){g.current=!1;let O=R.current,W=O?oe.outsidePress:oe.focusOut;R.current=null,e.closeCombobox(W,O??void 0)}})},[P,e]),A=T.useCallback(n=>{if(m?.(n),n.defaultPrevented)return;let f=o.state.open;if(!s&&!f){let r=n.target;if(p==="none"){let v=r.selectionStart;l.current=v,d.current=!0}if(c&&!e.multiple){let v=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(v)}e.openCombobox()}else f&&(g.current=!0)},[m,e,s,o,p,c,a]),K=T.useCallback(n=>{if(b?.(n),!n.defaultPrevented){if(u&&n.key==="Escape"){n.preventDefault(),e.closeCombobox(oe.escapeKey);return}if(!u&&(n.key==="ArrowDown"||n.key==="ArrowUp"||n.key==="Enter")){if(n.preventDefault(),c&&!e.multiple){let f=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(f)}e.openCombobox();return}}},[u,e,b,c,a]),{handleKeyDown:j}=bo({store:o,surfaceId:"combobox-input",focusOwnerStore:i,depth:0,submenuContext:null,subpageContext:null,enabled:u,enableTypeToSearch:!1,onKeyDown:K,closeAll:e.closeCombobox,skipFocusOwnerCheck:!0});return{handleChange:w,handleFocus:k,handleBlur:V,handleClick:A,handleKeyDown:j,selectionRef:S}}var we=ne.forwardRef(function(e,o){let{placeholder:i,disabled:u,cursorBehavior:s="none",render:p,className:c,style:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b,...I}=e,d=D(),g=de(),l=ro(),S=To(),R=(u??d.disabled)||g.disabled,L=te(d.items,""),w=i??(typeof L=="string"?L:void 0)??d.placeholder,k=g.store.useState("open"),{hasValue:V,displayValue:A,getValueText:K}=Ho({comboboxContext:d,open:k}),{handleChange:j,handleFocus:n,handleBlur:f,handleClick:r,handleKeyDown:v}=Oo({comboboxContext:d,store:g.store,focusOwnerStore:l,open:k,disabled:R,cursorBehavior:s,hasValue:V,getValueText:K,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}),y={[Q.slot]:""};k?y[Q.open]="":y[Q.closed]="",R&&(y[Q.disabled]=""),V||(y[Q.placeholder]=""),d.layout==="input-embedded"&&(y["data-input-embedded"]="");let O=ne.useCallback(M=>{d.setInputElement(M),typeof o=="function"?o(M):o&&(o.current=M)},[o,d]),W=ne.useMemo(()=>({open:k,disabled:R,placeholder:!V}),[k,R,V]),z=d.layout==="input-embedded"&&!S?{position:"relative",zIndex:1}:void 0;return Pt({render:p,ref:O,state:W,props:{...I,...y,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":k,"aria-controls":d.listId,"aria-haspopup":"listbox",autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:R,placeholder:V?void 0:w,className:c,style:{...z,...a},value:A,onChange:j,onFocus:n,onBlur:f,onClick:r,onKeyDown:v},defaultTagName:"input"})});import{useRender as It}from"@base-ui/react/use-render";import*as re from"react";var ge={slot:"bazzaui-combobox-input-wrapper",open:"data-open"};import{jsx as St}from"react/jsx-runtime";var Rt={open:x=>x?{[ge.open]:""}:null},ke=re.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,{store:a}=de(),t=D(),P=a.useState("open"),m=re.useMemo(()=>({open:P}),[P]),b=t.layout==="input-embedded"?{position:"relative",zIndex:1}:{position:"relative"},I=re.useCallback(g=>{t.setInputWrapperElement(g),typeof o=="function"?o(g):o&&(o.current=g)},[o,t]),d=It({render:i,ref:I,state:m,stateAttributesMapping:Rt,props:{...c,[ge.slot]:"",className:u,style:{...b,...s},children:p},defaultTagName:"div"});return St(Le.Provider,{value:!0,children:d})});import{useRender as vt}from"@base-ui/react/use-render";import*as E from"react";var q={slot:"bazzaui-combobox-item",highlighted:"data-highlighted",disabled:"data-disabled",selected:"data-selected",first:"data-first",last:"data-last",firstInGroup:"data-first-in-group",lastInGroup:"data-last-in-group"};import*as le from"react";var he=le.createContext(null);function ue(){let x=le.useContext(he);if(!x)throw new Error("ComboboxItem child components must be used within a Combobox.Item");return x}function yt(){return le.useContext(he)}import{jsx as Et}from"react/jsx-runtime";var Vt={highlighted:x=>x?{[q.highlighted]:""}:null,disabled:x=>x?{[q.disabled]:""}:null,selected:x=>x?{[q.selected]:""}:null,first:x=>x?{[q.first]:""}:null,last:x=>x?{[q.last]:""}:null,firstInGroup:x=>x?{[q.firstInGroup]:""}:null,lastInGroup:x=>x?{[q.lastInGroup]:""}:null};function Mt(x,e){let{value:o,textValue:i,keywords:u,disabled:s=!1,onSelect:p,forceMount:c=!1,render:a,className:t,style:P,onClick:m,onPointerDown:b,onPointerMove:I,children:d,...g}=x,l=D(),S=E.useMemo(()=>F(o,l.itemToStringValue),[o,l.itemToStringValue]),R=E.useId(),L=o===null?`combobox-clear-${R}`:void 0,w=E.useMemo(()=>Lo(l.items,S),[l.items,S]),k=w?.label,V=E.useMemo(()=>N(o,l.itemToStringLabel),[o,l.itemToStringLabel]),A=E.useMemo(()=>{if(i!==void 0)return i;if(typeof k=="string")return k;if(V&&V!==S)return V},[i,k,V,S]),K=E.useMemo(()=>wo(u,[typeof k=="string"?k:V&&V!==S?V:void 0,...w?.keywords??[]]),[u,k,V,S,w]),j=E.useRef(A),n=l.multiple?Mo(l.values,o,l.isItemEqualToValue):l.value!==""&&Vo(l.value,o,l.isItemEqualToValue),f=l.closeOnSelect,r=co({id:L,value:S,keywords:K,disabled:s,forceMount:c,closeOnClick:f,children:d});E.useEffect(()=>{let M=()=>{if(!s){if(l.multiple)if(o==null)l.onValuesChange([]);else{let me=n?Eo(l.values,o,l.isItemEqualToValue):[...l.values,o];l.onValuesChange(me)}else l.onValueChange(o);p?.()}};return r.registerSelect(M)},[s,l,o,n,p,r]),E.useEffect(()=>{let M=j.current;if(M)return l.registerItemText(S,M)},[S,l]),E.useEffect(()=>{!A&&typeof d=="string"&&(j.current=d,l.registerItemText(S,d))},[d,A,S,l]);let v=E.useMemo(()=>({highlighted:r.isHighlighted,disabled:s,selected:n,first:r.positional.first,last:r.positional.last,firstInGroup:r.positional.firstInGroup,lastInGroup:r.positional.lastInGroup}),[r.isHighlighted,s,n,r.positional]),y=E.useMemo(()=>({id:r.id,value:o,textValue:A,highlighted:r.isHighlighted,disabled:s,selected:n}),[r.id,o,A,r.isHighlighted,s,n]),O=E.useCallback(M=>{m?.(M),M.defaultPrevented||r.handlers.onClick(M)},[m,r.handlers]),W=E.useCallback(M=>{r.handlers.onPointerDown(M),b?.(M)},[r.handlers,b]),z=E.useCallback(M=>{I?.(M),M.defaultPrevented||r.handlers.onPointerMove(M)},[I,r.handlers]),ee=vt({render:a,ref:[r.ref,r.rowRef,e],state:v,stateAttributesMapping:Vt,props:{...g,[q.slot]:"",id:r.id,role:"option",tabIndex:-1,"aria-selected":n,"aria-disabled":s||void 0,className:t,style:P,onClick:O,onPointerMove:z,onPointerDown:W,children:d},enabled:r.isVisible,defaultTagName:"div"});return r.isVisible?Et(he.Provider,{value:y,children:ee}):null}var Te=E.forwardRef(Mt);import{useRender as Lt}from"@base-ui/react/use-render";import*as Ie from"react";var Pe={slot:"bazzaui-combobox-item-indicator",selected:"data-selected"};var wt={selected:x=>x?{[Pe.selected]:""}:null},He=Ie.forwardRef(function(e,o){let{keepMounted:i=!1,render:u,className:s,style:p,...c}=e,a=ue(),t=Ie.useMemo(()=>({selected:a.selected}),[a.selected]),P=Lt({render:u,ref:o,state:t,stateAttributesMapping:wt,props:{...c,[Pe.slot]:"","aria-hidden":!0,className:s,style:p},enabled:i||a.selected,defaultTagName:"span"});return!i&&!a.selected?null:P});import{useRender as kt}from"@base-ui/react/use-render";import*as Y from"react";var Do={slot:"bazzaui-combobox-item-label"};var Oe=Y.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,a=D(),t=ue(),P=F(t.value,a.itemToStringValue),m=Y.useMemo(()=>{if(p!==void 0)return p;let I=te(a.items,P);return I!==void 0?I:t.textValue!==void 0?t.textValue:P},[p,a.items,P,t.textValue]),b=Y.useMemo(()=>({value:P,selected:t.selected,highlighted:t.highlighted,disabled:t.disabled}),[P,t.selected,t.highlighted,t.disabled]);return Y.useEffect(()=>{if(typeof m=="string")return a.registerItemText(P,m)},[m,a,P]),kt({render:i,ref:o,state:b,props:{...c,[Do.slot]:"",className:u,style:s,children:m},defaultTagName:"span"})});import{Popover as Ao}from"@base-ui/react/popover";import*as U from"react";var Re={slot:"bazzaui-combobox-positioner"};import{jsx as ie}from"react/jsx-runtime";function Tt(x,e,o,i){let u=o+i*2;if(x==="top"){let c=-(e+i),a=e+i;return{width:u,marginBottom:c,paddingTop:i,paddingLeft:i,paddingRight:i,paddingBottom:a}}let s=-(e+i),p=e+i;return{width:u,marginTop:s,paddingTop:p,paddingLeft:i,paddingRight:i,paddingBottom:i}}var De=U.forwardRef(function(e,o){let{layout:i,popupPadding:u=8,side:s="bottom",align:p,sideOffset:c=4,anchor:a,className:t,style:P,children:m,...b}=e,I=D(),d=i??I.layout,g=d==="input-embedded",l=a??I.inputWrapperRef.current?I.inputWrapperRef:I.inputRef,S=g?0:c,R=g?"center":p??"start",{inputHeight:L,inputWidth:w}=I,k=w+u*2,V={...P,...g?{zIndex:0}:{}};if(g)return ie(Ao.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:V,"data-input-embedded":"",[Re.slot]:"",...b,render:(n,f)=>{let r=f.side,v={layout:d,side:r,align:f.align,inputHeight:I.inputHeight},y={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`,"--combobox-popup-padding":`${u}px`,"--combobox-popup-width":`${k}px`},O=Tt(r,L,w,u),W=U.Children.map(m,z=>U.isValidElement(z)?U.cloneElement(z,{style:{...O,...z.props.style},"data-side":r}):z);return ie(fe.Provider,{value:v,children:ie("div",{...n,style:{...n.style,...y},"data-side":r,children:W})})}});let A={layout:d,side:s,align:R,inputHeight:I.inputHeight},K={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`},j={...V,...K};return ie(fe.Provider,{value:A,children:ie(Ao.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:j,[Re.slot]:"",...b,children:m})})});import{Popover as Ht}from"@base-ui/react/popover";import*as h from"react";import{jsx as pe,jsxs as Ot}from"react/jsx-runtime";function Ae(x){let{open:e,onOpenChange:o,actionsRef:i,defaultOpen:u=!1,value:s,defaultValue:p,onValueChange:c,multiple:a=!1,values:t,defaultValues:P,onValuesChange:m,isItemEqualToValue:b=vo,itemToStringLabel:I,itemToStringValue:d,inputValue:g,defaultInputValue:l="",onInputValueChange:S,name:R,form:L,required:w,disabled:k=!1,placeholder:V="Search...",items:A,modal:K=!1,closeOnSelect:j,openOnFocus:n=!0,virtualized:f=!1,virtualItems:r,onHighlightChange:v,layout:y="floating",onOpenChangeComplete:O,debug:W,children:z,...ee}=x,M=h.useCallback((C,H,G,be)=>v?.(C,G,be),[v]),me=h.useId(),ce=h.useRef(null),Se=h.useRef(null),[ze,Be]=h.useState(0),[We,je]=h.useState(0),Ge=h.useCallback(C=>{if(ce.current=C,C&&!Se.current){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),Ne=h.useCallback(C=>{if(Se.current=C,C){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),{store:B,focusOwnerStore:$o,openChainStore:Jo,registerSurface:Xo,closeAll:_o,virtualization:Qo,handleOpenChange:qe,disabled:$,setDisabled:Ke,menuTreeResolver:Yo}=ao({onOpenChange:o,defaultOpen:u,virtualized:f,items:r,onHighlightChange:M,disabled:k}),ye=h.useRef(null);h.useImperativeHandle(i,()=>({close:()=>{ye.current?.close()},unmount:()=>{ye.current?.unmount()},setDisabled:Ke}),[Ke]),B.useControlledProp("openProp",e);let Zo=B.useState("open"),Ue=h.useCallback((C,H,G)=>{$&&H!==oe.imperativeAction||!C&&ce.current&&document.activeElement===ce.current||qe(C,H,G)},[qe,$]),et=h.useCallback(C=>{!C&&B.context.clearSearchOnClose==="after-exit"&&(B.clearSearch(),B.setInputActive(!1)),C||B.clearHighlight(),O?.(C)},[B,O]),ot=h.useCallback((C,H)=>{Ue(C,H.reason,H.event)},[Ue]),[tt,nt]=h.useState(p!==void 0?p:null),J=s!==void 0?s:tt,$e=h.useCallback(C=>{s===void 0&&nt(C),c?.(C)},[s,c]),[rt,at]=h.useState(P??[]),ae=t!==void 0?t:rt,Je=h.useCallback(C=>{t===void 0&&at(C),m?.(C)},[t,m]),[ve,st]=h.useState(l),Xe=g!==void 0?g:ve,_e=h.useCallback(C=>{g===void 0&&st(C),S?.(C)},[g,S]),Qe=h.useRef(new Map),Ye=h.useCallback((C,H)=>(Qe.current.set(C,H),()=>{}),[]),Ze=j??!a,Ve=h.useRef({type:"active"}),[,lt]=h.useState({type:"active"}),X=h.useCallback(C=>{Ve.current=C,lt(C)},[]),eo=Ve.current,oo=h.useCallback(()=>{X({type:"active"})},[X]),to=h.useCallback(()=>{$||(!a&&J!=null?X({type:"showAll"}):X({type:"active"}),B.setOpen(!0))},[$,B,a,J,X]),no=h.useCallback((C,H)=>{let G=Ve.current,be=G.type==="active"?ve:G.type==="showAll"?"":G.search;X({type:"frozen",search:be}),B.setOpen(!1,C,H)},[B,X,ve]),ut=h.useMemo(()=>({multiple:a,value:J,values:ae,onValueChange:$e,onValuesChange:Je,isItemEqualToValue:b,itemToStringLabel:I,itemToStringValue:d,inputValue:Xe,onInputValueChange:_e,name:R,form:L,required:w,disabled:$,placeholder:V,items:A,itemTextRegistry:Qe.current,registerItemText:Ye,listId:me,inputRef:ce,setInputElement:Ge,inputWrapperRef:Se,setInputWrapperElement:Ne,closeOnSelect:Ze,openOnFocus:n,openCombobox:to,closeCombobox:no,filterMode:eo,setFilterActive:oo,inputHeight:ze,inputWidth:We,layout:y}),[a,J,ae,$e,Je,b,I,d,Xe,_e,R,L,w,$,V,A,Ye,me,Ge,Ne,Ze,n,to,no,eo,oo,ze,We,y]),it=h.useMemo(()=>R?a?ae.length>0?ae.map((C,H)=>{let G=F(C,d);return pe("input",{type:"hidden",name:R,value:G,form:L,required:w&&H===0},G)}):pe("input",{type:"hidden",name:R,value:"",form:L,required:w}):pe("input",{type:"hidden",name:R,value:J!=null?F(J,d):"",form:L,required:w}):null,[R,L,w,a,J,ae,d]);return pe(uo.Provider,{value:ut,children:Ot(mo,{menuTreeResolver:Yo,store:B,focusOwnerStore:$o,openChainStore:Jo,disabled:$,depth:0,closeAll:_o,registerSurface:Xo,virtualization:Qo,menuType:"dropdown",componentName:"combobox",debug:W,children:[it,pe(Ht.Root,{...ee,open:Zo,onOpenChange:ot,onOpenChangeComplete:et,modal:K,actionsRef:i?ye:void 0,children:z})]})})}import*as Z from"react";var Fo={slot:"bazzaui-combobox-surface"};import{jsx as Dt}from"react/jsx-runtime";var Fe=Z.forwardRef(function(e,o){let{autoHighlightFirst:i,clearSearchOnClose:u=!0,search:s,onSearchChange:p,onPointerMove:c,...a}=e,t=D(),P=Z.useCallback(g=>{c?.(g);let l=t.inputRef.current;l&&document.activeElement!==l&&l.focus()},[c,t.inputRef]),m=Z.useMemo(()=>{let g=i??!0;if(g==="selected"){let l=t.multiple?t.values[0]:t.value;return l!=null?F(l,t.itemToStringValue):!0}return g},[i,t.multiple,t.value,t.values,t.itemToStringValue]),{filterMode:b}=t,I=s??(b.type==="active"?t.inputValue:b.type==="showAll"?"":b.search),d=Z.useCallback(g=>{t.onInputValueChange(g),p?.(g)},[t,p]);return Dt(Ro,{ref:o,autoHighlightFirst:m,clearSearchOnClose:u,search:I,onSearchChange:d,onPointerMove:P,skipAutoFocus:!0,[Fo.slot]:"",...a})});var Bo=(p=>(p.slot="bazzaui-combobox-arrow",p.open="data-open",p.closed="data-closed",p.side="data-side",p.align="data-align",p.uncentered="data-uncentered",p))(Bo||{});var Wo=(s=>(s.slot="bazzaui-combobox-backdrop",s.open="data-open",s.closed="data-closed",s.startingStyle="data-starting-style",s.endingStyle="data-ending-style",s))(Wo||{});var jo=(e=>(e.slot="bazzaui-combobox-empty",e))(jo||{});var Go=(e=>(e.slot="bazzaui-combobox-group",e))(Go||{});var No=(e=>(e.slot="bazzaui-combobox-group-label",e))(No||{});var At={slot:"bazzaui-combobox-icon",open:"data-popup-open"};var qo=(o=>(o.slot="bazzaui-combobox-list",o.list="data-popup-menu-list",o))(qo||{});var Ko=(b=>(b.slot="bazzaui-combobox-popup",b.open="data-open",b.closed="data-closed",b.side="data-side",b.align="data-align",b.startingStyle="data-starting-style",b.endingStyle="data-ending-style",b.instant="data-instant",b.focused="data-focused",b.hasOpenSubmenu="data-has-open-submenu",b.submenu="data-submenu",b.navigating="data-navigating",b))(Ko||{});var Ft={slotUp:"bazzaui-combobox-scroll-up-arrow",slotDown:"bazzaui-combobox-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Uo=(e=>(e.slot="bazzaui-combobox-separator",e))(Uo||{});export{zo as Combobox,Bo as ComboboxArrowDataAttributes,Wo as ComboboxBackdropDataAttributes,Me as ComboboxClear,jo as ComboboxEmptyDataAttributes,Go as ComboboxGroupDataAttributes,No as ComboboxGroupLabelDataAttributes,At as ComboboxIconDataAttributes,we as ComboboxInput,Q as ComboboxInputDataAttributes,ke as ComboboxInputWrapper,ge as ComboboxInputWrapperDataAttributes,Te as ComboboxItem,q as ComboboxItemDataAttributes,He as ComboboxItemIndicator,Pe as ComboboxItemIndicatorDataAttributes,Oe as ComboboxItemLabel,gt as ComboboxListCssVars,qo as ComboboxListDataAttributes,Ko as ComboboxPopupDataAttributes,De as ComboboxPositioner,Ct as ComboboxPositionerCssVars,Re as ComboboxPositionerDataAttributes,Ae as ComboboxRoot,Ft as ComboboxScrollArrowDataAttributes,Uo as ComboboxSeparatorDataAttributes,xt as ComboboxStore,Fe as ComboboxSurface,bt as commandScore,dt as defaultFilter,D as useComboboxContext,ue as useComboboxItemContext,Ee as useComboboxPositionerContext,ft as useMaybeComboboxContext,yt as useMaybeComboboxItemContext,ct as useMaybeSurfaceContext,mt as useSurfaceContext};
|
|
1
|
+
import{a as vo,b as Vo,c as Mo,d as Eo,e as Lo,f as te,g as wo}from"../chunk-KO3DXT3Y.js";import{J as io,K as po,L as Ct,N as mo,O as co,P as bo,Q as xo,R as N,S as F,T as fo,U as Co,W as go,a as ro,aa as gt,ba as ho,d as de,da as Po,ea as Io,fa as Ro,pa as So,q as ao,s as so,sa as yo,t as lo,v as uo,w as D,x as ft}from"../chunk-65TSJ7MA.js";import{a as oe,p as mt,q as ct,w as bt,x as dt,y as xt}from"../chunk-A4Z5BY7H.js";import{a as pt}from"../chunk-4C666HHU.js";var zo={};pt(zo,{Arrow:()=>so,Backdrop:()=>lo,Clear:()=>Me,Empty:()=>Co,Group:()=>So,GroupLabel:()=>go,Icon:()=>fo,Input:()=>we,InputWrapper:()=>ke,Item:()=>Te,ItemIndicator:()=>He,ItemLabel:()=>Oe,List:()=>ho,Popup:()=>io,Portal:()=>po,Positioner:()=>De,Root:()=>Ae,ScrollDownArrow:()=>Io,ScrollUpArrow:()=>Po,Separator:()=>yo,Surface:()=>Fe,useComboboxPositionerContext:()=>Ee});import{useRender as ht}from"@base-ui/react/use-render";import*as _ from"react";var ko={slot:"bazzaui-combobox-clear"};var Me=_.forwardRef(function(e,o){let{keepMounted:i=!1,disabled:u,render:s,className:p,style:c,onClick:a,onPointerDown:t,...P}=e,m=D(),b=u??m.disabled,I=m.multiple?m.values.length>0:m.value!=="",d=_.useCallback(R=>{a?.(R),!R.defaultPrevented&&(m.multiple?m.onValuesChange([]):m.onValueChange(""),m.onInputValueChange(""))},[a,m]),g=_.useCallback(R=>{R.preventDefault(),t?.(R)},[t]),l=_.useMemo(()=>({hasValue:I,disabled:b}),[I,b]),S=ht({render:s,ref:o,state:l,props:{...P,[ko.slot]:"",type:"button",tabIndex:-1,"aria-label":"Clear selection",disabled:b||!I,className:p,style:c,onClick:d,onPointerDown:g},enabled:i||I,defaultTagName:"button"});return!i&&!I?null:S});import*as xe from"react";var fe=xe.createContext(null);function Ee(){return xe.useContext(fe)}import{useRender as Pt}from"@base-ui/react/use-render";import*as ne from"react";import*as Ce from"react";var Le=Ce.createContext(!1);function To(){return Ce.useContext(Le)}var Q={slot:"bazzaui-combobox-input",open:"data-open",closed:"data-closed",disabled:"data-disabled",placeholder:"data-placeholder"};import*as se from"react";function Ho(x){let{comboboxContext:e,open:o}=x,i=e.multiple?e.values.length>0:!xo(e.value),u=se.useCallback(c=>{let a=F(c,e.itemToStringValue),t=e.itemTextRegistry.get(a);if(t!==void 0)return t;let P=te(e.items,a);if(typeof P=="string")return P;let m=N(c,e.itemToStringLabel);if(m&&m!==a)return m},[e.itemTextRegistry,e.items,e.itemToStringLabel,e.itemToStringValue]),s=se.useMemo(()=>{if(!i)return"";if(e.multiple){let t=e.values.map(P=>{let m=u(P);return m!==void 0?m:N(P,e.itemToStringLabel)||F(P,e.itemToStringValue)}).filter(Boolean);return t.length<=2?t.join(", "):`${t.length} selected`}let c=e.value;if(c==null)return"";let a=u(c);return a!==void 0?a:N(c,e.itemToStringLabel)||F(c,e.itemToStringValue)},[i,e.multiple,e.value,e.values,e.itemToStringLabel,e.itemToStringValue,u]),p=se.useMemo(()=>o?e.inputValue:s,[o,s,e.inputValue]);return{hasValue:i,displayValue:p,selectedLabel:s,getValueText:u}}import*as T from"react";function Oo(x){let{comboboxContext:e,store:o,focusOwnerStore:i,open:u,disabled:s,cursorBehavior:p,hasValue:c,getValueText:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}=x,I=T.useRef(!1),d=T.useRef(!1),g=T.useRef(!1),l=T.useRef(null),S=T.useRef(null),R=T.useRef(null);T.useEffect(()=>{if(!u)return;let n=f=>{let r=e.inputRef.current,v=e.inputWrapperRef.current,y=document.getElementById(e.listId),O=f.target,W=r?.contains(O),z=v?.contains(O),ee=y?.contains(O);!W&&!z&&!ee&&(R.current=f)};return document.addEventListener("pointerdown",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),R.current=null}},[u,e.inputRef,e.inputWrapperRef,e.listId]),T.useLayoutEffect(()=>{let n=e.inputRef.current;if(n&&u&&S.current){let{start:f,end:r}=S.current,v=n.selectionStart,y=n.value.length;v===y&&f!==y&&n.setSelectionRange(f,r),S.current=null}});let L=T.useRef(u);T.useLayoutEffect(()=>{if(u&&!L.current){if(I.current){I.current=!1,L.current=u;return}if(g.current){g.current=!1,d.current=!1,l.current=null,L.current=u;return}if(d.current&&p==="none"){let f=e.inputRef.current,r=l.current;f&&r!==null&&requestAnimationFrame(()=>{let v=f.value.length,y=Math.min(r,v);f.setSelectionRange(y,y)}),d.current=!1,l.current=null,L.current=u;return}c&&e.multiple&&e.onInputValueChange("");let n=e.inputRef.current;if(n){let f=n.value.length;p==="select-all"&&f>0?requestAnimationFrame(()=>{n.setSelectionRange(0,n.value.length)}):p==="end"&&f>0&&requestAnimationFrame(()=>{n.setSelectionRange(n.value.length,n.value.length)})}}L.current=u},[u,e,c,p]);let w=T.useCallback(n=>{let f=n.target,r=f.value,v=f.selectionStart,y=f.selectionEnd;v!==null&&y!==null&&(S.current={start:v,end:y}),e.onInputValueChange(r),e.setFilterActive(),o.setSearch(r),o.state.open||(I.current=!0,e.openCombobox())},[e,o]),k=T.useCallback(n=>{if(t?.(n),n.defaultPrevented)return;let f=o.state.open;if(f&&(g.current=!0),e.openOnFocus&&!s&&!f){if(c&&!e.multiple){let r=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(r)}e.openCombobox()}},[t,e,s,o,c,a]),V=T.useCallback(n=>{P?.(n),!n.defaultPrevented&&requestAnimationFrame(()=>{let f=document.activeElement,v=document.getElementById(e.listId)?.contains(f),y=f===e.inputRef.current;if(!v&&!y){g.current=!1;let O=R.current,W=O?oe.outsidePress:oe.focusOut;R.current=null,e.closeCombobox(W,O??void 0)}})},[P,e]),A=T.useCallback(n=>{if(m?.(n),n.defaultPrevented)return;let f=o.state.open;if(!s&&!f){let r=n.target;if(p==="none"){let v=r.selectionStart;l.current=v,d.current=!0}if(c&&!e.multiple){let v=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(v)}e.openCombobox()}else f&&(g.current=!0)},[m,e,s,o,p,c,a]),K=T.useCallback(n=>{if(b?.(n),!n.defaultPrevented){if(u&&n.key==="Escape"){n.preventDefault(),e.closeCombobox(oe.escapeKey);return}if(!u&&(n.key==="ArrowDown"||n.key==="ArrowUp"||n.key==="Enter")){if(n.preventDefault(),c&&!e.multiple){let f=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(f)}e.openCombobox();return}}},[u,e,b,c,a]),{handleKeyDown:j}=bo({store:o,surfaceId:"combobox-input",focusOwnerStore:i,depth:0,submenuContext:null,subpageContext:null,enabled:u,enableTypeToSearch:!1,onKeyDown:K,closeAll:e.closeCombobox,skipFocusOwnerCheck:!0});return{handleChange:w,handleFocus:k,handleBlur:V,handleClick:A,handleKeyDown:j,selectionRef:S}}var we=ne.forwardRef(function(e,o){let{placeholder:i,disabled:u,cursorBehavior:s="none",render:p,className:c,style:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b,...I}=e,d=D(),g=de(),l=ro(),S=To(),R=(u??d.disabled)||g.disabled,L=te(d.items,""),w=i??(typeof L=="string"?L:void 0)??d.placeholder,k=g.store.useState("open"),{hasValue:V,displayValue:A,getValueText:K}=Ho({comboboxContext:d,open:k}),{handleChange:j,handleFocus:n,handleBlur:f,handleClick:r,handleKeyDown:v}=Oo({comboboxContext:d,store:g.store,focusOwnerStore:l,open:k,disabled:R,cursorBehavior:s,hasValue:V,getValueText:K,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}),y={[Q.slot]:""};k?y[Q.open]="":y[Q.closed]="",R&&(y[Q.disabled]=""),V||(y[Q.placeholder]=""),d.layout==="input-embedded"&&(y["data-input-embedded"]="");let O=ne.useCallback(M=>{d.setInputElement(M),typeof o=="function"?o(M):o&&(o.current=M)},[o,d]),W=ne.useMemo(()=>({open:k,disabled:R,placeholder:!V}),[k,R,V]),z=d.layout==="input-embedded"&&!S?{position:"relative",zIndex:1}:void 0;return Pt({render:p,ref:O,state:W,props:{...I,...y,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":k,"aria-controls":d.listId,"aria-haspopup":"listbox",autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:R,placeholder:V?void 0:w,className:c,style:{...z,...a},value:A,onChange:j,onFocus:n,onBlur:f,onClick:r,onKeyDown:v},defaultTagName:"input"})});import{useRender as It}from"@base-ui/react/use-render";import*as re from"react";var ge={slot:"bazzaui-combobox-input-wrapper",open:"data-open"};import{jsx as St}from"react/jsx-runtime";var Rt={open:x=>x?{[ge.open]:""}:null},ke=re.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,{store:a}=de(),t=D(),P=a.useState("open"),m=re.useMemo(()=>({open:P}),[P]),b=t.layout==="input-embedded"?{position:"relative",zIndex:1}:{position:"relative"},I=re.useCallback(g=>{t.setInputWrapperElement(g),typeof o=="function"?o(g):o&&(o.current=g)},[o,t]),d=It({render:i,ref:I,state:m,stateAttributesMapping:Rt,props:{...c,[ge.slot]:"",className:u,style:{...b,...s},children:p},defaultTagName:"div"});return St(Le.Provider,{value:!0,children:d})});import{useRender as vt}from"@base-ui/react/use-render";import*as E from"react";var q={slot:"bazzaui-combobox-item",highlighted:"data-highlighted",disabled:"data-disabled",selected:"data-selected",first:"data-first",last:"data-last",firstInGroup:"data-first-in-group",lastInGroup:"data-last-in-group"};import*as le from"react";var he=le.createContext(null);function ue(){let x=le.useContext(he);if(!x)throw new Error("ComboboxItem child components must be used within a Combobox.Item");return x}function yt(){return le.useContext(he)}import{jsx as Et}from"react/jsx-runtime";var Vt={highlighted:x=>x?{[q.highlighted]:""}:null,disabled:x=>x?{[q.disabled]:""}:null,selected:x=>x?{[q.selected]:""}:null,first:x=>x?{[q.first]:""}:null,last:x=>x?{[q.last]:""}:null,firstInGroup:x=>x?{[q.firstInGroup]:""}:null,lastInGroup:x=>x?{[q.lastInGroup]:""}:null};function Mt(x,e){let{value:o,textValue:i,keywords:u,disabled:s=!1,onSelect:p,forceMount:c=!1,render:a,className:t,style:P,onClick:m,onPointerDown:b,onPointerMove:I,children:d,...g}=x,l=D(),S=E.useMemo(()=>F(o,l.itemToStringValue),[o,l.itemToStringValue]),R=E.useId(),L=o===null?`combobox-clear-${R}`:void 0,w=E.useMemo(()=>Lo(l.items,S),[l.items,S]),k=w?.label,V=E.useMemo(()=>N(o,l.itemToStringLabel),[o,l.itemToStringLabel]),A=E.useMemo(()=>{if(i!==void 0)return i;if(typeof k=="string")return k;if(V&&V!==S)return V},[i,k,V,S]),K=E.useMemo(()=>wo(u,[typeof k=="string"?k:V&&V!==S?V:void 0,...w?.keywords??[]]),[u,k,V,S,w]),j=E.useRef(A),n=l.multiple?Mo(l.values,o,l.isItemEqualToValue):l.value!==""&&Vo(l.value,o,l.isItemEqualToValue),f=l.closeOnSelect,r=co({id:L,value:S,keywords:K,disabled:s,forceMount:c,closeOnClick:f,children:d});E.useEffect(()=>{let M=()=>{if(!s){if(l.multiple)if(o==null)l.onValuesChange([]);else{let me=n?Eo(l.values,o,l.isItemEqualToValue):[...l.values,o];l.onValuesChange(me)}else l.onValueChange(o);p?.()}};return r.registerSelect(M)},[s,l,o,n,p,r]),E.useEffect(()=>{let M=j.current;if(M)return l.registerItemText(S,M)},[S,l]),E.useEffect(()=>{!A&&typeof d=="string"&&(j.current=d,l.registerItemText(S,d))},[d,A,S,l]);let v=E.useMemo(()=>({highlighted:r.isHighlighted,disabled:s,selected:n,first:r.positional.first,last:r.positional.last,firstInGroup:r.positional.firstInGroup,lastInGroup:r.positional.lastInGroup}),[r.isHighlighted,s,n,r.positional]),y=E.useMemo(()=>({id:r.id,value:o,textValue:A,highlighted:r.isHighlighted,disabled:s,selected:n}),[r.id,o,A,r.isHighlighted,s,n]),O=E.useCallback(M=>{m?.(M),M.defaultPrevented||r.handlers.onClick(M)},[m,r.handlers]),W=E.useCallback(M=>{r.handlers.onPointerDown(M),b?.(M)},[r.handlers,b]),z=E.useCallback(M=>{I?.(M),M.defaultPrevented||r.handlers.onPointerMove(M)},[I,r.handlers]),ee=vt({render:a,ref:[r.ref,r.rowRef,e],state:v,stateAttributesMapping:Vt,props:{...g,[q.slot]:"",id:r.id,role:"option",tabIndex:-1,"aria-selected":n,"aria-disabled":s||void 0,className:t,style:P,onClick:O,onPointerMove:z,onPointerDown:W,children:d},enabled:r.isVisible,defaultTagName:"div"});return r.isVisible?Et(he.Provider,{value:y,children:ee}):null}var Te=E.forwardRef(Mt);import{useRender as Lt}from"@base-ui/react/use-render";import*as Ie from"react";var Pe={slot:"bazzaui-combobox-item-indicator",selected:"data-selected"};var wt={selected:x=>x?{[Pe.selected]:""}:null},He=Ie.forwardRef(function(e,o){let{keepMounted:i=!1,render:u,className:s,style:p,...c}=e,a=ue(),t=Ie.useMemo(()=>({selected:a.selected}),[a.selected]),P=Lt({render:u,ref:o,state:t,stateAttributesMapping:wt,props:{...c,[Pe.slot]:"","aria-hidden":!0,className:s,style:p},enabled:i||a.selected,defaultTagName:"span"});return!i&&!a.selected?null:P});import{useRender as kt}from"@base-ui/react/use-render";import*as Y from"react";var Do={slot:"bazzaui-combobox-item-label"};var Oe=Y.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,a=D(),t=ue(),P=F(t.value,a.itemToStringValue),m=Y.useMemo(()=>{if(p!==void 0)return p;let I=te(a.items,P);return I!==void 0?I:t.textValue!==void 0?t.textValue:P},[p,a.items,P,t.textValue]),b=Y.useMemo(()=>({value:P,selected:t.selected,highlighted:t.highlighted,disabled:t.disabled}),[P,t.selected,t.highlighted,t.disabled]);return Y.useEffect(()=>{if(typeof m=="string")return a.registerItemText(P,m)},[m,a,P]),kt({render:i,ref:o,state:b,props:{...c,[Do.slot]:"",className:u,style:s,children:m},defaultTagName:"span"})});import{Popover as Ao}from"@base-ui/react/popover";import*as U from"react";var Re={slot:"bazzaui-combobox-positioner"};import{jsx as ie}from"react/jsx-runtime";function Tt(x,e,o,i){let u=o+i*2;if(x==="top"){let c=-(e+i),a=e+i;return{width:u,marginBottom:c,paddingTop:i,paddingLeft:i,paddingRight:i,paddingBottom:a}}let s=-(e+i),p=e+i;return{width:u,marginTop:s,paddingTop:p,paddingLeft:i,paddingRight:i,paddingBottom:i}}var De=U.forwardRef(function(e,o){let{layout:i,popupPadding:u=8,side:s="bottom",align:p,sideOffset:c=4,anchor:a,className:t,style:P,children:m,...b}=e,I=D(),d=i??I.layout,g=d==="input-embedded",l=a??I.inputWrapperRef.current?I.inputWrapperRef:I.inputRef,S=g?0:c,R=g?"center":p??"start",{inputHeight:L,inputWidth:w}=I,k=w+u*2,V={...P,...g?{zIndex:0}:{}};if(g)return ie(Ao.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:V,"data-input-embedded":"",[Re.slot]:"",...b,render:(n,f)=>{let r=f.side,v={layout:d,side:r,align:f.align,inputHeight:I.inputHeight},y={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`,"--combobox-popup-padding":`${u}px`,"--combobox-popup-width":`${k}px`},O=Tt(r,L,w,u),W=U.Children.map(m,z=>U.isValidElement(z)?U.cloneElement(z,{style:{...O,...z.props.style},"data-side":r}):z);return ie(fe.Provider,{value:v,children:ie("div",{...n,style:{...n.style,...y},"data-side":r,children:W})})}});let A={layout:d,side:s,align:R,inputHeight:I.inputHeight},K={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`},j={...V,...K};return ie(fe.Provider,{value:A,children:ie(Ao.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:j,[Re.slot]:"",...b,children:m})})});import{Popover as Ht}from"@base-ui/react/popover";import*as h from"react";import{jsx as pe,jsxs as Ot}from"react/jsx-runtime";function Ae(x){let{open:e,onOpenChange:o,actionsRef:i,defaultOpen:u=!1,value:s,defaultValue:p,onValueChange:c,multiple:a=!1,values:t,defaultValues:P,onValuesChange:m,isItemEqualToValue:b=vo,itemToStringLabel:I,itemToStringValue:d,inputValue:g,defaultInputValue:l="",onInputValueChange:S,name:R,form:L,required:w,disabled:k=!1,placeholder:V="Search...",items:A,modal:K=!1,closeOnSelect:j,openOnFocus:n=!0,virtualized:f=!1,virtualItems:r,onHighlightChange:v,layout:y="floating",onOpenChangeComplete:O,debug:W,children:z,...ee}=x,M=h.useCallback((C,H,G,be)=>v?.(C,G,be),[v]),me=h.useId(),ce=h.useRef(null),Se=h.useRef(null),[ze,Be]=h.useState(0),[We,je]=h.useState(0),Ge=h.useCallback(C=>{if(ce.current=C,C&&!Se.current){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),Ne=h.useCallback(C=>{if(Se.current=C,C){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),{store:B,focusOwnerStore:$o,openChainStore:Jo,registerSurface:Xo,closeAll:_o,virtualization:Qo,handleOpenChange:qe,disabled:$,setDisabled:Ke,menuTreeResolver:Yo}=ao({onOpenChange:o,defaultOpen:u,virtualized:f,items:r,onHighlightChange:M,disabled:k}),ye=h.useRef(null);h.useImperativeHandle(i,()=>({close:()=>{ye.current?.close()},unmount:()=>{ye.current?.unmount()},setDisabled:Ke}),[Ke]),B.useControlledProp("openProp",e);let Zo=B.useState("open"),Ue=h.useCallback((C,H,G)=>{$&&H!==oe.imperativeAction||!C&&ce.current&&document.activeElement===ce.current||qe(C,H,G)},[qe,$]),et=h.useCallback(C=>{!C&&B.context.clearSearchOnClose==="after-exit"&&(B.clearSearch(),B.setInputActive(!1)),C||B.clearHighlight(),O?.(C)},[B,O]),ot=h.useCallback((C,H)=>{Ue(C,H.reason,H.event)},[Ue]),[tt,nt]=h.useState(p!==void 0?p:null),J=s!==void 0?s:tt,$e=h.useCallback(C=>{s===void 0&&nt(C),c?.(C)},[s,c]),[rt,at]=h.useState(P??[]),ae=t!==void 0?t:rt,Je=h.useCallback(C=>{t===void 0&&at(C),m?.(C)},[t,m]),[ve,st]=h.useState(l),Xe=g!==void 0?g:ve,_e=h.useCallback(C=>{g===void 0&&st(C),S?.(C)},[g,S]),Qe=h.useRef(new Map),Ye=h.useCallback((C,H)=>(Qe.current.set(C,H),()=>{}),[]),Ze=j??!a,Ve=h.useRef({type:"active"}),[,lt]=h.useState({type:"active"}),X=h.useCallback(C=>{Ve.current=C,lt(C)},[]),eo=Ve.current,oo=h.useCallback(()=>{X({type:"active"})},[X]),to=h.useCallback(()=>{$||(!a&&J!=null?X({type:"showAll"}):X({type:"active"}),B.setOpen(!0))},[$,B,a,J,X]),no=h.useCallback((C,H)=>{let G=Ve.current,be=G.type==="active"?ve:G.type==="showAll"?"":G.search;X({type:"frozen",search:be}),B.setOpen(!1,C,H)},[B,X,ve]),ut=h.useMemo(()=>({multiple:a,value:J,values:ae,onValueChange:$e,onValuesChange:Je,isItemEqualToValue:b,itemToStringLabel:I,itemToStringValue:d,inputValue:Xe,onInputValueChange:_e,name:R,form:L,required:w,disabled:$,placeholder:V,items:A,itemTextRegistry:Qe.current,registerItemText:Ye,listId:me,inputRef:ce,setInputElement:Ge,inputWrapperRef:Se,setInputWrapperElement:Ne,closeOnSelect:Ze,openOnFocus:n,openCombobox:to,closeCombobox:no,filterMode:eo,setFilterActive:oo,inputHeight:ze,inputWidth:We,layout:y}),[a,J,ae,$e,Je,b,I,d,Xe,_e,R,L,w,$,V,A,Ye,me,Ge,Ne,Ze,n,to,no,eo,oo,ze,We,y]),it=h.useMemo(()=>R?a?ae.length>0?ae.map((C,H)=>{let G=F(C,d);return pe("input",{type:"hidden",name:R,value:G,form:L,required:w&&H===0},G)}):pe("input",{type:"hidden",name:R,value:"",form:L,required:w}):pe("input",{type:"hidden",name:R,value:J!=null?F(J,d):"",form:L,required:w}):null,[R,L,w,a,J,ae,d]);return pe(uo.Provider,{value:ut,children:Ot(mo,{menuTreeResolver:Yo,store:B,focusOwnerStore:$o,openChainStore:Jo,disabled:$,depth:0,closeAll:_o,registerSurface:Xo,virtualization:Qo,menuType:"dropdown",componentName:"combobox",debug:W,children:[it,pe(Ht.Root,{...ee,open:Zo,onOpenChange:ot,onOpenChangeComplete:et,modal:K,actionsRef:i?ye:void 0,children:z})]})})}import*as Z from"react";var Fo={slot:"bazzaui-combobox-surface"};import{jsx as Dt}from"react/jsx-runtime";var Fe=Z.forwardRef(function(e,o){let{autoHighlightFirst:i,clearSearchOnClose:u=!0,search:s,onSearchChange:p,onPointerMove:c,...a}=e,t=D(),P=Z.useCallback(g=>{c?.(g);let l=t.inputRef.current;l&&document.activeElement!==l&&l.focus()},[c,t.inputRef]),m=Z.useMemo(()=>{let g=i??!0;if(g==="selected"){let l=t.multiple?t.values[0]:t.value;return l!=null?F(l,t.itemToStringValue):!0}return g},[i,t.multiple,t.value,t.values,t.itemToStringValue]),{filterMode:b}=t,I=s??(b.type==="active"?t.inputValue:b.type==="showAll"?"":b.search),d=Z.useCallback(g=>{t.onInputValueChange(g),p?.(g)},[t,p]);return Dt(Ro,{ref:o,autoHighlightFirst:m,clearSearchOnClose:u,search:I,onSearchChange:d,onPointerMove:P,skipAutoFocus:!0,[Fo.slot]:"",...a})});var Bo=(p=>(p.slot="bazzaui-combobox-arrow",p.open="data-open",p.closed="data-closed",p.side="data-side",p.align="data-align",p.uncentered="data-uncentered",p))(Bo||{});var Wo=(s=>(s.slot="bazzaui-combobox-backdrop",s.open="data-open",s.closed="data-closed",s.startingStyle="data-starting-style",s.endingStyle="data-ending-style",s))(Wo||{});var jo=(e=>(e.slot="bazzaui-combobox-empty",e))(jo||{});var Go=(e=>(e.slot="bazzaui-combobox-group",e))(Go||{});var No=(e=>(e.slot="bazzaui-combobox-group-label",e))(No||{});var At={slot:"bazzaui-combobox-icon",open:"data-popup-open"};var qo=(o=>(o.slot="bazzaui-combobox-list",o.list="data-popup-menu-list",o))(qo||{});var Ko=(b=>(b.slot="bazzaui-combobox-popup",b.open="data-open",b.closed="data-closed",b.side="data-side",b.align="data-align",b.startingStyle="data-starting-style",b.endingStyle="data-ending-style",b.instant="data-instant",b.focused="data-focused",b.hasOpenSubmenu="data-has-open-submenu",b.submenu="data-submenu",b.navigating="data-navigating",b))(Ko||{});var Ft={slotUp:"bazzaui-combobox-scroll-up-arrow",slotDown:"bazzaui-combobox-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Uo=(e=>(e.slot="bazzaui-combobox-separator",e))(Uo||{});export{zo as Combobox,Bo as ComboboxArrowDataAttributes,Wo as ComboboxBackdropDataAttributes,Me as ComboboxClear,jo as ComboboxEmptyDataAttributes,Go as ComboboxGroupDataAttributes,No as ComboboxGroupLabelDataAttributes,At as ComboboxIconDataAttributes,we as ComboboxInput,Q as ComboboxInputDataAttributes,ke as ComboboxInputWrapper,ge as ComboboxInputWrapperDataAttributes,Te as ComboboxItem,q as ComboboxItemDataAttributes,He as ComboboxItemIndicator,Pe as ComboboxItemIndicatorDataAttributes,Oe as ComboboxItemLabel,gt as ComboboxListCssVars,qo as ComboboxListDataAttributes,Ko as ComboboxPopupDataAttributes,De as ComboboxPositioner,Ct as ComboboxPositionerCssVars,Re as ComboboxPositionerDataAttributes,Ae as ComboboxRoot,Ft as ComboboxScrollArrowDataAttributes,Uo as ComboboxSeparatorDataAttributes,xt as ComboboxStore,Fe as ComboboxSurface,bt as commandScore,dt as defaultFilter,D as useComboboxContext,ue as useComboboxItemContext,Ee as useComboboxPositionerContext,ft as useMaybeComboboxContext,yt as useMaybeComboboxItemContext,ct as useMaybeSurfaceContext,mt as useSurfaceContext};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkJFEVUUPCcjs = require('../chunk-JFEVUUPC.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkJFEVUUPCcjs = require('../chunk-JFEVUUPC.cjs');var _chunkEYMK7XHCcjs = require('../chunk-EYMK7XHC.cjs');var _chunkXMZZ62VJcjs = require('../chunk-XMZZ62VJ.cjs');var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var fe={};_chunkM4G6J7DPcjs.a.call(void 0, fe,{Backdrop:()=>ue,CheckboxItem:()=>_chunkEYMK7XHCcjs.ga,CheckboxItemIndicator:()=>_chunkEYMK7XHCcjs.ha,Empty:()=>_chunkEYMK7XHCcjs.U,FocusZone:()=>_chunkEYMK7XHCcjs.na,Footer:()=>_chunkEYMK7XHCcjs.oa,Group:()=>_chunkEYMK7XHCcjs.pa,GroupLabel:()=>_chunkEYMK7XHCcjs.W,Header:()=>_chunkEYMK7XHCcjs.ra,Icon:()=>_chunkEYMK7XHCcjs.T,Input:()=>me,Item:()=>_chunkEYMK7XHCcjs.ia,List:()=>_chunkEYMK7XHCcjs.ba,Loading:()=>_chunkEYMK7XHCcjs.ca,Popup:()=>de,Portal:()=>ie,Root:()=>Pe,Separator:()=>_chunkEYMK7XHCcjs.sa,Shortcut:()=>_chunkEYMK7XHCcjs.ta,Subpage:()=>Me,SubpageBack:()=>_chunkEYMK7XHCcjs.Ba,SubpageBackItem:()=>_chunkEYMK7XHCcjs.Ca,SubpageTrigger:()=>_chunkEYMK7XHCcjs.Da,Surface:()=>_chunkEYMK7XHCcjs.fa,Trigger:()=>Se});var _dialog = require('@base-ui/react/dialog');var _react = require('react'); var y = _interopRequireWildcard(_react); var se = _interopRequireWildcard(_react); var s = _interopRequireWildcard(_react); var L = _interopRequireWildcard(_react); var d = _interopRequireWildcard(_react); var Ce = _interopRequireWildcard(_react);var _jsxruntime = require('react/jsx-runtime');var ue=y.forwardRef(function(o,a){let{onPointerDown:p,...r}=o,t=_chunkEYMK7XHCcjs.e.call(void 0, ),u=y.useCallback(m=>{_optionalChain([p, 'optionalCall', _2 => _2(m)]),!m.defaultPrevented&&t&&!t.disabled&&t.closeAll(_chunkXMZZ62VJcjs.a.outsidePress,m.nativeEvent)},[p,t]);return _jsxruntime.jsx.call(void 0, _dialog.Dialog.Backdrop,{ref:a,...r,onPointerDown:u,"data-command-menu-backdrop":""})});var me=se.forwardRef(function(o,a){let{backspaceGoesBack:p=!0,...r}=o;return _jsxruntime.jsx.call(void 0, _chunkEYMK7XHCcjs.V,{ref:a,backspaceGoesBack:p,...r})});var de=s.forwardRef(function(o,a){let{children:p,className:r,render:t,...u}=o,m=s.useId(),M=_chunkEYMK7XHCcjs.d.call(void 0, ),{subpageStackContextValue:C,isSubpageNavigating:S,hasOpenSubpage:n,subpageId:i}=_chunkEYMK7XHCcjs.r.call(void 0, {surfaceId:m,store:M.store}),[g,h]=s.useState(null),[b,f]=s.useState(null),c=s.useCallback(l=>({...l,hasOpenSubpage:n,subpageId:i}),[n,i]),k=s.useMemo(()=>typeof r=="function"?l=>r(c(l)):r,[r,c]),D=s.useMemo(()=>typeof t=="function"?(l,P)=>t(l,c(P)):t,[t,c]),v=s.useMemo(()=>({dataSurfaceContext:g,setDataSurfaceContext:h,resolvedNodes:b,setResolvedNodes:f}),[g,b]);return _jsxruntime.jsx.call(void 0, _chunkEYMK7XHCcjs.f.Provider,{value:m,children:_jsxruntime.jsx.call(void 0, _chunkEYMK7XHCcjs.k.Provider,{value:C,children:_jsxruntime.jsx.call(void 0, _chunkEYMK7XHCcjs.z.Provider,{value:v,children:_jsxruntime.jsxs.call(void 0, _dialog.Dialog.Popup,{ref:a,className:k,render:D,"data-command-menu-popup":"","data-navigating":S?"":void 0,"data-has-open-subpage":n?"":void 0,...u,children:[p,_jsxruntime.jsx.call(void 0, _chunkEYMK7XHCcjs.I,{})]})})})})});var ie=_dialog.Dialog.Portal;function Ue(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable}function Qe(e){let o=e.key.toLowerCase();return o===" "?"space":o}function qe(e,o){let a=_chunkJFEVUUPCcjs.d.call(void 0, ),p=o.meta||a&&o.mod,r=o.ctrl||!a&&o.mod;return e.metaKey===p&&e.ctrlKey===r&&e.altKey===o.alt&&e.shiftKey===o.shift}function We(e,o){return o.key===Qe(e)&&qe(e,o)}function ce(e,o,a){let p=d.useMemo(()=>_chunkJFEVUUPCcjs.a.call(void 0, e),[e]),[r]=p.chords,t=p.chords.length===1&&r!==void 0?r:null,u=p.chords.length>1,m=_optionalChain([a, 'optionalAccess', _3 => _3.enabled])!==!1,M=d.useRef(o),C=d.useRef(a);M.current=o,C.current=a,d.useEffect(()=>{u&&process.env.NODE_ENV!=="production"&&console.warn(`useHotkey only supports single-chord keybindings. Received "${e}", but sequences are not supported by useHotkey.`)},[u,e]),d.useEffect(()=>{if(!m||t===null||u||t.key===null)return;let S=n=>{let i=C.current;n.repeat||!_optionalChain([i, 'optionalAccess', _4 => _4.allowInInput])&&Ue(n.target)||We(n,t)&&(_optionalChain([i, 'optionalAccess', _5 => _5.preventDefault])!==!1&&n.preventDefault(),M.current(n))};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[t,m,u])}function Pe(e){let{children:o,open:a,defaultOpen:p=!1,onOpenChange:r,onOpenChangeComplete:t,hotkey:u,modal:m=!0,disabled:M,getResolvedId:C,idScope:S="surface"}=e,{store:n,focusOwnerStore:i,openChainStore:g,registerSurface:h,closeAll:b,handleOpenChange:f,disabled:c,menuTreeResolver:k}=_chunkEYMK7XHCcjs.q.call(void 0, {onOpenChange:r,defaultOpen:p,disabled:M,closeOnOutsidePress:"pointerdown",getResolvedId:C,idScope:S});n.useControlledProp("openProp",a);let D=n.useState("open");ce(_nullishCoalesce(u, () => ("")),()=>f(!n.state.open,_chunkXMZZ62VJcjs.a.imperativeAction),{enabled:!!u&&!c,allowInInput:!0});let v=L.useCallback((P,N)=>{f(P,N.reason,N.event)},[f]),l=L.useCallback(P=>{!P&&n.context.clearSearchOnClose==="after-exit"&&(n.clearSearch(),n.setInputActive(!1)),P||(n.clearHighlight(),_optionalChain([n, 'access', _6 => _6.context, 'access', _7 => _7.onCloseComplete, 'optionalCall', _8 => _8()]),_optionalChain([n, 'access', _9 => _9.context, 'access', _10 => _10.onPopupCloseComplete, 'optionalCall', _11 => _11()])),_optionalChain([t, 'optionalCall', _12 => _12(P)])},[n,t]);return _jsxruntime.jsx.call(void 0, _chunkEYMK7XHCcjs.N,{menuTreeResolver:k,store:n,focusOwnerStore:i,openChainStore:g,disabled:c,depth:0,closeAll:b,explicitTabBehavior:!0,tabWithoutZones:"inert",registerSurface:h,menuType:"dropdown",closeOnOutsidePress:"pointerdown",componentName:"command-menu",children:_jsxruntime.jsx.call(void 0, _dialog.Dialog.Root,{open:D,onOpenChange:v,onOpenChangeComplete:l,modal:m,children:o})})}function Me(e){let{closeRootOnEsc:o=!0,children:a,...p}=e;return _jsxruntime.jsx.call(void 0, _chunkEYMK7XHCcjs.Aa,{closeRootOnEsc:o,...p,children:a})}var Se=Ce.forwardRef(function(o,a){let{disabled:p,...r}=o,t=_chunkEYMK7XHCcjs.e.call(void 0, ),u=p||_optionalChain([t, 'optionalAccess', _13 => _13.disabled])||!1;return _jsxruntime.jsx.call(void 0, _dialog.Dialog.Trigger,{ref:a,...r,disabled:u,"data-command-menu-trigger":""})});exports.CommandMenu = fe; exports.CommandMenuRadioGroupValue = _chunkEYMK7XHCcjs.ka; exports.DataListContext = _chunkEYMK7XHCcjs.C; exports.DataSurfaceContext = _chunkEYMK7XHCcjs.y; exports.defaultGetResolvedId = _chunkEYMK7XHCcjs.p; exports.defineRadioGroup = _chunkEYMK7XHCcjs.X; exports.isDisplayGroupNode = _chunkEYMK7XHCcjs.Y; exports.isDisplayRadioGroupNode = _chunkEYMK7XHCcjs.Z; exports.isDisplayRowNode = _chunkEYMK7XHCcjs.$; exports.isDisplaySeparatorNode = _chunkEYMK7XHCcjs._; exports.isPopupMenuNode = _chunkEYMK7XHCcjs.o; exports.useAsyncMenuCoordinator = _chunkEYMK7XHCcjs.F; exports.useDataList = _chunkEYMK7XHCcjs.D; exports.useDataSurfaceContext = _chunkEYMK7XHCcjs.A; exports.useMaybeAsyncMenuCoordinator = _chunkEYMK7XHCcjs.G; exports.useMaybeDataList = _chunkEYMK7XHCcjs.E; exports.useMaybeDataSurfaceContext = _chunkEYMK7XHCcjs.B; exports.useMaybeSurfaceContext = _chunkXMZZ62VJcjs.q; exports.useSurfaceContext = _chunkXMZZ62VJcjs.p;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/command-menu/index.cjs","../../src/command-menu/index.parts.ts","../../src/command-menu/backdrop/backdrop.tsx","../../src/command-menu/input/input.tsx","../../src/command-menu/popup/popup.tsx","../../src/command-menu/portal/portal.tsx","../../src/command-menu/root/root.tsx","../../src/kbd/hooks/use-hotkey.ts","../../src/command-menu/subpage/subpage.tsx","../../src/command-menu/trigger/trigger.tsx"],"names":["index_parts_exports","__export","CommandMenuBackdrop","PopupMenuCheckboxItem","PopupMenuCheckboxItemIndicator","PopupMenuEmpty","PopupMenuFocusZone","PopupMenuFooter","PopupMenuGroup","PopupMenuGroupLabel","PopupMenuHeader","PopupMenuIcon","CommandMenuInput","PopupMenuItem","PopupMenuList","PopupMenuLoading","CommandMenuPopup","CommandMenuPortal","CommandMenuRoot","PopupMenuSeparator","PopupMenuShortcut","CommandMenuSubpage","PopupMenuSubpageBack","PopupMenuSubpageBackItem","PopupMenuSubpageTrigger","PopupMenuSurface","CommandMenuTrigger","props","forwardedRef","onPointerDown","rest","popupMenuContext","useMaybePopupMenuContext","handlePointerDown","event","reason_parts_exports","jsx","Dialog","backspaceGoesBack","PopupMenuInput","children","classNameProp","renderProp","surfaceId","usePopupMenuContext","subpageStackContextValue","isSubpageNavigating","hasOpenSubpage","subpageId","useSubpageStackState","dataSurfaceContext","setDataSurfaceContext","resolvedNodes","setResolvedNodes","toPopupState","baseState","className","render","popupProps","dataPopupContextValue","PopupSurfaceIdContext","SubpageStackContext","DataPopupContext","jsxs","DataSubpagesContent","isEditableTarget","target","getEventKey","key","matchesModifiers","chord","isApple","isApplePlatform","meta","ctrl","matchesChord","useHotkey","keys","handler","options","keybinding","parseKeybinding","firstChord","isSequence","enabled","handlerRef","optionsRef","handleKeyDown","currentOptions","openProp","defaultOpen","onOpenChange","onOpenChangeComplete","hotkey","modal","disabled","getResolvedId","idScope","store","focusOwnerStore","openChainStore","registerSurface","closeAll","handleOpenChange","menuDisabled","menuTreeResolver","usePopupMenuRoot","openState","handleDialogOpenChange","nextOpen","dialogDetails","handleDialogOpenChangeComplete","PopupMenuProviders","closeRootOnEsc","PopupMenuSubpage","isDisabled"],"mappings":"AAAA,4/BAAkD,yDAA+X,yDAA0D,yDAA2C,ICAthBA,EAAAA,CAAA,CAAA,CAAA,CAAAC,iCAAAA,EAAAD,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,EAA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AAAA,CAAiC,CAClE,GAAM,CAAE,cAAA,CAAAsF,CAAAA,CAAiB,CAAA,CAAA,CAAM,QAAA,CAAAzE,CAAAA,CAAU,GAAGV,CAAK,CAAA,CAAIH,CAAAA,CAErD,OACES,6BAAAA,oBAAC8E,CAAA,CAAiB,cAAA,CAAgBD,CAAAA,CAAiB,GAAGnF,CAAAA,CACnD,QAAA,CAAAU,CAAAA,CACH,CAEJ,CClBA,IAUad,EAAAA,CAA2B,EAAA,CAAA,UAAA,CAGtC,QAAA,CAA4BC,CAAAA,CAAOC,CAAAA,CAAc,CACjD,GAAM,CAAE,QAAA,CAAAmE,CAAAA,CAAU,GAAGjE,CAAK,CAAA,CAAIH,CAAAA,CACxBI,CAAAA,CAAmBC,iCAAAA,CAAyB,CAC5CmF,CAAAA,CAAapB,CAAAA,kBAAYhE,CAAAA,+BAAkB,UAAA,EAAY,CAAA,CAAA,CAE7D,OACEK,6BAAAA,cAACC,CAAO,OAAA,CAAP,CACC,GAAA,CAAKT,CAAAA,CACJ,GAAGE,CAAAA,CACJ,QAAA,CAAUqF,CAAAA,CACV,2BAAA,CAA0B,EAAA,CAC5B,CAEJ,CAAC,CAAA,CAAA,27BAAA","file":"/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/command-menu/index.cjs","sourcesContent":[null,"// ============================================================================\n// Command Menu Parts\n// ============================================================================\n\n// Pure aliases of the canonical resolved-node model (ADR-0001): narrow the\n// alias if a family ever needs to diverge — never edit the canonical type.\nexport type {\n NodeDef,\n PopupMenuNode as Node,\n} from '../internal/popup-menu/index.js'\n\nexport {\n PopupMenuCheckboxItem as CheckboxItem,\n PopupMenuCheckboxItemIndicator as CheckboxItemIndicator,\n PopupMenuEmpty as Empty,\n PopupMenuFocusZone as FocusZone,\n PopupMenuFooter as Footer,\n PopupMenuGroup as Group,\n PopupMenuGroupLabel as GroupLabel,\n PopupMenuHeader as Header,\n PopupMenuIcon as Icon,\n PopupMenuItem as Item,\n PopupMenuList as List,\n PopupMenuLoading as Loading,\n PopupMenuSeparator as Separator,\n PopupMenuShortcut as Shortcut,\n PopupMenuSubpageBack as SubpageBack,\n PopupMenuSubpageBackItem as SubpageBackItem,\n PopupMenuSubpageTrigger as SubpageTrigger,\n PopupMenuSurface as Surface,\n} from '../internal/popup-menu/index.js'\nexport { CommandMenuBackdrop as Backdrop } from './backdrop/backdrop.js'\nexport { CommandMenuInput as Input } from './input/input.js'\nexport { CommandMenuPopup as Popup } from './popup/popup.js'\nexport { CommandMenuPortal as Portal } from './portal/portal.js'\nexport { CommandMenuRoot as Root } from './root/root.js'\nexport { CommandMenuSubpage as Subpage } from './subpage/subpage.js'\nexport { CommandMenuTrigger as Trigger } from './trigger/trigger.js'\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport { useMaybePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\nimport { REASONS } from '../../utils/events/index.js'\n\nexport interface CommandMenuBackdropProps extends Dialog.Backdrop.Props {}\nexport type CommandMenuBackdropState = Dialog.Backdrop.State\n\n/**\n * An overlay displayed beneath the command menu popup.\n *\n * Pressing down on the backdrop closes the menu immediately (pointerdown),\n * matching the outside-press behavior of the other menus, instead of waiting\n * for the Dialog's click-time dismissal. Consumers can opt out by calling\n * `event.preventDefault()` in their own `onPointerDown`.\n */\nexport const CommandMenuBackdrop = React.forwardRef<\n HTMLDivElement,\n CommandMenuBackdrop.Props\n>(function CommandMenuBackdrop(props, forwardedRef) {\n const { onPointerDown, ...rest } = props\n const popupMenuContext = useMaybePopupMenuContext()\n\n const handlePointerDown = React.useCallback<\n NonNullable<Dialog.Backdrop.Props['onPointerDown']>\n >(\n (event) => {\n onPointerDown?.(event)\n\n if (event.defaultPrevented) {\n return\n }\n\n if (popupMenuContext && !popupMenuContext.disabled) {\n popupMenuContext.closeAll(REASONS.outsidePress, event.nativeEvent)\n }\n },\n [onPointerDown, popupMenuContext],\n )\n\n return (\n <Dialog.Backdrop\n ref={forwardedRef}\n {...rest}\n onPointerDown={handlePointerDown}\n data-command-menu-backdrop=\"\"\n />\n )\n})\n\nexport namespace CommandMenuBackdrop {\n export interface Props extends CommandMenuBackdropProps {}\n export type State = CommandMenuBackdropState\n}\n","'use client'\n\nimport * as React from 'react'\nimport {\n PopupMenuInput,\n type PopupMenuInputProps,\n type PopupMenuInputState,\n} from '../../internal/popup-menu/index.js'\n\nexport interface CommandMenuInputProps extends PopupMenuInputProps {}\nexport type CommandMenuInputState = PopupMenuInputState\n\n/**\n * Search input for filtering command menu items.\n */\nexport const CommandMenuInput = React.forwardRef<\n HTMLInputElement,\n CommandMenuInput.Props\n>(function CommandMenuInput(props, forwardedRef) {\n const { backspaceGoesBack = true, ...rest } = props\n\n return (\n <PopupMenuInput\n ref={forwardedRef}\n backspaceGoesBack={backspaceGoesBack}\n {...rest}\n />\n )\n})\n\nexport namespace CommandMenuInput {\n export interface Props extends CommandMenuInputProps {}\n export type State = CommandMenuInputState\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport { PopupSurfaceIdContext } from '../../internal/popup-menu/contexts/popup-surface-id-context.js'\nimport { SubpageStackContext } from '../../internal/popup-menu/contexts/subpage-stack-context.js'\nimport {\n DataPopupContext,\n type DataSurfaceContextValue,\n type ResolvedNodesSlot,\n} from '../../internal/popup-menu/data-first/context.js'\nimport { DataSubpagesContent } from '../../internal/popup-menu/data-first/data-subpages.js'\nimport { useSubpageStackState } from '../../internal/popup-menu/hooks/use-subpage-stack-state.js'\nimport { usePopupMenuContext } from '../../internal/popup-menu/index.js'\nimport type { ComponentRenderFn } from '../../utils/types.js'\n\nexport interface CommandMenuPopupState extends Dialog.Popup.State {\n /**\n * Whether any non-root subpage is currently open.\n */\n hasOpenSubpage: boolean\n\n /**\n * Active subpage ID, or null when the root surface is active.\n */\n subpageId: string | null\n}\n\nexport interface CommandMenuPopupProps\n extends Omit<Dialog.Popup.Props, 'className' | 'render'> {\n /**\n * CSS class applied to the element, or a function that\n * returns a class based on the component's state.\n */\n className?: string | ((state: CommandMenuPopupState) => string)\n\n /**\n * Allows replacing the popup element with a custom element.\n * The render state includes dialog popup + subpage navigation state.\n */\n render?:\n | React.ReactElement\n | ComponentRenderFn<\n React.HTMLAttributes<HTMLElement>,\n CommandMenuPopupState\n >\n}\n\n/**\n * A container for the command menu contents.\n * Wraps Dialog.Popup with popup-menu subpage and data providers.\n */\nexport const CommandMenuPopup = React.forwardRef<\n HTMLDivElement,\n CommandMenuPopup.Props\n>(function CommandMenuPopup(props, forwardedRef) {\n const {\n children,\n className: classNameProp,\n render: renderProp,\n ...rest\n } = props\n\n const surfaceId = React.useId()\n const popupMenuContext = usePopupMenuContext()\n\n const {\n subpageStackContextValue,\n isSubpageNavigating,\n hasOpenSubpage,\n subpageId,\n } = useSubpageStackState({\n surfaceId,\n store: popupMenuContext.store,\n })\n\n const [dataSurfaceContext, setDataSurfaceContext] =\n React.useState<DataSurfaceContextValue | null>(null)\n const [resolvedNodes, setResolvedNodes] =\n React.useState<ResolvedNodesSlot | null>(null)\n\n const toPopupState = React.useCallback(\n (baseState: Dialog.Popup.State): CommandMenuPopupState => ({\n ...baseState,\n hasOpenSubpage,\n subpageId,\n }),\n [hasOpenSubpage, subpageId],\n )\n\n const className = React.useMemo(() => {\n if (typeof classNameProp === 'function') {\n return (baseState: Dialog.Popup.State) => {\n return classNameProp(toPopupState(baseState))\n }\n }\n return classNameProp\n }, [classNameProp, toPopupState])\n\n const render = React.useMemo(() => {\n if (typeof renderProp === 'function') {\n return (\n popupProps: React.HTMLAttributes<HTMLElement>,\n baseState: Dialog.Popup.State,\n ) => renderProp(popupProps, toPopupState(baseState))\n }\n\n return renderProp\n }, [renderProp, toPopupState])\n\n const dataPopupContextValue = React.useMemo(\n () => ({\n dataSurfaceContext,\n setDataSurfaceContext,\n resolvedNodes,\n setResolvedNodes,\n }),\n [dataSurfaceContext, resolvedNodes],\n )\n\n return (\n <PopupSurfaceIdContext.Provider value={surfaceId}>\n <SubpageStackContext.Provider value={subpageStackContextValue}>\n <DataPopupContext.Provider value={dataPopupContextValue}>\n <Dialog.Popup\n ref={forwardedRef}\n className={className}\n render={render}\n data-command-menu-popup=\"\"\n data-navigating={isSubpageNavigating ? '' : undefined}\n data-has-open-subpage={hasOpenSubpage ? '' : undefined}\n {...rest}\n >\n {children}\n <DataSubpagesContent />\n </Dialog.Popup>\n </DataPopupContext.Provider>\n </SubpageStackContext.Provider>\n </PopupSurfaceIdContext.Provider>\n )\n})\n\nexport namespace CommandMenuPopup {\n export type Props = CommandMenuPopupProps\n export type State = CommandMenuPopupState\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\n\nexport interface CommandMenuPortalProps extends Dialog.Portal.Props {}\nexport type CommandMenuPortalState = Dialog.Portal.State\n\n/**\n * A portal element that moves the command menu popup to a different part of the DOM.\n */\nexport const CommandMenuPortal = Dialog.Portal\n\nexport namespace CommandMenuPortal {\n export type Props = CommandMenuPortalProps\n export type State = CommandMenuPortalState\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport type { PopupMenuOpenChangeReason } from '../../internal/popup-menu/events.js'\nimport {\n type GetResolvedIdFn,\n type PopupMenuIdScope,\n PopupMenuProviders,\n type UsePopupMenuRootParams,\n usePopupMenuRoot,\n} from '../../internal/popup-menu/index.js'\nimport { useHotkey } from '../../kbd/hooks/use-hotkey.js'\nimport { REASONS } from '../../utils/events/index.js'\n\nexport interface CommandMenuRootProps {\n children: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n onOpenChangeComplete?: (open: boolean) => void\n hotkey?: string\n modal?: boolean\n disabled?: boolean\n /**\n * Computes canonical Resolved IDs for data-first content from the Unresolved Menu Node (definitional facts only).\n * @default encoded surface Definition Path joined with `/`; `idScope=\"menu\"` uses the Definition Key\n * Read once when the menu root mounts — later changes have no effect. To retain the old dot-path default, use `node => node.def.id ?? node.definitionPath.join('.')`. This does not recreate former tree-item ancestry; exact compatibility requires walking `node.parent` and reproducing the old slug/key lineage.\n * @example\n * <CommandMenu.Root getResolvedId={(node) => node.def.id ?? node.definitionPath.join('.')} />\n */\n getResolvedId?: GetResolvedIdFn\n /** Definition Key uniqueness scope. Read once when the menu root mounts. @default 'surface' */\n idScope?: PopupMenuIdScope\n}\n\n/**\n * Groups all parts of the command menu.\n * Manages open state and provides popup-menu context to children.\n * Doesn't render its own HTML element.\n */\nexport function CommandMenuRoot(props: CommandMenuRoot.Props) {\n const {\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n onOpenChangeComplete,\n hotkey,\n modal = true,\n disabled,\n getResolvedId,\n idScope = 'surface',\n } = props\n\n const {\n store,\n focusOwnerStore,\n openChainStore,\n registerSurface,\n closeAll,\n handleOpenChange,\n disabled: menuDisabled,\n menuTreeResolver,\n } = usePopupMenuRoot({\n onOpenChange:\n onOpenChange as unknown as UsePopupMenuRootParams['onOpenChange'],\n defaultOpen,\n disabled,\n closeOnOutsidePress: 'pointerdown',\n getResolvedId,\n idScope,\n })\n\n store.useControlledProp('openProp', openProp)\n\n const openState = store.useState('open')\n\n useHotkey(\n hotkey ?? '',\n () => handleOpenChange(!store.state.open, REASONS.imperativeAction),\n // allowInInput keeps the hotkey working as a *toggle*: while the menu is\n // open, focus sits in the search input, so the close press must be allowed\n // to fire from an editable target.\n { enabled: !!hotkey && !menuDisabled, allowInInput: true },\n )\n\n const handleDialogOpenChange = React.useCallback(\n (nextOpen: boolean, dialogDetails: Dialog.Root.ChangeEventDetails) => {\n handleOpenChange(\n nextOpen,\n dialogDetails.reason as PopupMenuOpenChangeReason,\n dialogDetails.event,\n )\n },\n [handleOpenChange],\n )\n\n const handleDialogOpenChangeComplete = React.useCallback(\n (nextOpen: boolean) => {\n if (!nextOpen && store.context.clearSearchOnClose === 'after-exit') {\n store.clearSearch()\n store.setInputActive(false)\n }\n\n if (!nextOpen) {\n store.clearHighlight()\n store.context.onCloseComplete?.()\n store.context.onPopupCloseComplete?.()\n }\n\n onOpenChangeComplete?.(nextOpen)\n },\n [store, onOpenChangeComplete],\n )\n\n return (\n <PopupMenuProviders\n menuTreeResolver={menuTreeResolver}\n store={store}\n focusOwnerStore={focusOwnerStore}\n openChainStore={openChainStore}\n disabled={menuDisabled}\n depth={0}\n closeAll={closeAll}\n explicitTabBehavior\n tabWithoutZones=\"inert\"\n registerSurface={registerSurface}\n menuType=\"dropdown\"\n closeOnOutsidePress=\"pointerdown\"\n componentName=\"command-menu\"\n >\n <Dialog.Root\n open={openState}\n onOpenChange={handleDialogOpenChange}\n onOpenChangeComplete={handleDialogOpenChangeComplete}\n modal={modal}\n >\n {children}\n </Dialog.Root>\n </PopupMenuProviders>\n )\n}\n\nexport namespace CommandMenuRoot {\n export interface Props extends CommandMenuRootProps {}\n}\n","'use client'\n\nimport * as React from 'react'\nimport type { KeyChord } from '../utils/parse-keybinding.js'\nimport { parseKeybinding } from '../utils/parse-keybinding.js'\nimport { isApplePlatform } from '../utils/platform.js'\n\n/**\n * Options for the useHotkey global keydown listener.\n *\n * @internal Not part of the public API — used by CommandMenu's `hotkey` prop.\n */\nexport interface UseHotkeyOptions {\n /** @default true */\n enabled?: boolean\n /** @default true */\n preventDefault?: boolean\n /** Fire even when focus is in an input/textarea/select/contenteditable. @default false */\n allowInInput?: boolean\n}\n\nfunction isEditableTarget(target: EventTarget | null): boolean {\n return (\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement ||\n (target instanceof HTMLElement && target.isContentEditable)\n )\n}\n\nfunction getEventKey(event: KeyboardEvent): string {\n const key = event.key.toLowerCase()\n\n return key === ' ' ? 'space' : key\n}\n\nfunction matchesModifiers(event: KeyboardEvent, chord: KeyChord): boolean {\n const isApple = isApplePlatform()\n const meta = chord.meta || (isApple && chord.mod)\n const ctrl = chord.ctrl || (!isApple && chord.mod)\n\n return (\n event.metaKey === meta &&\n event.ctrlKey === ctrl &&\n event.altKey === chord.alt &&\n event.shiftKey === chord.shift\n )\n}\n\nfunction matchesChord(event: KeyboardEvent, chord: KeyChord): boolean {\n return chord.key === getEventKey(event) && matchesModifiers(event, chord)\n}\n\n/**\n * Calls a handler when a single-chord keybinding is pressed anywhere in the\n * document.\n *\n * @internal Not part of the public API. Deliberately unexported from\n * `kbd/index.ts` — consumers get global-shortcut behavior through\n * `CommandMenu.Root`'s `hotkey` prop instead. Import via the file path if\n * another primitive needs it.\n */\nexport function useHotkey(\n keys: string,\n handler: (event: KeyboardEvent) => void,\n options?: UseHotkeyOptions,\n): void {\n const keybinding = React.useMemo(() => parseKeybinding(keys), [keys])\n const [firstChord] = keybinding.chords\n const chord =\n keybinding.chords.length === 1 && firstChord !== undefined\n ? firstChord\n : null\n const isSequence = keybinding.chords.length > 1\n const enabled = options?.enabled !== false\n\n const handlerRef = React.useRef(handler)\n const optionsRef = React.useRef(options)\n\n handlerRef.current = handler\n optionsRef.current = options\n\n React.useEffect(() => {\n if (isSequence && process.env.NODE_ENV !== 'production') {\n console.warn(\n `useHotkey only supports single-chord keybindings. Received \"${keys}\", but sequences are not supported by useHotkey.`,\n )\n }\n }, [isSequence, keys])\n\n React.useEffect(() => {\n if (!enabled || chord === null || isSequence || chord.key === null) {\n return\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const currentOptions = optionsRef.current\n\n if (event.repeat) {\n return\n }\n\n if (!currentOptions?.allowInInput && isEditableTarget(event.target)) {\n return\n }\n\n if (!matchesChord(event, chord)) {\n return\n }\n\n if (currentOptions?.preventDefault !== false) {\n event.preventDefault()\n }\n\n handlerRef.current(event)\n }\n\n document.addEventListener('keydown', handleKeyDown)\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [chord, enabled, isSequence])\n}\n","'use client'\n\nimport {\n PopupMenuSubpage,\n type PopupMenuSubpageProps,\n} from '../../internal/popup-menu/index.js'\n\nexport interface CommandMenuSubpageProps extends PopupMenuSubpageProps {}\n\n/**\n * Groups all parts of a command menu subpage.\n */\nexport function CommandMenuSubpage(props: CommandMenuSubpage.Props) {\n const { closeRootOnEsc = true, children, ...rest } = props\n\n return (\n <PopupMenuSubpage closeRootOnEsc={closeRootOnEsc} {...rest}>\n {children}\n </PopupMenuSubpage>\n )\n}\n\nexport namespace CommandMenuSubpage {\n export interface Props extends CommandMenuSubpageProps {}\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport { useMaybePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\n\nexport interface CommandMenuTriggerProps extends Dialog.Trigger.Props {}\nexport type CommandMenuTriggerState = Dialog.Trigger.State\n\n/**\n * A button that opens the command menu.\n */\nexport const CommandMenuTrigger = React.forwardRef<\n HTMLButtonElement,\n CommandMenuTrigger.Props\n>(function CommandMenuTrigger(props, forwardedRef) {\n const { disabled, ...rest } = props\n const popupMenuContext = useMaybePopupMenuContext()\n const isDisabled = disabled || popupMenuContext?.disabled || false\n\n return (\n <Dialog.Trigger\n ref={forwardedRef}\n {...rest}\n disabled={isDisabled}\n data-command-menu-trigger=\"\"\n />\n )\n})\n\nexport namespace CommandMenuTrigger {\n export interface Props extends CommandMenuTriggerProps {}\n export type State = CommandMenuTriggerState\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/command-menu/index.cjs","../../src/command-menu/index.parts.ts","../../src/command-menu/backdrop/backdrop.tsx","../../src/command-menu/input/input.tsx","../../src/command-menu/popup/popup.tsx","../../src/command-menu/portal/portal.tsx","../../src/command-menu/root/root.tsx","../../src/kbd/hooks/use-hotkey.ts","../../src/command-menu/subpage/subpage.tsx","../../src/command-menu/trigger/trigger.tsx"],"names":["index_parts_exports","__export","CommandMenuBackdrop","PopupMenuCheckboxItem","PopupMenuCheckboxItemIndicator","PopupMenuEmpty","PopupMenuFocusZone","PopupMenuFooter","PopupMenuGroup","PopupMenuGroupLabel","PopupMenuHeader","PopupMenuIcon","CommandMenuInput","PopupMenuItem","PopupMenuList","PopupMenuLoading","CommandMenuPopup","CommandMenuPortal","CommandMenuRoot","PopupMenuSeparator","PopupMenuShortcut","CommandMenuSubpage","PopupMenuSubpageBack","PopupMenuSubpageBackItem","PopupMenuSubpageTrigger","PopupMenuSurface","CommandMenuTrigger","props","forwardedRef","onPointerDown","rest","popupMenuContext","useMaybePopupMenuContext","handlePointerDown","event","reason_parts_exports","jsx","Dialog","backspaceGoesBack","PopupMenuInput","children","classNameProp","renderProp","surfaceId","usePopupMenuContext","subpageStackContextValue","isSubpageNavigating","hasOpenSubpage","subpageId","useSubpageStackState","dataSurfaceContext","setDataSurfaceContext","resolvedNodes","setResolvedNodes","toPopupState","baseState","className","render","popupProps","dataPopupContextValue","PopupSurfaceIdContext","SubpageStackContext","DataPopupContext","jsxs","DataSubpagesContent","isEditableTarget","target","getEventKey","key","matchesModifiers","chord","isApple","isApplePlatform","meta","ctrl","matchesChord","useHotkey","keys","handler","options","keybinding","parseKeybinding","firstChord","isSequence","enabled","handlerRef","optionsRef","handleKeyDown","currentOptions","openProp","defaultOpen","onOpenChange","onOpenChangeComplete","hotkey","modal","disabled","getResolvedId","idScope","store","focusOwnerStore","openChainStore","registerSurface","closeAll","handleOpenChange","menuDisabled","menuTreeResolver","usePopupMenuRoot","openState","handleDialogOpenChange","nextOpen","dialogDetails","handleDialogOpenChangeComplete","PopupMenuProviders","closeRootOnEsc","PopupMenuSubpage","isDisabled"],"mappings":"AAAA,4/BAAkD,yDAA+X,yDAA0D,yDAA2C,ICAthBA,EAAAA,CAAA,CAAA,CAAA,CAAAC,iCAAAA,EAAAD,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,EAAAE,EAAAA,CAAA,YAAA,CAAA,CAAA,CAAA,EAAAC,oBAAAA,CAAA,qBAAA,CAAA,CAAA,CAAA,EAAAC,oBAAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAAC,mBAAAA,CAAA,SAAA,CAAA,CAAA,CAAA,EAAAC,oBAAAA,CAAA,MAA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AAiB,GAAGnF,CAAAA,CACnD,QAAA,CAAAU,CAAAA,CACH,CAEJ,CClBA,IAUad,EAAAA,CAA2B,EAAA,CAAA,UAAA,CAGtC,QAAA,CAA4BC,CAAAA,CAAOC,CAAAA,CAAc,CACjD,GAAM,CAAE,QAAA,CAAAmE,CAAAA,CAAU,GAAGjE,CAAK,CAAA,CAAIH,CAAAA,CACxBI,CAAAA,CAAmBC,iCAAAA,CAAyB,CAC5CmF,CAAAA,CAAapB,CAAAA,kBAAYhE,CAAAA,+BAAkB,UAAA,EAAY,CAAA,CAAA,CAE7D,OACEK,6BAAAA,cAACC,CAAO,OAAA,CAAP,CACC,GAAA,CAAKT,CAAAA,CACJ,GAAGE,CAAAA,CACJ,QAAA,CAAUqF,CAAAA,CACV,2BAAA,CAA0B,EAAA,CAC5B,CAEJ,CAAC,CAAA,CAAA,27BAAA","file":"/home/runner/work/ui/ui/packages/react/dist/command-menu/index.cjs","sourcesContent":[null,"// ============================================================================\n// Command Menu Parts\n// ============================================================================\n\n// Pure aliases of the canonical resolved-node model (ADR-0001): narrow the\n// alias if a family ever needs to diverge — never edit the canonical type.\nexport type {\n NodeDef,\n PopupMenuNode as Node,\n} from '../internal/popup-menu/index.js'\n\nexport {\n PopupMenuCheckboxItem as CheckboxItem,\n PopupMenuCheckboxItemIndicator as CheckboxItemIndicator,\n PopupMenuEmpty as Empty,\n PopupMenuFocusZone as FocusZone,\n PopupMenuFooter as Footer,\n PopupMenuGroup as Group,\n PopupMenuGroupLabel as GroupLabel,\n PopupMenuHeader as Header,\n PopupMenuIcon as Icon,\n PopupMenuItem as Item,\n PopupMenuList as List,\n PopupMenuLoading as Loading,\n PopupMenuSeparator as Separator,\n PopupMenuShortcut as Shortcut,\n PopupMenuSubpageBack as SubpageBack,\n PopupMenuSubpageBackItem as SubpageBackItem,\n PopupMenuSubpageTrigger as SubpageTrigger,\n PopupMenuSurface as Surface,\n} from '../internal/popup-menu/index.js'\nexport { CommandMenuBackdrop as Backdrop } from './backdrop/backdrop.js'\nexport { CommandMenuInput as Input } from './input/input.js'\nexport { CommandMenuPopup as Popup } from './popup/popup.js'\nexport { CommandMenuPortal as Portal } from './portal/portal.js'\nexport { CommandMenuRoot as Root } from './root/root.js'\nexport { CommandMenuSubpage as Subpage } from './subpage/subpage.js'\nexport { CommandMenuTrigger as Trigger } from './trigger/trigger.js'\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport { useMaybePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\nimport { REASONS } from '../../utils/events/index.js'\n\nexport interface CommandMenuBackdropProps extends Dialog.Backdrop.Props {}\nexport type CommandMenuBackdropState = Dialog.Backdrop.State\n\n/**\n * An overlay displayed beneath the command menu popup.\n *\n * Pressing down on the backdrop closes the menu immediately (pointerdown),\n * matching the outside-press behavior of the other menus, instead of waiting\n * for the Dialog's click-time dismissal. Consumers can opt out by calling\n * `event.preventDefault()` in their own `onPointerDown`.\n */\nexport const CommandMenuBackdrop = React.forwardRef<\n HTMLDivElement,\n CommandMenuBackdrop.Props\n>(function CommandMenuBackdrop(props, forwardedRef) {\n const { onPointerDown, ...rest } = props\n const popupMenuContext = useMaybePopupMenuContext()\n\n const handlePointerDown = React.useCallback<\n NonNullable<Dialog.Backdrop.Props['onPointerDown']>\n >(\n (event) => {\n onPointerDown?.(event)\n\n if (event.defaultPrevented) {\n return\n }\n\n if (popupMenuContext && !popupMenuContext.disabled) {\n popupMenuContext.closeAll(REASONS.outsidePress, event.nativeEvent)\n }\n },\n [onPointerDown, popupMenuContext],\n )\n\n return (\n <Dialog.Backdrop\n ref={forwardedRef}\n {...rest}\n onPointerDown={handlePointerDown}\n data-command-menu-backdrop=\"\"\n />\n )\n})\n\nexport namespace CommandMenuBackdrop {\n export interface Props extends CommandMenuBackdropProps {}\n export type State = CommandMenuBackdropState\n}\n","'use client'\n\nimport * as React from 'react'\nimport {\n PopupMenuInput,\n type PopupMenuInputProps,\n type PopupMenuInputState,\n} from '../../internal/popup-menu/index.js'\n\nexport interface CommandMenuInputProps extends PopupMenuInputProps {}\nexport type CommandMenuInputState = PopupMenuInputState\n\n/**\n * Search input for filtering command menu items.\n */\nexport const CommandMenuInput = React.forwardRef<\n HTMLInputElement,\n CommandMenuInput.Props\n>(function CommandMenuInput(props, forwardedRef) {\n const { backspaceGoesBack = true, ...rest } = props\n\n return (\n <PopupMenuInput\n ref={forwardedRef}\n backspaceGoesBack={backspaceGoesBack}\n {...rest}\n />\n )\n})\n\nexport namespace CommandMenuInput {\n export interface Props extends CommandMenuInputProps {}\n export type State = CommandMenuInputState\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport { PopupSurfaceIdContext } from '../../internal/popup-menu/contexts/popup-surface-id-context.js'\nimport { SubpageStackContext } from '../../internal/popup-menu/contexts/subpage-stack-context.js'\nimport {\n DataPopupContext,\n type DataSurfaceContextValue,\n type ResolvedNodesSlot,\n} from '../../internal/popup-menu/data-first/context.js'\nimport { DataSubpagesContent } from '../../internal/popup-menu/data-first/data-subpages.js'\nimport { useSubpageStackState } from '../../internal/popup-menu/hooks/use-subpage-stack-state.js'\nimport { usePopupMenuContext } from '../../internal/popup-menu/index.js'\nimport type { ComponentRenderFn } from '../../utils/types.js'\n\nexport interface CommandMenuPopupState extends Dialog.Popup.State {\n /**\n * Whether any non-root subpage is currently open.\n */\n hasOpenSubpage: boolean\n\n /**\n * Active subpage ID, or null when the root surface is active.\n */\n subpageId: string | null\n}\n\nexport interface CommandMenuPopupProps\n extends Omit<Dialog.Popup.Props, 'className' | 'render'> {\n /**\n * CSS class applied to the element, or a function that\n * returns a class based on the component's state.\n */\n className?: string | ((state: CommandMenuPopupState) => string)\n\n /**\n * Allows replacing the popup element with a custom element.\n * The render state includes dialog popup + subpage navigation state.\n */\n render?:\n | React.ReactElement\n | ComponentRenderFn<\n React.HTMLAttributes<HTMLElement>,\n CommandMenuPopupState\n >\n}\n\n/**\n * A container for the command menu contents.\n * Wraps Dialog.Popup with popup-menu subpage and data providers.\n */\nexport const CommandMenuPopup = React.forwardRef<\n HTMLDivElement,\n CommandMenuPopup.Props\n>(function CommandMenuPopup(props, forwardedRef) {\n const {\n children,\n className: classNameProp,\n render: renderProp,\n ...rest\n } = props\n\n const surfaceId = React.useId()\n const popupMenuContext = usePopupMenuContext()\n\n const {\n subpageStackContextValue,\n isSubpageNavigating,\n hasOpenSubpage,\n subpageId,\n } = useSubpageStackState({\n surfaceId,\n store: popupMenuContext.store,\n })\n\n const [dataSurfaceContext, setDataSurfaceContext] =\n React.useState<DataSurfaceContextValue | null>(null)\n const [resolvedNodes, setResolvedNodes] =\n React.useState<ResolvedNodesSlot | null>(null)\n\n const toPopupState = React.useCallback(\n (baseState: Dialog.Popup.State): CommandMenuPopupState => ({\n ...baseState,\n hasOpenSubpage,\n subpageId,\n }),\n [hasOpenSubpage, subpageId],\n )\n\n const className = React.useMemo(() => {\n if (typeof classNameProp === 'function') {\n return (baseState: Dialog.Popup.State) => {\n return classNameProp(toPopupState(baseState))\n }\n }\n return classNameProp\n }, [classNameProp, toPopupState])\n\n const render = React.useMemo(() => {\n if (typeof renderProp === 'function') {\n return (\n popupProps: React.HTMLAttributes<HTMLElement>,\n baseState: Dialog.Popup.State,\n ) => renderProp(popupProps, toPopupState(baseState))\n }\n\n return renderProp\n }, [renderProp, toPopupState])\n\n const dataPopupContextValue = React.useMemo(\n () => ({\n dataSurfaceContext,\n setDataSurfaceContext,\n resolvedNodes,\n setResolvedNodes,\n }),\n [dataSurfaceContext, resolvedNodes],\n )\n\n return (\n <PopupSurfaceIdContext.Provider value={surfaceId}>\n <SubpageStackContext.Provider value={subpageStackContextValue}>\n <DataPopupContext.Provider value={dataPopupContextValue}>\n <Dialog.Popup\n ref={forwardedRef}\n className={className}\n render={render}\n data-command-menu-popup=\"\"\n data-navigating={isSubpageNavigating ? '' : undefined}\n data-has-open-subpage={hasOpenSubpage ? '' : undefined}\n {...rest}\n >\n {children}\n <DataSubpagesContent />\n </Dialog.Popup>\n </DataPopupContext.Provider>\n </SubpageStackContext.Provider>\n </PopupSurfaceIdContext.Provider>\n )\n})\n\nexport namespace CommandMenuPopup {\n export type Props = CommandMenuPopupProps\n export type State = CommandMenuPopupState\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\n\nexport interface CommandMenuPortalProps extends Dialog.Portal.Props {}\nexport type CommandMenuPortalState = Dialog.Portal.State\n\n/**\n * A portal element that moves the command menu popup to a different part of the DOM.\n */\nexport const CommandMenuPortal = Dialog.Portal\n\nexport namespace CommandMenuPortal {\n export type Props = CommandMenuPortalProps\n export type State = CommandMenuPortalState\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport type { PopupMenuOpenChangeReason } from '../../internal/popup-menu/events.js'\nimport {\n type GetResolvedIdFn,\n type PopupMenuIdScope,\n PopupMenuProviders,\n type UsePopupMenuRootParams,\n usePopupMenuRoot,\n} from '../../internal/popup-menu/index.js'\nimport { useHotkey } from '../../kbd/hooks/use-hotkey.js'\nimport { REASONS } from '../../utils/events/index.js'\n\nexport interface CommandMenuRootProps {\n children: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n onOpenChangeComplete?: (open: boolean) => void\n hotkey?: string\n modal?: boolean\n disabled?: boolean\n /**\n * Computes canonical Resolved IDs for data-first content from the Unresolved Menu Node (definitional facts only).\n * @default encoded surface Definition Path joined with `/`; `idScope=\"menu\"` uses the Definition Key\n * Read once when the menu root mounts — later changes have no effect. To retain the old dot-path default, use `node => node.def.id ?? node.definitionPath.join('.')`. This does not recreate former tree-item ancestry; exact compatibility requires walking `node.parent` and reproducing the old slug/key lineage.\n * @example\n * <CommandMenu.Root getResolvedId={(node) => node.def.id ?? node.definitionPath.join('.')} />\n */\n getResolvedId?: GetResolvedIdFn\n /** Definition Key uniqueness scope. Read once when the menu root mounts. @default 'surface' */\n idScope?: PopupMenuIdScope\n}\n\n/**\n * Groups all parts of the command menu.\n * Manages open state and provides popup-menu context to children.\n * Doesn't render its own HTML element.\n */\nexport function CommandMenuRoot(props: CommandMenuRoot.Props) {\n const {\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n onOpenChangeComplete,\n hotkey,\n modal = true,\n disabled,\n getResolvedId,\n idScope = 'surface',\n } = props\n\n const {\n store,\n focusOwnerStore,\n openChainStore,\n registerSurface,\n closeAll,\n handleOpenChange,\n disabled: menuDisabled,\n menuTreeResolver,\n } = usePopupMenuRoot({\n onOpenChange:\n onOpenChange as unknown as UsePopupMenuRootParams['onOpenChange'],\n defaultOpen,\n disabled,\n closeOnOutsidePress: 'pointerdown',\n getResolvedId,\n idScope,\n })\n\n store.useControlledProp('openProp', openProp)\n\n const openState = store.useState('open')\n\n useHotkey(\n hotkey ?? '',\n () => handleOpenChange(!store.state.open, REASONS.imperativeAction),\n // allowInInput keeps the hotkey working as a *toggle*: while the menu is\n // open, focus sits in the search input, so the close press must be allowed\n // to fire from an editable target.\n { enabled: !!hotkey && !menuDisabled, allowInInput: true },\n )\n\n const handleDialogOpenChange = React.useCallback(\n (nextOpen: boolean, dialogDetails: Dialog.Root.ChangeEventDetails) => {\n handleOpenChange(\n nextOpen,\n dialogDetails.reason as PopupMenuOpenChangeReason,\n dialogDetails.event,\n )\n },\n [handleOpenChange],\n )\n\n const handleDialogOpenChangeComplete = React.useCallback(\n (nextOpen: boolean) => {\n if (!nextOpen && store.context.clearSearchOnClose === 'after-exit') {\n store.clearSearch()\n store.setInputActive(false)\n }\n\n if (!nextOpen) {\n store.clearHighlight()\n store.context.onCloseComplete?.()\n store.context.onPopupCloseComplete?.()\n }\n\n onOpenChangeComplete?.(nextOpen)\n },\n [store, onOpenChangeComplete],\n )\n\n return (\n <PopupMenuProviders\n menuTreeResolver={menuTreeResolver}\n store={store}\n focusOwnerStore={focusOwnerStore}\n openChainStore={openChainStore}\n disabled={menuDisabled}\n depth={0}\n closeAll={closeAll}\n explicitTabBehavior\n tabWithoutZones=\"inert\"\n registerSurface={registerSurface}\n menuType=\"dropdown\"\n closeOnOutsidePress=\"pointerdown\"\n componentName=\"command-menu\"\n >\n <Dialog.Root\n open={openState}\n onOpenChange={handleDialogOpenChange}\n onOpenChangeComplete={handleDialogOpenChangeComplete}\n modal={modal}\n >\n {children}\n </Dialog.Root>\n </PopupMenuProviders>\n )\n}\n\nexport namespace CommandMenuRoot {\n export interface Props extends CommandMenuRootProps {}\n}\n","'use client'\n\nimport * as React from 'react'\nimport type { KeyChord } from '../utils/parse-keybinding.js'\nimport { parseKeybinding } from '../utils/parse-keybinding.js'\nimport { isApplePlatform } from '../utils/platform.js'\n\n/**\n * Options for the useHotkey global keydown listener.\n *\n * @internal Not part of the public API — used by CommandMenu's `hotkey` prop.\n */\nexport interface UseHotkeyOptions {\n /** @default true */\n enabled?: boolean\n /** @default true */\n preventDefault?: boolean\n /** Fire even when focus is in an input/textarea/select/contenteditable. @default false */\n allowInInput?: boolean\n}\n\nfunction isEditableTarget(target: EventTarget | null): boolean {\n return (\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement ||\n (target instanceof HTMLElement && target.isContentEditable)\n )\n}\n\nfunction getEventKey(event: KeyboardEvent): string {\n const key = event.key.toLowerCase()\n\n return key === ' ' ? 'space' : key\n}\n\nfunction matchesModifiers(event: KeyboardEvent, chord: KeyChord): boolean {\n const isApple = isApplePlatform()\n const meta = chord.meta || (isApple && chord.mod)\n const ctrl = chord.ctrl || (!isApple && chord.mod)\n\n return (\n event.metaKey === meta &&\n event.ctrlKey === ctrl &&\n event.altKey === chord.alt &&\n event.shiftKey === chord.shift\n )\n}\n\nfunction matchesChord(event: KeyboardEvent, chord: KeyChord): boolean {\n return chord.key === getEventKey(event) && matchesModifiers(event, chord)\n}\n\n/**\n * Calls a handler when a single-chord keybinding is pressed anywhere in the\n * document.\n *\n * @internal Not part of the public API. Deliberately unexported from\n * `kbd/index.ts` — consumers get global-shortcut behavior through\n * `CommandMenu.Root`'s `hotkey` prop instead. Import via the file path if\n * another primitive needs it.\n */\nexport function useHotkey(\n keys: string,\n handler: (event: KeyboardEvent) => void,\n options?: UseHotkeyOptions,\n): void {\n const keybinding = React.useMemo(() => parseKeybinding(keys), [keys])\n const [firstChord] = keybinding.chords\n const chord =\n keybinding.chords.length === 1 && firstChord !== undefined\n ? firstChord\n : null\n const isSequence = keybinding.chords.length > 1\n const enabled = options?.enabled !== false\n\n const handlerRef = React.useRef(handler)\n const optionsRef = React.useRef(options)\n\n handlerRef.current = handler\n optionsRef.current = options\n\n React.useEffect(() => {\n if (isSequence && process.env.NODE_ENV !== 'production') {\n console.warn(\n `useHotkey only supports single-chord keybindings. Received \"${keys}\", but sequences are not supported by useHotkey.`,\n )\n }\n }, [isSequence, keys])\n\n React.useEffect(() => {\n if (!enabled || chord === null || isSequence || chord.key === null) {\n return\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const currentOptions = optionsRef.current\n\n if (event.repeat) {\n return\n }\n\n if (!currentOptions?.allowInInput && isEditableTarget(event.target)) {\n return\n }\n\n if (!matchesChord(event, chord)) {\n return\n }\n\n if (currentOptions?.preventDefault !== false) {\n event.preventDefault()\n }\n\n handlerRef.current(event)\n }\n\n document.addEventListener('keydown', handleKeyDown)\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [chord, enabled, isSequence])\n}\n","'use client'\n\nimport {\n PopupMenuSubpage,\n type PopupMenuSubpageProps,\n} from '../../internal/popup-menu/index.js'\n\nexport interface CommandMenuSubpageProps extends PopupMenuSubpageProps {}\n\n/**\n * Groups all parts of a command menu subpage.\n */\nexport function CommandMenuSubpage(props: CommandMenuSubpage.Props) {\n const { closeRootOnEsc = true, children, ...rest } = props\n\n return (\n <PopupMenuSubpage closeRootOnEsc={closeRootOnEsc} {...rest}>\n {children}\n </PopupMenuSubpage>\n )\n}\n\nexport namespace CommandMenuSubpage {\n export interface Props extends CommandMenuSubpageProps {}\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport { useMaybePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\n\nexport interface CommandMenuTriggerProps extends Dialog.Trigger.Props {}\nexport type CommandMenuTriggerState = Dialog.Trigger.State\n\n/**\n * A button that opens the command menu.\n */\nexport const CommandMenuTrigger = React.forwardRef<\n HTMLButtonElement,\n CommandMenuTrigger.Props\n>(function CommandMenuTrigger(props, forwardedRef) {\n const { disabled, ...rest } = props\n const popupMenuContext = useMaybePopupMenuContext()\n const isDisabled = disabled || popupMenuContext?.disabled || false\n\n return (\n <Dialog.Trigger\n ref={forwardedRef}\n {...rest}\n disabled={isDisabled}\n data-command-menu-trigger=\"\"\n />\n )\n})\n\nexport namespace CommandMenuTrigger {\n export interface Props extends CommandMenuTriggerProps {}\n export type State = CommandMenuTriggerState\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as pe,d as re}from"../chunk-LXXK4S4Q.js";import{$ as Ae,A as he,Aa as oe,B as ke,Ba as ne,C as De,Ca as te,D as ve,Da as ae,E as Le,F as Ne,G as Te,I as H,N as w,T as F,U as K,V,W as Z,X as Ee,Y as Be,Z as Ge,_ as Oe,ba as j,ca as U,d as T,e as x,f as E,fa as Q,ga as q,ha as W,ia as _,k as B,ka as He,na as $,o as Re,oa as z,p as ye,pa as J,q as G,r as O,ra as X,sa as Y,ta as ee,y as Ie,z as A}from"../chunk-
|
|
1
|
+
import{a as pe,d as re}from"../chunk-LXXK4S4Q.js";import{$ as Ae,A as he,Aa as oe,B as ke,Ba as ne,C as De,Ca as te,D as ve,Da as ae,E as Le,F as Ne,G as Te,I as H,N as w,T as F,U as K,V,W as Z,X as Ee,Y as Be,Z as Ge,_ as Oe,ba as j,ca as U,d as T,e as x,f as E,fa as Q,ga as q,ha as W,ia as _,k as B,ka as He,na as $,o as Re,oa as z,p as ye,pa as J,q as G,r as O,ra as X,sa as Y,ta as ee,y as Ie,z as A}from"../chunk-65TSJ7MA.js";import{a as R,p as be,q as xe}from"../chunk-A4Z5BY7H.js";import{a as ge}from"../chunk-4C666HHU.js";var fe={};ge(fe,{Backdrop:()=>ue,CheckboxItem:()=>q,CheckboxItemIndicator:()=>W,Empty:()=>K,FocusZone:()=>$,Footer:()=>z,Group:()=>J,GroupLabel:()=>Z,Header:()=>X,Icon:()=>F,Input:()=>me,Item:()=>_,List:()=>j,Loading:()=>U,Popup:()=>de,Portal:()=>ie,Root:()=>Pe,Separator:()=>Y,Shortcut:()=>ee,Subpage:()=>Me,SubpageBack:()=>ne,SubpageBackItem:()=>te,SubpageTrigger:()=>ae,Surface:()=>Q,Trigger:()=>Se});import{Dialog as we}from"@base-ui/react/dialog";import*as y from"react";import{jsx as Fe}from"react/jsx-runtime";var ue=y.forwardRef(function(o,a){let{onPointerDown:p,...r}=o,t=x(),u=y.useCallback(m=>{p?.(m),!m.defaultPrevented&&t&&!t.disabled&&t.closeAll(R.outsidePress,m.nativeEvent)},[p,t]);return Fe(we.Backdrop,{ref:a,...r,onPointerDown:u,"data-command-menu-backdrop":""})});import*as se from"react";import{jsx as Ke}from"react/jsx-runtime";var me=se.forwardRef(function(o,a){let{backspaceGoesBack:p=!0,...r}=o;return Ke(V,{ref:a,backspaceGoesBack:p,...r})});import{Dialog as Ve}from"@base-ui/react/dialog";import*as s from"react";import{jsx as I,jsxs as Ze}from"react/jsx-runtime";var de=s.forwardRef(function(o,a){let{children:p,className:r,render:t,...u}=o,m=s.useId(),M=T(),{subpageStackContextValue:C,isSubpageNavigating:S,hasOpenSubpage:n,subpageId:i}=O({surfaceId:m,store:M.store}),[g,h]=s.useState(null),[b,f]=s.useState(null),c=s.useCallback(l=>({...l,hasOpenSubpage:n,subpageId:i}),[n,i]),k=s.useMemo(()=>typeof r=="function"?l=>r(c(l)):r,[r,c]),D=s.useMemo(()=>typeof t=="function"?(l,P)=>t(l,c(P)):t,[t,c]),v=s.useMemo(()=>({dataSurfaceContext:g,setDataSurfaceContext:h,resolvedNodes:b,setResolvedNodes:f}),[g,b]);return I(E.Provider,{value:m,children:I(B.Provider,{value:C,children:I(A.Provider,{value:v,children:Ze(Ve.Popup,{ref:a,className:k,render:D,"data-command-menu-popup":"","data-navigating":S?"":void 0,"data-has-open-subpage":n?"":void 0,...u,children:[p,I(H,{})]})})})})});import{Dialog as je}from"@base-ui/react/dialog";var ie=je.Portal;import{Dialog as _e}from"@base-ui/react/dialog";import*as L from"react";import*as d from"react";function Ue(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable}function Qe(e){let o=e.key.toLowerCase();return o===" "?"space":o}function qe(e,o){let a=re(),p=o.meta||a&&o.mod,r=o.ctrl||!a&&o.mod;return e.metaKey===p&&e.ctrlKey===r&&e.altKey===o.alt&&e.shiftKey===o.shift}function We(e,o){return o.key===Qe(e)&&qe(e,o)}function ce(e,o,a){let p=d.useMemo(()=>pe(e),[e]),[r]=p.chords,t=p.chords.length===1&&r!==void 0?r:null,u=p.chords.length>1,m=a?.enabled!==!1,M=d.useRef(o),C=d.useRef(a);M.current=o,C.current=a,d.useEffect(()=>{u&&process.env.NODE_ENV!=="production"&&console.warn(`useHotkey only supports single-chord keybindings. Received "${e}", but sequences are not supported by useHotkey.`)},[u,e]),d.useEffect(()=>{if(!m||t===null||u||t.key===null)return;let S=n=>{let i=C.current;n.repeat||!i?.allowInInput&&Ue(n.target)||We(n,t)&&(i?.preventDefault!==!1&&n.preventDefault(),M.current(n))};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[t,m,u])}import{jsx as le}from"react/jsx-runtime";function Pe(e){let{children:o,open:a,defaultOpen:p=!1,onOpenChange:r,onOpenChangeComplete:t,hotkey:u,modal:m=!0,disabled:M,getResolvedId:C,idScope:S="surface"}=e,{store:n,focusOwnerStore:i,openChainStore:g,registerSurface:h,closeAll:b,handleOpenChange:f,disabled:c,menuTreeResolver:k}=G({onOpenChange:r,defaultOpen:p,disabled:M,closeOnOutsidePress:"pointerdown",getResolvedId:C,idScope:S});n.useControlledProp("openProp",a);let D=n.useState("open");ce(u??"",()=>f(!n.state.open,R.imperativeAction),{enabled:!!u&&!c,allowInInput:!0});let v=L.useCallback((P,N)=>{f(P,N.reason,N.event)},[f]),l=L.useCallback(P=>{!P&&n.context.clearSearchOnClose==="after-exit"&&(n.clearSearch(),n.setInputActive(!1)),P||(n.clearHighlight(),n.context.onCloseComplete?.(),n.context.onPopupCloseComplete?.()),t?.(P)},[n,t]);return le(w,{menuTreeResolver:k,store:n,focusOwnerStore:i,openChainStore:g,disabled:c,depth:0,closeAll:b,explicitTabBehavior:!0,tabWithoutZones:"inert",registerSurface:h,menuType:"dropdown",closeOnOutsidePress:"pointerdown",componentName:"command-menu",children:le(_e.Root,{open:D,onOpenChange:v,onOpenChangeComplete:l,modal:m,children:o})})}import{jsx as $e}from"react/jsx-runtime";function Me(e){let{closeRootOnEsc:o=!0,children:a,...p}=e;return $e(oe,{closeRootOnEsc:o,...p,children:a})}import{Dialog as ze}from"@base-ui/react/dialog";import*as Ce from"react";import{jsx as Je}from"react/jsx-runtime";var Se=Ce.forwardRef(function(o,a){let{disabled:p,...r}=o,t=x(),u=p||t?.disabled||!1;return Je(ze.Trigger,{ref:a,...r,disabled:u,"data-command-menu-trigger":""})});export{fe as CommandMenu,He as CommandMenuRadioGroupValue,De as DataListContext,Ie as DataSurfaceContext,ye as defaultGetResolvedId,Ee as defineRadioGroup,Be as isDisplayGroupNode,Ge as isDisplayRadioGroupNode,Ae as isDisplayRowNode,Oe as isDisplaySeparatorNode,Re as isPopupMenuNode,Ne as useAsyncMenuCoordinator,ve as useDataList,he as useDataSurfaceContext,Te as useMaybeAsyncMenuCoordinator,Le as useMaybeDataList,ke as useMaybeDataSurfaceContext,xe as useMaybeSurfaceContext,be as useSurfaceContext};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkW4ACKMIZcjs = require('../chunk-W4ACKMIZ.cjs');var _chunkXMZZ62VJcjs = require('../chunk-XMZZ62VJ.cjs');var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var Ve={};_chunkM4G6J7DPcjs.a.call(void 0, Ve,{Arrow:()=>_chunkW4ACKMIZcjs.s,Backdrop:()=>_chunkW4ACKMIZcjs.t,CheckboxItem:()=>_chunkW4ACKMIZcjs.ga,CheckboxItemIndicator:()=>_chunkW4ACKMIZcjs.ha,Empty:()=>_chunkW4ACKMIZcjs.U,FocusZone:()=>_chunkW4ACKMIZcjs.na,Footer:()=>_chunkW4ACKMIZcjs.oa,Group:()=>_chunkW4ACKMIZcjs.pa,GroupLabel:()=>_chunkW4ACKMIZcjs.W,GroupValue:()=>_chunkW4ACKMIZcjs.qa,Header:()=>_chunkW4ACKMIZcjs.ra,Icon:()=>_chunkW4ACKMIZcjs.T,Input:()=>_chunkW4ACKMIZcjs.V,Item:()=>_chunkW4ACKMIZcjs.ia,List:()=>_chunkW4ACKMIZcjs.ba,Popup:()=>_chunkW4ACKMIZcjs.J,Portal:()=>_chunkW4ACKMIZcjs.K,Positioner:()=>_chunkW4ACKMIZcjs.M,RadioGroup:()=>_chunkW4ACKMIZcjs.ja,RadioGroupValue:()=>_chunkW4ACKMIZcjs.ka,RadioItem:()=>_chunkW4ACKMIZcjs.la,RadioItemIndicator:()=>_chunkW4ACKMIZcjs.ma,Root:()=>Oe,ScrollDownArrow:()=>_chunkW4ACKMIZcjs.ea,ScrollUpArrow:()=>_chunkW4ACKMIZcjs.da,Separator:()=>_chunkW4ACKMIZcjs.sa,Shortcut:()=>_chunkW4ACKMIZcjs.ta,Submenu:()=>_chunkW4ACKMIZcjs.xa,SubmenuTrigger:()=>_chunkW4ACKMIZcjs.za,SubmenuTriggerIndicator:()=>_chunkW4ACKMIZcjs.ya,Subpage:()=>_chunkW4ACKMIZcjs.Aa,SubpageBack:()=>_chunkW4ACKMIZcjs.Ba,SubpageBackItem:()=>_chunkW4ACKMIZcjs.Ca,SubpageTrigger:()=>_chunkW4ACKMIZcjs.Da,Surface:()=>_chunkW4ACKMIZcjs.fa,Tree:()=>_chunkW4ACKMIZcjs.ua,TreeConnector:()=>_chunkW4ACKMIZcjs.va,TreeItem:()=>_chunkW4ACKMIZcjs.wa,Trigger:()=>Ee,useAsyncMenuCoordinator:()=>_chunkW4ACKMIZcjs.F,useDataList:()=>_chunkW4ACKMIZcjs.D,useMaybeAsyncMenuCoordinator:()=>_chunkW4ACKMIZcjs.G,useMaybeDataList:()=>_chunkW4ACKMIZcjs.E});var _popover = require('@base-ui/react/popover');var _react = require('react'); var u = _interopRequireWildcard(_react); var a = _interopRequireWildcard(_react);var _jsxruntime = require('react/jsx-runtime');var we=u.createContext(null);function Le(){let d=u.useContext(we);if(!d)throw new Error("ContextMenu components must be used within a ContextMenu.Root");return d}function Ge(d,i,p=!1){let o=p?10:0;return{getBoundingClientRect(){return DOMRect.fromRect({width:o,height:o,x:d,y:i})}}}function Oe(d){let{open:i,onOpenChange:p,defaultOpen:o=!1,virtualized:m=!1,items:n,onHighlightChange:e,disabled:k=!1,modal:v=!0,closeOnOutsidePress:S="pointerdown",onOpenChangeComplete:b,actionsRef:f,getResolvedId:r,idScope:E="surface",debug:g,children:C}=d,{store:l,focusOwnerStore:z,openChainStore:x,registerSurface:G,closeAll:R,virtualization:h,handleOpenChange:s,disabled:c,setDisabled:w,menuTreeResolver:V}=_chunkW4ACKMIZcjs.q.call(void 0, {onOpenChange:p,defaultOpen:o,virtualized:m,items:n,onHighlightChange:e,closeOnOutsidePress:S,disabled:k,getResolvedId:r,idScope:E}),I=u.useRef(null);u.useImperativeHandle(f,()=>({close:()=>{_optionalChain([I, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.close, 'call', _4 => _4()])},unmount:()=>{_optionalChain([I, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.unmount, 'call', _7 => _7()])},setDisabled:w}),[w]),l.useControlledProp("openProp",i);let y=l.useState("open"),[H,F]=u.useState(()=>Ge(0,0)),t=u.useCallback((M,O,po=!1)=>{F(Ge(M,O,po))},[]),P=u.useCallback(()=>{c||l.setOpen(!0)},[l,c]),T=u.useCallback(()=>{s(!1)},[s]),L=u.useCallback(M=>{!M&&l.context.clearSearchOnClose==="after-exit"&&(l.clearSearch(),l.setInputActive(!1)),M||(l.clearHighlight(),_optionalChain([l, 'access', _8 => _8.context, 'access', _9 => _9.onCloseComplete, 'optionalCall', _10 => _10()]),_optionalChain([l, 'access', _11 => _11.context, 'access', _12 => _12.onPopupCloseComplete, 'optionalCall', _13 => _13()])),_optionalChain([b, 'optionalCall', _14 => _14(M)])},[l,b]),X=u.useCallback((M,O)=>{s(M,O.reason,O.event)},[s]),ao=u.useMemo(()=>({setAnchorPosition:t,openMenu:P,closeMenu:T,disabled:c,open:y}),[t,P,T,c,y]);return _jsxruntime.jsx.call(void 0, we.Provider,{value:ao,children:_jsxruntime.jsx.call(void 0, _chunkW4ACKMIZcjs.N,{menuTreeResolver:V,store:l,focusOwnerStore:z,openChainStore:x,disabled:c,depth:0,closeAll:R,explicitTabBehavior:!0,registerSurface:G,virtualization:h,virtualAnchor:H,menuType:"context",closeOnOutsidePress:S,componentName:"context-menu",debug:g,children:_jsxruntime.jsx.call(void 0, _popover.Popover.Root,{open:y,onOpenChange:X,onOpenChangeComplete:L,modal:v,actionsRef:f?I:void 0,children:C})})})}var _userender = require('@base-ui/react/use-render');var D=(m=>(m.slot="bazzaui-context-menu-trigger",m.popupOpen="data-popup-open",m.pressed="data-pressed",m.disabled="data-disabled",m))(D||{});var jo=500,Uo=10,Zo={open:d=>d?{"data-popup-open":""}:null,pressed:d=>d?{"data-pressed":""}:null,disabled:d=>d?{"data-disabled":""}:null},Ee=a.forwardRef(function(i,p){let{disabled:o=!1,render:m,className:n,style:e,onContextMenu:k,onTouchStart:v,onTouchMove:S,onTouchEnd:b,onTouchCancel:f,children:r,...E}=i,{setAnchorPosition:g,openMenu:C,disabled:l,open:z}=Le(),x=o||l,[G,R]=a.useState(!1),h=a.useRef(null),s=a.useRef(null),c=a.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),R(!1)},[]);a.useEffect(()=>()=>{c()},[c]);let w=a.useCallback(t=>{_optionalChain([k, 'optionalCall', _15 => _15(t)]),!t.defaultPrevented&&(x||(t.preventDefault(),g(t.clientX,t.clientY,!1),C()))},[k,x,g,C]),V=a.useCallback(t=>{if(_optionalChain([v, 'optionalCall', _16 => _16(t)]),t.defaultPrevented||x)return;let P=t.touches[0];P&&(s.current={x:P.clientX,y:P.clientY},R(!0),h.current=setTimeout(()=>{s.current&&(g(s.current.x,s.current.y,!0),C(),R(!1),s.current=null)},jo))},[v,x,g,C]),I=a.useCallback(t=>{if(_optionalChain([S, 'optionalCall', _17 => _17(t)]),!s.current)return;let P=t.touches[0];if(!P)return;let T=P.clientX-s.current.x,L=P.clientY-s.current.y;Math.sqrt(T*T+L*L)>Uo&&(c(),s.current=null)},[S,c]),y=a.useCallback(t=>{_optionalChain([b, 'optionalCall', _18 => _18(t)]),c(),s.current=null},[b,c]),H=a.useCallback(t=>{_optionalChain([f, 'optionalCall', _19 => _19(t)]),c(),s.current=null},[f,c]),F=a.useMemo(()=>({open:z,pressed:G,disabled:x}),[z,G,x]);return _userender.useRender.call(void 0, {render:m,ref:p,state:F,stateAttributesMapping:Zo,props:{...E,"bazzaui-context-menu-trigger":"",onContextMenu:w,onTouchStart:V,onTouchMove:I,onTouchEnd:y,onTouchCancel:H,className:n,style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none",...e},children:r},defaultTagName:"div"})});var He=(e=>(e.slot="bazzaui-context-menu-arrow",e.open="data-open",e.closed="data-closed",e.side="data-side",e.align="data-align",e.uncentered="data-uncentered",e))(He||{});var Fe=(n=>(n.slot="bazzaui-context-menu-backdrop",n.open="data-open",n.closed="data-closed",n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n))(Fe||{});var Ne=(n=>(n.slot="bazzaui-context-menu-checkbox-item",n.checked="data-checked",n.unchecked="data-unchecked",n.highlighted="data-highlighted",n.disabled="data-disabled",n))(Ne||{}),Be= exports.ContextMenuCheckboxItemIndicatorDataAttributes =(o=>(o.slot="bazzaui-context-menu-checkbox-item-indicator",o.checked="data-checked",o.unchecked="data-unchecked",o))(Be||{});var je=(i=>(i.slot="bazzaui-context-menu-empty",i))(je||{});var Ue=(i=>(i.slot="bazzaui-context-menu-group",i))(Ue||{});var Ze=(i=>(i.slot="bazzaui-context-menu-group-label",i))(Ze||{});var Yo={slot:"bazzaui-context-menu-icon",open:"data-popup-open"};var Ye=(o=>(o.slot="bazzaui-context-menu-input",o.open="data-open",o.closed="data-closed",o))(Ye||{});var De=(o=>(o.slot="bazzaui-context-menu-item",o.highlighted="data-highlighted",o.disabled="data-disabled",o))(De||{});var Xe=(p=>(p.slot="bazzaui-context-menu-list",p.list="data-popup-menu-list",p))(Xe||{});var _e=(r=>(r.slot="bazzaui-context-menu-popup",r.open="data-open",r.closed="data-closed",r.side="data-side",r.align="data-align",r.startingStyle="data-starting-style",r.endingStyle="data-ending-style",r.instant="data-instant",r.focused="data-focused",r.hasOpenSubmenu="data-has-open-submenu",r.submenu="data-submenu",r.navigating="data-navigating",r))(_e||{});var We=(e=>(e.slot="bazzaui-context-menu-positioner",e.open="data-open",e.closed="data-closed",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e))(We||{});var qe=(p=>(p.slot="bazzaui-context-menu-radio-group",p.disabled="data-disabled",p))(qe||{});var Qe=(n=>(n.slot="bazzaui-context-menu-radio-item",n.checked="data-checked",n.unchecked="data-unchecked",n.highlighted="data-highlighted",n.disabled="data-disabled",n))(Qe||{}),Je= exports.ContextMenuRadioItemIndicatorDataAttributes =(o=>(o.slot="bazzaui-context-menu-radio-item-indicator",o.checked="data-checked",o.unchecked="data-unchecked",o))(Je||{});var Do={slotUp:"bazzaui-context-menu-scroll-up-arrow",slotDown:"bazzaui-context-menu-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Ke=(i=>(i.slot="bazzaui-context-menu-separator",i))(Ke||{});var $e=(p=>(p.slot="bazzaui-context-menu-shortcut",p.highlighted="data-highlighted",p))($e||{});var Ae=(e=>(e.slot="bazzaui-context-menu-submenu-trigger",e.submenuTrigger="data-submenu-trigger",e.popupOpen="data-popup-open",e.popupFocused="data-popup-focused",e.highlighted="data-highlighted",e.disabled="data-disabled",e))(Ae||{}),eo= exports.ContextMenuSubmenuTriggerIndicatorDataAttributes =(p=>(p.slot="bazzaui-context-menu-submenu-trigger-indicator",p.popupOpen="data-popup-open",p))(eo||{});var oo=(o=>(o.slot="bazzaui-context-menu-subpage-back",o.canGoBack="data-can-go-back",o.disabled="data-disabled",o))(oo||{});var no=(m=>(m.slot="bazzaui-context-menu-subpage-back-item",m.subpageBackItem="data-subpage-back-item",m.highlighted="data-highlighted",m.disabled="data-disabled",m))(no||{});var to=(e=>(e.slot="bazzaui-context-menu-subpage-trigger",e.subpageTrigger="data-subpage-trigger",e.popupOpen="data-popup-open",e.popupFocused="data-popup-focused",e.highlighted="data-highlighted",e.disabled="data-disabled",e))(to||{});var uo=(i=>(i.slot="bazzaui-context-menu-surface",i))(uo||{});exports.ContextMenu = Ve; exports.ContextMenuArrowDataAttributes = He; exports.ContextMenuBackdropDataAttributes = Fe; exports.ContextMenuCheckboxItemDataAttributes = Ne; exports.ContextMenuCheckboxItemIndicatorDataAttributes = Be; exports.ContextMenuEmptyDataAttributes = je; exports.ContextMenuGroupDataAttributes = Ue; exports.ContextMenuGroupLabelDataAttributes = Ze; exports.ContextMenuIconDataAttributes = Yo; exports.ContextMenuInputDataAttributes = Ye; exports.ContextMenuItemDataAttributes = De; exports.ContextMenuListCssVars = _chunkW4ACKMIZcjs.aa; exports.ContextMenuListDataAttributes = Xe; exports.ContextMenuPopupDataAttributes = _e; exports.ContextMenuPositionerCssVars = _chunkW4ACKMIZcjs.L; exports.ContextMenuPositionerDataAttributes = We; exports.ContextMenuRadioGroupDataAttributes = qe; exports.ContextMenuRadioGroupValue = _chunkW4ACKMIZcjs.ka; exports.ContextMenuRadioItemDataAttributes = Qe; exports.ContextMenuRadioItemIndicatorDataAttributes = Je; exports.ContextMenuScrollArrowDataAttributes = Do; exports.ContextMenuSeparatorDataAttributes = Ke; exports.ContextMenuShortcutDataAttributes = $e; exports.ContextMenuStore = _chunkXMZZ62VJcjs.y; exports.ContextMenuSubmenuTriggerDataAttributes = Ae; exports.ContextMenuSubmenuTriggerIndicatorDataAttributes = eo; exports.ContextMenuSubpageBackDataAttributes = oo; exports.ContextMenuSubpageBackItemDataAttributes = no; exports.ContextMenuSubpageTriggerDataAttributes = to; exports.ContextMenuSurfaceDataAttributes = uo; exports.ContextMenuTriggerDataAttributes = D; exports.DataListContext = _chunkW4ACKMIZcjs.C; exports.DataSurfaceContext = _chunkW4ACKMIZcjs.y; exports.commandScore = _chunkXMZZ62VJcjs.w; exports.defaultFilter = _chunkXMZZ62VJcjs.x; exports.defaultGetResolvedId = _chunkW4ACKMIZcjs.p; exports.defineRadioGroup = _chunkW4ACKMIZcjs.X; exports.isDisplayGroupNode = _chunkW4ACKMIZcjs.Y; exports.isDisplayRadioGroupNode = _chunkW4ACKMIZcjs.Z; exports.isDisplayRowNode = _chunkW4ACKMIZcjs.$; exports.isPopupMenuNode = _chunkW4ACKMIZcjs.o; exports.isTreeItemDef = _chunkW4ACKMIZcjs.H; exports.useAsyncMenuCoordinator = _chunkW4ACKMIZcjs.F; exports.useDataList = _chunkW4ACKMIZcjs.D; exports.useDataSurfaceContext = _chunkW4ACKMIZcjs.A; exports.useItem = _chunkW4ACKMIZcjs.O; exports.useItemContext = _chunkXMZZ62VJcjs.g; exports.useMaybeAsyncMenuCoordinator = _chunkW4ACKMIZcjs.G; exports.useMaybeDataList = _chunkW4ACKMIZcjs.E; exports.useMaybeDataSurfaceContext = _chunkW4ACKMIZcjs.B; exports.useMaybeItemContext = _chunkXMZZ62VJcjs.h; exports.useMaybeRootContext = _chunkW4ACKMIZcjs.e; exports.useMaybeSubmenuContext = _chunkW4ACKMIZcjs.h; exports.useMaybeSubpageContext = _chunkW4ACKMIZcjs.j; exports.useMaybeSubpageStack = _chunkW4ACKMIZcjs.m; exports.useMaybeSurfaceContext = _chunkXMZZ62VJcjs.q; exports.useRootContext = _chunkW4ACKMIZcjs.d; exports.useSubmenuContext = _chunkW4ACKMIZcjs.g; exports.useSubpageContext = _chunkW4ACKMIZcjs.i; exports.useSubpageStack = _chunkW4ACKMIZcjs.l; exports.useSurfaceContext = _chunkXMZZ62VJcjs.p;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkEYMK7XHCcjs = require('../chunk-EYMK7XHC.cjs');var _chunkXMZZ62VJcjs = require('../chunk-XMZZ62VJ.cjs');var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var Ve={};_chunkM4G6J7DPcjs.a.call(void 0, Ve,{Arrow:()=>_chunkEYMK7XHCcjs.s,Backdrop:()=>_chunkEYMK7XHCcjs.t,CheckboxItem:()=>_chunkEYMK7XHCcjs.ga,CheckboxItemIndicator:()=>_chunkEYMK7XHCcjs.ha,Empty:()=>_chunkEYMK7XHCcjs.U,FocusZone:()=>_chunkEYMK7XHCcjs.na,Footer:()=>_chunkEYMK7XHCcjs.oa,Group:()=>_chunkEYMK7XHCcjs.pa,GroupLabel:()=>_chunkEYMK7XHCcjs.W,GroupValue:()=>_chunkEYMK7XHCcjs.qa,Header:()=>_chunkEYMK7XHCcjs.ra,Icon:()=>_chunkEYMK7XHCcjs.T,Input:()=>_chunkEYMK7XHCcjs.V,Item:()=>_chunkEYMK7XHCcjs.ia,List:()=>_chunkEYMK7XHCcjs.ba,Popup:()=>_chunkEYMK7XHCcjs.J,Portal:()=>_chunkEYMK7XHCcjs.K,Positioner:()=>_chunkEYMK7XHCcjs.M,RadioGroup:()=>_chunkEYMK7XHCcjs.ja,RadioGroupValue:()=>_chunkEYMK7XHCcjs.ka,RadioItem:()=>_chunkEYMK7XHCcjs.la,RadioItemIndicator:()=>_chunkEYMK7XHCcjs.ma,Root:()=>Oe,ScrollDownArrow:()=>_chunkEYMK7XHCcjs.ea,ScrollUpArrow:()=>_chunkEYMK7XHCcjs.da,Separator:()=>_chunkEYMK7XHCcjs.sa,Shortcut:()=>_chunkEYMK7XHCcjs.ta,Submenu:()=>_chunkEYMK7XHCcjs.xa,SubmenuTrigger:()=>_chunkEYMK7XHCcjs.za,SubmenuTriggerIndicator:()=>_chunkEYMK7XHCcjs.ya,Subpage:()=>_chunkEYMK7XHCcjs.Aa,SubpageBack:()=>_chunkEYMK7XHCcjs.Ba,SubpageBackItem:()=>_chunkEYMK7XHCcjs.Ca,SubpageTrigger:()=>_chunkEYMK7XHCcjs.Da,Surface:()=>_chunkEYMK7XHCcjs.fa,Tree:()=>_chunkEYMK7XHCcjs.ua,TreeConnector:()=>_chunkEYMK7XHCcjs.va,TreeItem:()=>_chunkEYMK7XHCcjs.wa,Trigger:()=>Ee,useAsyncMenuCoordinator:()=>_chunkEYMK7XHCcjs.F,useDataList:()=>_chunkEYMK7XHCcjs.D,useMaybeAsyncMenuCoordinator:()=>_chunkEYMK7XHCcjs.G,useMaybeDataList:()=>_chunkEYMK7XHCcjs.E});var _popover = require('@base-ui/react/popover');var _react = require('react'); var u = _interopRequireWildcard(_react); var a = _interopRequireWildcard(_react);var _jsxruntime = require('react/jsx-runtime');var we=u.createContext(null);function Le(){let d=u.useContext(we);if(!d)throw new Error("ContextMenu components must be used within a ContextMenu.Root");return d}function Ge(d,i,p=!1){let o=p?10:0;return{getBoundingClientRect(){return DOMRect.fromRect({width:o,height:o,x:d,y:i})}}}function Oe(d){let{open:i,onOpenChange:p,defaultOpen:o=!1,virtualized:m=!1,items:n,onHighlightChange:e,disabled:k=!1,modal:v=!0,closeOnOutsidePress:S="pointerdown",onOpenChangeComplete:b,actionsRef:f,getResolvedId:r,idScope:E="surface",debug:g,children:C}=d,{store:l,focusOwnerStore:z,openChainStore:x,registerSurface:G,closeAll:R,virtualization:h,handleOpenChange:s,disabled:c,setDisabled:w,menuTreeResolver:V}=_chunkEYMK7XHCcjs.q.call(void 0, {onOpenChange:p,defaultOpen:o,virtualized:m,items:n,onHighlightChange:e,closeOnOutsidePress:S,disabled:k,getResolvedId:r,idScope:E}),I=u.useRef(null);u.useImperativeHandle(f,()=>({close:()=>{_optionalChain([I, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.close, 'call', _4 => _4()])},unmount:()=>{_optionalChain([I, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.unmount, 'call', _7 => _7()])},setDisabled:w}),[w]),l.useControlledProp("openProp",i);let y=l.useState("open"),[H,F]=u.useState(()=>Ge(0,0)),t=u.useCallback((M,O,po=!1)=>{F(Ge(M,O,po))},[]),P=u.useCallback(()=>{c||l.setOpen(!0)},[l,c]),T=u.useCallback(()=>{s(!1)},[s]),L=u.useCallback(M=>{!M&&l.context.clearSearchOnClose==="after-exit"&&(l.clearSearch(),l.setInputActive(!1)),M||(l.clearHighlight(),_optionalChain([l, 'access', _8 => _8.context, 'access', _9 => _9.onCloseComplete, 'optionalCall', _10 => _10()]),_optionalChain([l, 'access', _11 => _11.context, 'access', _12 => _12.onPopupCloseComplete, 'optionalCall', _13 => _13()])),_optionalChain([b, 'optionalCall', _14 => _14(M)])},[l,b]),X=u.useCallback((M,O)=>{s(M,O.reason,O.event)},[s]),ao=u.useMemo(()=>({setAnchorPosition:t,openMenu:P,closeMenu:T,disabled:c,open:y}),[t,P,T,c,y]);return _jsxruntime.jsx.call(void 0, we.Provider,{value:ao,children:_jsxruntime.jsx.call(void 0, _chunkEYMK7XHCcjs.N,{menuTreeResolver:V,store:l,focusOwnerStore:z,openChainStore:x,disabled:c,depth:0,closeAll:R,explicitTabBehavior:!0,registerSurface:G,virtualization:h,virtualAnchor:H,menuType:"context",closeOnOutsidePress:S,componentName:"context-menu",debug:g,children:_jsxruntime.jsx.call(void 0, _popover.Popover.Root,{open:y,onOpenChange:X,onOpenChangeComplete:L,modal:v,actionsRef:f?I:void 0,children:C})})})}var _userender = require('@base-ui/react/use-render');var D=(m=>(m.slot="bazzaui-context-menu-trigger",m.popupOpen="data-popup-open",m.pressed="data-pressed",m.disabled="data-disabled",m))(D||{});var jo=500,Uo=10,Zo={open:d=>d?{"data-popup-open":""}:null,pressed:d=>d?{"data-pressed":""}:null,disabled:d=>d?{"data-disabled":""}:null},Ee=a.forwardRef(function(i,p){let{disabled:o=!1,render:m,className:n,style:e,onContextMenu:k,onTouchStart:v,onTouchMove:S,onTouchEnd:b,onTouchCancel:f,children:r,...E}=i,{setAnchorPosition:g,openMenu:C,disabled:l,open:z}=Le(),x=o||l,[G,R]=a.useState(!1),h=a.useRef(null),s=a.useRef(null),c=a.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),R(!1)},[]);a.useEffect(()=>()=>{c()},[c]);let w=a.useCallback(t=>{_optionalChain([k, 'optionalCall', _15 => _15(t)]),!t.defaultPrevented&&(x||(t.preventDefault(),g(t.clientX,t.clientY,!1),C()))},[k,x,g,C]),V=a.useCallback(t=>{if(_optionalChain([v, 'optionalCall', _16 => _16(t)]),t.defaultPrevented||x)return;let P=t.touches[0];P&&(s.current={x:P.clientX,y:P.clientY},R(!0),h.current=setTimeout(()=>{s.current&&(g(s.current.x,s.current.y,!0),C(),R(!1),s.current=null)},jo))},[v,x,g,C]),I=a.useCallback(t=>{if(_optionalChain([S, 'optionalCall', _17 => _17(t)]),!s.current)return;let P=t.touches[0];if(!P)return;let T=P.clientX-s.current.x,L=P.clientY-s.current.y;Math.sqrt(T*T+L*L)>Uo&&(c(),s.current=null)},[S,c]),y=a.useCallback(t=>{_optionalChain([b, 'optionalCall', _18 => _18(t)]),c(),s.current=null},[b,c]),H=a.useCallback(t=>{_optionalChain([f, 'optionalCall', _19 => _19(t)]),c(),s.current=null},[f,c]),F=a.useMemo(()=>({open:z,pressed:G,disabled:x}),[z,G,x]);return _userender.useRender.call(void 0, {render:m,ref:p,state:F,stateAttributesMapping:Zo,props:{...E,"bazzaui-context-menu-trigger":"",onContextMenu:w,onTouchStart:V,onTouchMove:I,onTouchEnd:y,onTouchCancel:H,className:n,style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none",...e},children:r},defaultTagName:"div"})});var He=(e=>(e.slot="bazzaui-context-menu-arrow",e.open="data-open",e.closed="data-closed",e.side="data-side",e.align="data-align",e.uncentered="data-uncentered",e))(He||{});var Fe=(n=>(n.slot="bazzaui-context-menu-backdrop",n.open="data-open",n.closed="data-closed",n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n))(Fe||{});var Ne=(n=>(n.slot="bazzaui-context-menu-checkbox-item",n.checked="data-checked",n.unchecked="data-unchecked",n.highlighted="data-highlighted",n.disabled="data-disabled",n))(Ne||{}),Be= exports.ContextMenuCheckboxItemIndicatorDataAttributes =(o=>(o.slot="bazzaui-context-menu-checkbox-item-indicator",o.checked="data-checked",o.unchecked="data-unchecked",o))(Be||{});var je=(i=>(i.slot="bazzaui-context-menu-empty",i))(je||{});var Ue=(i=>(i.slot="bazzaui-context-menu-group",i))(Ue||{});var Ze=(i=>(i.slot="bazzaui-context-menu-group-label",i))(Ze||{});var Yo={slot:"bazzaui-context-menu-icon",open:"data-popup-open"};var Ye=(o=>(o.slot="bazzaui-context-menu-input",o.open="data-open",o.closed="data-closed",o))(Ye||{});var De=(o=>(o.slot="bazzaui-context-menu-item",o.highlighted="data-highlighted",o.disabled="data-disabled",o))(De||{});var Xe=(p=>(p.slot="bazzaui-context-menu-list",p.list="data-popup-menu-list",p))(Xe||{});var _e=(r=>(r.slot="bazzaui-context-menu-popup",r.open="data-open",r.closed="data-closed",r.side="data-side",r.align="data-align",r.startingStyle="data-starting-style",r.endingStyle="data-ending-style",r.instant="data-instant",r.focused="data-focused",r.hasOpenSubmenu="data-has-open-submenu",r.submenu="data-submenu",r.navigating="data-navigating",r))(_e||{});var We=(e=>(e.slot="bazzaui-context-menu-positioner",e.open="data-open",e.closed="data-closed",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e))(We||{});var qe=(p=>(p.slot="bazzaui-context-menu-radio-group",p.disabled="data-disabled",p))(qe||{});var Qe=(n=>(n.slot="bazzaui-context-menu-radio-item",n.checked="data-checked",n.unchecked="data-unchecked",n.highlighted="data-highlighted",n.disabled="data-disabled",n))(Qe||{}),Je= exports.ContextMenuRadioItemIndicatorDataAttributes =(o=>(o.slot="bazzaui-context-menu-radio-item-indicator",o.checked="data-checked",o.unchecked="data-unchecked",o))(Je||{});var Do={slotUp:"bazzaui-context-menu-scroll-up-arrow",slotDown:"bazzaui-context-menu-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Ke=(i=>(i.slot="bazzaui-context-menu-separator",i))(Ke||{});var $e=(p=>(p.slot="bazzaui-context-menu-shortcut",p.highlighted="data-highlighted",p))($e||{});var Ae=(e=>(e.slot="bazzaui-context-menu-submenu-trigger",e.submenuTrigger="data-submenu-trigger",e.popupOpen="data-popup-open",e.popupFocused="data-popup-focused",e.highlighted="data-highlighted",e.disabled="data-disabled",e))(Ae||{}),eo= exports.ContextMenuSubmenuTriggerIndicatorDataAttributes =(p=>(p.slot="bazzaui-context-menu-submenu-trigger-indicator",p.popupOpen="data-popup-open",p))(eo||{});var oo=(o=>(o.slot="bazzaui-context-menu-subpage-back",o.canGoBack="data-can-go-back",o.disabled="data-disabled",o))(oo||{});var no=(m=>(m.slot="bazzaui-context-menu-subpage-back-item",m.subpageBackItem="data-subpage-back-item",m.highlighted="data-highlighted",m.disabled="data-disabled",m))(no||{});var to=(e=>(e.slot="bazzaui-context-menu-subpage-trigger",e.subpageTrigger="data-subpage-trigger",e.popupOpen="data-popup-open",e.popupFocused="data-popup-focused",e.highlighted="data-highlighted",e.disabled="data-disabled",e))(to||{});var uo=(i=>(i.slot="bazzaui-context-menu-surface",i))(uo||{});exports.ContextMenu = Ve; exports.ContextMenuArrowDataAttributes = He; exports.ContextMenuBackdropDataAttributes = Fe; exports.ContextMenuCheckboxItemDataAttributes = Ne; exports.ContextMenuCheckboxItemIndicatorDataAttributes = Be; exports.ContextMenuEmptyDataAttributes = je; exports.ContextMenuGroupDataAttributes = Ue; exports.ContextMenuGroupLabelDataAttributes = Ze; exports.ContextMenuIconDataAttributes = Yo; exports.ContextMenuInputDataAttributes = Ye; exports.ContextMenuItemDataAttributes = De; exports.ContextMenuListCssVars = _chunkEYMK7XHCcjs.aa; exports.ContextMenuListDataAttributes = Xe; exports.ContextMenuPopupDataAttributes = _e; exports.ContextMenuPositionerCssVars = _chunkEYMK7XHCcjs.L; exports.ContextMenuPositionerDataAttributes = We; exports.ContextMenuRadioGroupDataAttributes = qe; exports.ContextMenuRadioGroupValue = _chunkEYMK7XHCcjs.ka; exports.ContextMenuRadioItemDataAttributes = Qe; exports.ContextMenuRadioItemIndicatorDataAttributes = Je; exports.ContextMenuScrollArrowDataAttributes = Do; exports.ContextMenuSeparatorDataAttributes = Ke; exports.ContextMenuShortcutDataAttributes = $e; exports.ContextMenuStore = _chunkXMZZ62VJcjs.y; exports.ContextMenuSubmenuTriggerDataAttributes = Ae; exports.ContextMenuSubmenuTriggerIndicatorDataAttributes = eo; exports.ContextMenuSubpageBackDataAttributes = oo; exports.ContextMenuSubpageBackItemDataAttributes = no; exports.ContextMenuSubpageTriggerDataAttributes = to; exports.ContextMenuSurfaceDataAttributes = uo; exports.ContextMenuTriggerDataAttributes = D; exports.DataListContext = _chunkEYMK7XHCcjs.C; exports.DataSurfaceContext = _chunkEYMK7XHCcjs.y; exports.commandScore = _chunkXMZZ62VJcjs.w; exports.defaultFilter = _chunkXMZZ62VJcjs.x; exports.defaultGetResolvedId = _chunkEYMK7XHCcjs.p; exports.defineRadioGroup = _chunkEYMK7XHCcjs.X; exports.isDisplayGroupNode = _chunkEYMK7XHCcjs.Y; exports.isDisplayRadioGroupNode = _chunkEYMK7XHCcjs.Z; exports.isDisplayRowNode = _chunkEYMK7XHCcjs.$; exports.isPopupMenuNode = _chunkEYMK7XHCcjs.o; exports.isTreeItemDef = _chunkEYMK7XHCcjs.H; exports.useAsyncMenuCoordinator = _chunkEYMK7XHCcjs.F; exports.useDataList = _chunkEYMK7XHCcjs.D; exports.useDataSurfaceContext = _chunkEYMK7XHCcjs.A; exports.useItem = _chunkEYMK7XHCcjs.O; exports.useItemContext = _chunkXMZZ62VJcjs.g; exports.useMaybeAsyncMenuCoordinator = _chunkEYMK7XHCcjs.G; exports.useMaybeDataList = _chunkEYMK7XHCcjs.E; exports.useMaybeDataSurfaceContext = _chunkEYMK7XHCcjs.B; exports.useMaybeItemContext = _chunkXMZZ62VJcjs.h; exports.useMaybeRootContext = _chunkEYMK7XHCcjs.e; exports.useMaybeSubmenuContext = _chunkEYMK7XHCcjs.h; exports.useMaybeSubpageContext = _chunkEYMK7XHCcjs.j; exports.useMaybeSubpageStack = _chunkEYMK7XHCcjs.m; exports.useMaybeSurfaceContext = _chunkXMZZ62VJcjs.q; exports.useRootContext = _chunkEYMK7XHCcjs.d; exports.useSubmenuContext = _chunkEYMK7XHCcjs.g; exports.useSubpageContext = _chunkEYMK7XHCcjs.i; exports.useSubpageStack = _chunkEYMK7XHCcjs.l; exports.useSurfaceContext = _chunkXMZZ62VJcjs.p;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|