@bazza-ui/react 0.0.0 → 0.1.0-canary.10

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.
Files changed (113) hide show
  1. package/dist/ListboxStore-BYBpGrOz.d.ts +453 -0
  2. package/dist/ListboxStore-nmorsoqX.d.cts +453 -0
  3. package/dist/chunk-4C666HHU.js +2 -0
  4. package/dist/chunk-4C666HHU.js.map +1 -0
  5. package/dist/chunk-5T5B5SPR.cjs +2 -0
  6. package/dist/chunk-5T5B5SPR.cjs.map +1 -0
  7. package/dist/chunk-A4Z5BY7H.js +2 -0
  8. package/dist/chunk-A4Z5BY7H.js.map +1 -0
  9. package/dist/chunk-BFOY762U.js +2 -0
  10. package/dist/chunk-BFOY762U.js.map +1 -0
  11. package/dist/chunk-IT372NHF.js +2 -0
  12. package/dist/chunk-IT372NHF.js.map +1 -0
  13. package/dist/chunk-JFEVUUPC.cjs +2 -0
  14. package/dist/chunk-JFEVUUPC.cjs.map +1 -0
  15. package/dist/chunk-KO3DXT3Y.js +2 -0
  16. package/dist/chunk-KO3DXT3Y.js.map +1 -0
  17. package/dist/chunk-LXXK4S4Q.js +2 -0
  18. package/dist/chunk-LXXK4S4Q.js.map +1 -0
  19. package/dist/chunk-M4G6J7DP.cjs +2 -0
  20. package/dist/chunk-M4G6J7DP.cjs.map +1 -0
  21. package/dist/chunk-SCDHQZFI.cjs +2 -0
  22. package/dist/chunk-SCDHQZFI.cjs.map +1 -0
  23. package/dist/chunk-W4ACKMIZ.cjs +2 -0
  24. package/dist/chunk-W4ACKMIZ.cjs.map +1 -0
  25. package/dist/chunk-XMZZ62VJ.cjs +2 -0
  26. package/dist/chunk-XMZZ62VJ.cjs.map +1 -0
  27. package/dist/combobox/index.cjs +2 -0
  28. package/dist/combobox/index.cjs.map +1 -0
  29. package/dist/combobox/index.d.cts +1066 -0
  30. package/dist/combobox/index.d.ts +1066 -0
  31. package/dist/combobox/index.js +2 -0
  32. package/dist/combobox/index.js.map +1 -0
  33. package/dist/command-menu/index.cjs +2 -0
  34. package/dist/command-menu/index.cjs.map +1 -0
  35. package/dist/command-menu/index.d.cts +154 -0
  36. package/dist/command-menu/index.d.ts +154 -0
  37. package/dist/command-menu/index.js +2 -0
  38. package/dist/command-menu/index.js.map +1 -0
  39. package/dist/command-score-CTJ9NV6n.d.cts +23 -0
  40. package/dist/command-score-CTJ9NV6n.d.ts +23 -0
  41. package/dist/context-menu/index.cjs +2 -0
  42. package/dist/context-menu/index.cjs.map +1 -0
  43. package/dist/context-menu/index.d.cts +672 -0
  44. package/dist/context-menu/index.d.ts +672 -0
  45. package/dist/context-menu/index.js +2 -0
  46. package/dist/context-menu/index.js.map +1 -0
  47. package/dist/dropdown-menu/index.cjs +2 -0
  48. package/dist/dropdown-menu/index.cjs.map +1 -0
  49. package/dist/dropdown-menu/index.d.cts +699 -0
  50. package/dist/dropdown-menu/index.d.ts +699 -0
  51. package/dist/dropdown-menu/index.js +2 -0
  52. package/dist/dropdown-menu/index.js.map +1 -0
  53. package/dist/events-DOGItflK.d.ts +1776 -0
  54. package/dist/events-DPsuhBln.d.cts +1776 -0
  55. package/dist/input-C95v6jB0.d.cts +46 -0
  56. package/dist/input-CYweYB_i.d.ts +46 -0
  57. package/dist/internal/listbox/index.cjs +2 -0
  58. package/dist/internal/listbox/index.cjs.map +1 -0
  59. package/dist/internal/listbox/index.d.cts +272 -0
  60. package/dist/internal/listbox/index.d.ts +272 -0
  61. package/dist/internal/listbox/index.js +2 -0
  62. package/dist/internal/listbox/index.js.map +1 -0
  63. package/dist/internal/popup-menu/index.cjs +2 -0
  64. package/dist/internal/popup-menu/index.cjs.map +1 -0
  65. package/dist/internal/popup-menu/index.d.cts +238 -0
  66. package/dist/internal/popup-menu/index.d.ts +238 -0
  67. package/dist/internal/popup-menu/index.js +2 -0
  68. package/dist/internal/popup-menu/index.js.map +1 -0
  69. package/dist/items-B6HeFO_8.d.cts +37 -0
  70. package/dist/items-B6HeFO_8.d.ts +37 -0
  71. package/dist/kbd/index.cjs +2 -0
  72. package/dist/kbd/index.cjs.map +1 -0
  73. package/dist/kbd/index.d.cts +61 -0
  74. package/dist/kbd/index.d.ts +61 -0
  75. package/dist/kbd/index.js +2 -0
  76. package/dist/kbd/index.js.map +1 -0
  77. package/dist/loaders/index.cjs +2 -0
  78. package/dist/loaders/index.cjs.map +1 -0
  79. package/dist/loaders/index.d.cts +363 -0
  80. package/dist/loaders/index.d.ts +363 -0
  81. package/dist/loaders/index.js +2 -0
  82. package/dist/loaders/index.js.map +1 -0
  83. package/dist/loading-C6WZGUc3.d.cts +29 -0
  84. package/dist/loading-CC4n55sR.d.ts +29 -0
  85. package/dist/resolve-BYm41YfG.d.ts +406 -0
  86. package/dist/resolve-Dk_fAKb2.d.cts +406 -0
  87. package/dist/scroll-arrow-B81wZTZ2.d.cts +544 -0
  88. package/dist/scroll-arrow-CNd0tgME.d.ts +544 -0
  89. package/dist/select/index.cjs +2 -0
  90. package/dist/select/index.cjs.map +1 -0
  91. package/dist/select/index.d.cts +985 -0
  92. package/dist/select/index.d.ts +985 -0
  93. package/dist/select/index.js +2 -0
  94. package/dist/select/index.js.map +1 -0
  95. package/dist/separator-BiySI623.d.cts +275 -0
  96. package/dist/separator-De8l8DKO.d.ts +275 -0
  97. package/dist/surface-context-ClmxshBW.d.ts +14 -0
  98. package/dist/surface-context-DF-L-30G.d.cts +14 -0
  99. package/dist/type-guards-BC2B6bVi.d.cts +350 -0
  100. package/dist/type-guards-ybcHBB3C.d.ts +350 -0
  101. package/dist/types-DT4FOOa2.d.cts +51 -0
  102. package/dist/types-DT4FOOa2.d.ts +51 -0
  103. package/dist/use-listbox-item-NzZuY34-.d.cts +212 -0
  104. package/dist/use-listbox-item-NzZuY34-.d.ts +212 -0
  105. package/dist/video-player/index.cjs +3 -0
  106. package/dist/video-player/index.cjs.map +1 -0
  107. package/dist/video-player/index.d.cts +1391 -0
  108. package/dist/video-player/index.d.ts +1391 -0
  109. package/dist/video-player/index.js +3 -0
  110. package/dist/video-player/index.js.map +1 -0
  111. package/package.json +66 -12
  112. package/dist/index.d.ts +0 -2
  113. package/dist/index.js +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/select/index.cjs","../../src/select/index.parts.ts","../../src/select/item/item.tsx","../../src/select/contexts/select-context.ts","../../src/select/item/item.data-attrs.ts","../../src/select/item/item-context.ts"],"names":["index_parts_exports","__export","PopupMenuArrow","PopupMenuBackdrop","PopupMenuEmpty","PopupMenuGroup","PopupMenuGroupLabel","PopupMenuIcon","PopupMenuInput","SelectItem","SelectItemIndicator","SelectItemLabel","PopupMenuList","SelectPopup","PopupMenuPortal","SelectPositioner","SelectRoot","PopupMenuScrollDownArrow","PopupMenuScrollUpArrow","PopupMenuSeparator","SelectSurface","SelectTrigger","SelectValue","SelectContext","useSelectContext","context","useMaybeSelectContext","SelectItemDataAttributes","SelectItemContext","useSelectItemContext","useMaybeSelectItemContext","stateAttributesMapping","value","SelectItemImpl","props","forwardedRef","textValueProp","keywordsProp","disabled","onSelect","forceMount","render","className","style","onClick","onPointerDown","onPointerMove","children","rest","selectContext","serializedValue","stringifyAsValue","generatedItemId","listboxId"],"mappings":"AAAA,4/BAA0C,yDAA2F,yDAAiO,yDAAmF,yDAA2C,ICApeA,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,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,mBAAAA,CAAA,IAAA,CAAA,CAAA,CAAA,E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,KAAA,CAAAH,CAAAA,CACA,SAAA,CAAWI,CAAAA,CACX,QAAA,CAAUC,CAAAA,CACV,QAAA,CAAAC,CAAAA,CAAW,CAAA,CAAA,CACX,QAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAA,CAAA,CACb,MAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,GAAGC,CACL,CAAA,CAAId,CAAAA,CAEEe,CAAAA,CAAgBzB,CAAAA,CAAwB,CAAA,CAGxC0B,CAAAA,CAAwB,CAAA,CAAA,OAAA,CAC5B,CAAA,CAAA,EAAMC,iCAAAA,CAAiBnB,CAAOiB,CAAAA,CAAc,iBAAiB,CAAA,CAC7D,CAACjB,CAAAA,CAAOiB,CAAAA,CAAc,iBAAiB,CACzC,CAAA,CAKMG,CAAAA,CAAwB,CAAA,CAAA,KAAA,CAAM,CAAA,CAC9BC,CAAAA,CACJrB,CAAAA,GAAU,IAAA,CAAO,CAAA,aAAA,EAAgBoB,CAAe,CAAA,CAAA","file":"/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/select/index.cjs","sourcesContent":[null,"// ============================================================================\n// Select Parts\n// ============================================================================\n// Re-exports shared components from internal/popup-menu with Select-specific\n// Root, Trigger, Value, 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 // Trigger components\n PopupMenuIcon as Icon,\n PopupMenuInput as Input,\n PopupMenuList as List,\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 { SelectItem as Item } from './item/item.js'\nexport { SelectItemIndicator as ItemIndicator } from './item-indicator/item-indicator.js'\nexport { SelectItemLabel as ItemLabel } from './item-label/item-label.js'\n// Select-specific Popup with alignItemWithTriggerActive state\nexport type { SelectPopupProps, SelectPopupState } from './popup/popup.js'\nexport { SelectPopup as Popup } from './popup/popup.js'\n// Custom Select Positioner with alignItemWithTrigger support\nexport { SelectPositioner as Positioner } from './positioner/positioner.js'\n// Select-specific components\nexport { SelectRoot as Root } from './root/root.js'\n// Select-specific Surface with alignItemWithTrigger auto-highlight support\nexport { SelectSurface as Surface } from './surface/surface.js'\nexport { SelectTrigger as Trigger } from './trigger/trigger.js'\nexport { SelectValue as Value } from './value/value.js'\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { usePopupMenuItem } from '../../internal/popup-menu/index.js'\nimport {\n compareItemEquality,\n itemIncludes,\n removeItem,\n} from '../../utils/item-equality.js'\nimport { mergeKeywords, resolveItemFromItems } from '../../utils/items.js'\nimport {\n resolveLabel,\n stringifyAsValue,\n} from '../../utils/resolve-value-label.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useSelectContext } from '../contexts/select-context.js'\nimport { SelectItemDataAttributes } from './item.data-attrs.js'\nimport {\n SelectItemContext,\n type SelectItemContextValue,\n} from './item-context.js'\n\nexport { SelectItemDataAttributes }\n\nexport interface SelectItemState extends Record<string, unknown> {\n /**\n * Whether the item is highlighted (via keyboard or pointer).\n */\n highlighted: boolean\n /**\n * Whether the item is disabled.\n */\n disabled: boolean\n /**\n * Whether the item is currently selected.\n */\n selected: boolean\n first: boolean\n last: boolean\n firstInGroup: boolean\n lastInGroup: boolean\n}\n\nexport interface SelectItemProps<Value = unknown>\n extends ComponentProps<'div', SelectItem.State> {\n /**\n * The value of this item. Required and must be unique within the Select.\n * Can be a primitive or an object.\n *\n * Pass `null` to render a clearable item: selecting it clears the selection\n * and its label is used as the trigger placeholder (Base UI parity).\n */\n value: Value | null\n\n /**\n * Text value to use for display in Select.Value when this item is selected.\n * If not provided, the text content of the item will be used.\n * For object values, this can be auto-detected from `{ label }` shape.\n */\n textValue?: string\n\n /**\n * Additional keywords to match against when filtering.\n * Useful for aliases or synonyms.\n */\n keywords?: string[]\n\n /**\n * Whether this item is disabled.\n * Disabled items are not selectable and are skipped during keyboard navigation.\n */\n disabled?: boolean\n\n /**\n * Callback when this item is selected.\n */\n onSelect?: () => void\n\n /**\n * Whether to force render this item regardless of filter results.\n * @default false\n */\n forceMount?: boolean\n}\n\nconst stateAttributesMapping = {\n highlighted: (value: unknown): Record<string, string> | null =>\n value ? { [SelectItemDataAttributes.highlighted]: '' } : null,\n disabled: (value: unknown): Record<string, string> | null =>\n value ? { [SelectItemDataAttributes.disabled]: '' } : null,\n selected: (value: unknown): Record<string, string> | null =>\n value ? { [SelectItemDataAttributes.selected]: '' } : null,\n first: (value: unknown) =>\n value ? { [SelectItemDataAttributes.first]: '' } : null,\n last: (value: unknown) =>\n value ? { [SelectItemDataAttributes.last]: '' } : null,\n firstInGroup: (value: unknown) =>\n value ? { [SelectItemDataAttributes.firstInGroup]: '' } : null,\n lastInGroup: (value: unknown) =>\n value ? { [SelectItemDataAttributes.lastInGroup]: '' } : null,\n}\n\n/**\n * A selectable item in the select dropdown.\n * Renders a `<div>` element with role=\"option\".\n *\n * @template Value - The type of the item value (can be a primitive or object)\n */\nfunction SelectItemImpl<Value = unknown>(\n props: SelectItemProps<Value>,\n forwardedRef: React.ForwardedRef<HTMLDivElement>,\n) {\n const {\n value,\n textValue: textValueProp,\n keywords: keywordsProp,\n disabled = false,\n onSelect,\n forceMount = false,\n render,\n className,\n style,\n onClick,\n onPointerDown,\n onPointerMove,\n children,\n ...rest\n } = props\n\n const selectContext = useSelectContext<Value>()\n\n // Serialize value for registry key and internal lookups\n const serializedValue = React.useMemo(\n () => stringifyAsValue(value, selectContext.itemToStringValue),\n [value, selectContext.itemToStringValue],\n )\n\n // A null value serializes to '' which the listbox treats as \"no id\" and skips\n // registration. Give a clearable (null) item an explicit id so it still\n // registers and is selectable; its label still feeds filtering via keywords.\n const generatedItemId = React.useId()\n const listboxId =\n value === null ? `select-clear-${generatedItemId}` : undefined\n\n // Resolve the item entry (label + keywords) from the items prop, for\n // auto-populating textValue and filter keywords.\n const itemFromItems = React.useMemo(\n () => resolveItemFromItems(selectContext.items, serializedValue),\n [selectContext.items, serializedValue],\n )\n const labelFromItems = itemFromItems?.label\n\n // Auto-resolve label from object value shape { label }\n const labelFromObjectValue = React.useMemo(\n () => resolveLabel(value, selectContext.itemToStringLabel),\n [value, selectContext.itemToStringLabel],\n )\n\n // Auto-populate textValue: explicit prop > label from items (if string) > label from object > undefined\n const textValue = React.useMemo(() => {\n if (textValueProp !== undefined) return textValueProp\n if (typeof labelFromItems === 'string') return labelFromItems\n // For object values, use the resolved label\n if (labelFromObjectValue && labelFromObjectValue !== serializedValue) {\n return labelFromObjectValue\n }\n return undefined\n }, [textValueProp, labelFromItems, labelFromObjectValue, serializedValue])\n\n // Auto-add the label plus any items[].keywords to the filter keywords.\n const keywords = React.useMemo(() => {\n const labelStr =\n typeof labelFromItems === 'string'\n ? labelFromItems\n : labelFromObjectValue && labelFromObjectValue !== serializedValue\n ? labelFromObjectValue\n : undefined\n return mergeKeywords(keywordsProp, [\n labelStr,\n ...(itemFromItems?.keywords ?? []),\n ])\n }, [\n keywordsProp,\n labelFromItems,\n labelFromObjectValue,\n serializedValue,\n itemFromItems,\n ])\n\n const textRef = React.useRef<string | undefined>(textValue)\n\n // Track if this item is selected using custom equality.\n // A `null` item is selected when there is no selection; an empty string is\n // still treated as \"no selection\" and never matches an item.\n const selected = selectContext.multiple\n ? itemIncludes(\n selectContext.values,\n value,\n selectContext.isItemEqualToValue,\n )\n : selectContext.value !== '' &&\n compareItemEquality(\n selectContext.value,\n value,\n selectContext.isItemEqualToValue,\n )\n\n // Determine close behavior: single-select closes, multi-select stays open\n const closeOnClick = !selectContext.multiple\n\n const item = usePopupMenuItem({\n id: listboxId,\n value: serializedValue,\n keywords,\n disabled,\n forceMount,\n closeOnClick,\n children,\n })\n\n // Register the select handler that updates the value\n React.useEffect(() => {\n const handleSelect = () => {\n if (disabled) return\n\n if (selectContext.multiple) {\n // A null item clears all selections in multi-select mode.\n if (value == null) {\n selectContext.onValuesChange([])\n } else {\n // Toggle value in array using custom equality\n const newValues = selected\n ? removeItem(\n selectContext.values,\n value,\n selectContext.isItemEqualToValue,\n )\n : [...selectContext.values, value]\n selectContext.onValuesChange(newValues)\n }\n } else {\n // Set single value (null clears the selection)\n selectContext.onValueChange(value)\n }\n\n onSelect?.()\n }\n return item.registerSelect(handleSelect)\n }, [disabled, selectContext, value, selected, onSelect, item])\n\n // Register item text for Select.Value display\n React.useEffect(() => {\n // Use textValue if provided, otherwise extract from children\n const text = textRef.current\n if (text) {\n return selectContext.registerItemText(serializedValue, text)\n }\n }, [serializedValue, selectContext])\n\n // Update text ref when children might have changed (for extraction)\n React.useEffect(() => {\n if (!textValue && typeof children === 'string') {\n textRef.current = children\n selectContext.registerItemText(serializedValue, children)\n }\n }, [children, textValue, serializedValue, selectContext])\n\n const state: SelectItem.State = React.useMemo(\n () => ({\n highlighted: item.isHighlighted,\n disabled,\n selected,\n first: item.positional.first,\n last: item.positional.last,\n firstInGroup: item.positional.firstInGroup,\n lastInGroup: item.positional.lastInGroup,\n }),\n [item.isHighlighted, disabled, selected, item.positional],\n )\n\n const itemContextValue: SelectItemContextValue<Value> = React.useMemo(\n () => ({\n id: item.id,\n value,\n textValue,\n highlighted: item.isHighlighted,\n disabled,\n selected,\n }),\n [item.id, value, textValue, item.isHighlighted, disabled, selected],\n )\n\n // Merge user-provided handlers with item handlers\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented) {\n item.handlers.onClick(event)\n }\n },\n [onClick, item.handlers],\n )\n\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent<HTMLDivElement>) => {\n item.handlers.onPointerDown(event)\n onPointerDown?.(event)\n },\n [item.handlers, onPointerDown],\n )\n\n const handlePointerMove = React.useCallback(\n (event: React.PointerEvent<HTMLDivElement>) => {\n onPointerMove?.(event)\n if (!event.defaultPrevented) {\n item.handlers.onPointerMove(event)\n }\n },\n [onPointerMove, item.handlers],\n )\n\n const element = useRender({\n render,\n ref: [item.ref, item.rowRef, forwardedRef],\n state,\n stateAttributesMapping,\n props: {\n ...rest,\n [SelectItemDataAttributes.slot]: '',\n id: item.id,\n role: 'option',\n tabIndex: -1,\n 'aria-selected': selected,\n 'aria-disabled': disabled || undefined,\n className,\n style,\n onClick: handleClick,\n onPointerMove: handlePointerMove,\n onPointerDown: handlePointerDown,\n children,\n },\n enabled: item.isVisible,\n defaultTagName: 'div',\n })\n\n if (!item.isVisible) {\n return null\n }\n\n return (\n <SelectItemContext.Provider\n value={itemContextValue as SelectItemContextValue}\n >\n {element}\n </SelectItemContext.Provider>\n )\n}\n\nexport const SelectItem = React.forwardRef(SelectItemImpl) as <Value = unknown>(\n props: SelectItemProps<Value> & React.RefAttributes<HTMLDivElement>,\n) => React.ReactElement | null\n\nexport namespace SelectItem {\n export type State = SelectItemState\n export interface Props<Value = unknown> extends SelectItemProps<Value> {}\n}\n","'use client'\n\nimport * as React from 'react'\nimport type { ItemEqualityComparer } from '../../utils/item-equality.js'\nimport type { Items } from '../../utils/items.js'\n\n// ============================================================================\n// Select Context\n// ============================================================================\n// Provides value management and form integration for Select components.\n// Separate from PopupMenuContext to handle Select-specific concerns.\n\n/**\n * Item text registry for displaying selected values.\n * Maps serialized item value to its text content.\n */\nexport type ItemTextRegistry = Map<string, string>\n\n/**\n * Context value for Select components.\n * Provides value state, callbacks, and form integration.\n *\n * @template Value - The type of the select value (can be a primitive or object)\n */\nexport interface SelectContextValue<Value = unknown> {\n // ===== Selection State =====\n /** Whether multi-select mode is enabled */\n multiple: boolean\n /** Current selected value (single-select mode) */\n value: Value | null\n /** Current selected values (multi-select mode) */\n values: Value[]\n /** Callback when value changes (single-select mode; `null` clears it) */\n onValueChange: (value: Value | null) => void\n /** Callback when values change (multi-select mode) */\n onValuesChange: (values: Value[]) => void\n\n // ===== Object Value Support =====\n /**\n * Custom comparison logic used to determine if a select item value\n * matches the current selected value.\n * Useful when item values are objects without matching referentially.\n * Defaults to Object.is comparison.\n */\n isItemEqualToValue: ItemEqualityComparer<Value>\n /**\n * When the item values are objects, this function converts the object\n * value to a string representation for display in the trigger.\n * If the shape of the object is { value, label }, the label will be\n * used automatically without needing to specify this prop.\n */\n itemToStringLabel?: (itemValue: Value) => string\n /**\n * When the item values are objects, this function converts the object\n * value to a string representation for form submission.\n * If the shape of the object is { value, label }, the value will be\n * used automatically without needing to specify this prop.\n */\n itemToStringValue?: (itemValue: Value) => string\n\n // ===== Form Integration =====\n /** Form field name for submission */\n name?: string\n /** Associate with a form by ID */\n form?: string\n /** Whether this field is required */\n required?: boolean\n /** Whether the select is disabled */\n disabled: boolean\n /** Placeholder text when no value selected */\n placeholder: string\n\n // ===== Item Text Registry =====\n /** Registry of item values to their text content */\n itemTextRegistry: ItemTextRegistry\n /** Register an item's text content */\n registerItemText: (value: string, text: string) => () => void\n /**\n * Data structure of the items for label resolution.\n * Used to display labels before items mount (e.g., on initial render with defaultValue).\n * Can be a record mapping values to labels, or an array of\n * `{ value, label, keywords? }` objects.\n */\n items?: Items\n\n // ===== List ID for ARIA =====\n /** ID for the listbox element */\n listId: string\n\n // ===== Element Refs for Positioning =====\n /** Ref to the trigger element */\n triggerRef: React.RefObject<HTMLElement | null>\n /** Ref to the value display element (text in trigger) */\n valueRef: React.RefObject<HTMLElement | null>\n /** Ref to the selected item's text element */\n selectedItemTextRef: React.MutableRefObject<HTMLElement | null>\n /** Ref to the first item's text element (used when no selection for alignItemWithTrigger) */\n firstItemTextRef: React.MutableRefObject<HTMLElement | null>\n /** Callback to set the trigger element */\n setTriggerElement: (element: HTMLElement | null) => void\n /** Callback to set the value element */\n setValueElement: (element: HTMLElement | null) => void\n\n // ===== Positioner Callback Registration =====\n /** Register a callback to reset positioning state after close animation */\n registerResetPositioningCallback: (\n callback: (() => void) | null,\n ) => () => void\n}\n\nconst SelectContext = React.createContext<SelectContextValue<unknown> | null>(\n null,\n)\n\n/**\n * Hook to access the Select context.\n * Throws if used outside a Select.Root.\n */\nexport function useSelectContext<Value = unknown>(): SelectContextValue<Value> {\n const context = React.useContext(SelectContext)\n if (!context) {\n throw new Error('Select components must be used within a Select.Root')\n }\n return context as SelectContextValue<Value>\n}\n\n/**\n * Hook to optionally access the Select context.\n * Returns null if used outside a Select.Root.\n */\nexport function useMaybeSelectContext<\n Value = unknown,\n>(): SelectContextValue<Value> | null {\n return React.useContext(SelectContext) as SelectContextValue<Value> | null\n}\n\nexport { SelectContext }\n","export const SelectItemDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-select-item'}\n */\n slot: 'bazzaui-select-item',\n /**\n * Present when the item is highlighted via keyboard or pointer.\n */\n highlighted: 'data-highlighted',\n /**\n * Present when the item is disabled.\n */\n disabled: 'data-disabled',\n /**\n * Present when the item is currently selected.\n */\n selected: 'data-selected',\n /** Present when this row is the first visible list-level row (not inside a group). */\n first: 'data-first',\n /** Present when this row is the last visible list-level row (not inside a group). */\n last: 'data-last',\n /** Present when this row is the first visible row within its group. */\n firstInGroup: 'data-first-in-group',\n /** Present when this row is the last visible row within its group. */\n lastInGroup: 'data-last-in-group',\n} as const\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Select Item Context\n// ============================================================================\n// Provides select-specific item state to child components.\n\nexport interface SelectItemContextValue<Value = unknown> {\n /** Unique ID for this item (for DOM id attribute) */\n id: string\n /** The value of this item (`null` for a clearable item) */\n value: Value | null\n /** The text value/label for this item */\n textValue: string | undefined\n /** Whether the item is highlighted */\n highlighted: boolean\n /** Whether the item is disabled */\n disabled: boolean\n /** Whether the item is selected */\n selected: boolean\n}\n\nconst SelectItemContext = React.createContext<SelectItemContextValue | null>(\n null,\n)\n\nexport function useSelectItemContext<\n Value = unknown,\n>(): SelectItemContextValue<Value> {\n const context = React.useContext(SelectItemContext)\n if (!context) {\n throw new Error(\n 'Select.Item child components must be used within a Select.Item',\n )\n }\n return context as SelectItemContextValue<Value>\n}\n\nexport function useMaybeSelectItemContext<\n Value = unknown,\n>(): SelectItemContextValue<Value> | null {\n return React.useContext(\n SelectItemContext,\n ) as SelectItemContextValue<Value> | null\n}\n\nexport { SelectItemContext }\n"]}