@bioturing/components 0.39.0 → 0.40.1

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 (133) hide show
  1. package/dist/base.d.ts +35 -1
  2. package/dist/base.d.ts.map +1 -1
  3. package/dist/base.js +47 -1
  4. package/dist/base.js.map +1 -1
  5. package/dist/components/base-menu/component.d.ts +1 -1
  6. package/dist/components/base-menu/index.d.ts +1 -1
  7. package/dist/components/base-menu/index.d.ts.map +1 -1
  8. package/dist/components/base-menu/index.js +3 -3
  9. package/dist/components/base-menu/item.d.ts +1 -1
  10. package/dist/components/base-menu/item.d.ts.map +1 -1
  11. package/dist/components/base-menu/item.js +1 -1
  12. package/dist/components/base-menu/item.js.map +1 -1
  13. package/dist/components/button/component.d.ts +1 -1
  14. package/dist/components/button/component.d.ts.map +1 -1
  15. package/dist/components/button/component.js +18 -17
  16. package/dist/components/button/component.js.map +1 -1
  17. package/dist/components/checkbox/component.d.ts.map +1 -1
  18. package/dist/components/choice-list/component.d.ts +8 -4
  19. package/dist/components/choice-list/component.d.ts.map +1 -1
  20. package/dist/components/choice-list/component.js +89 -94
  21. package/dist/components/choice-list/component.js.map +1 -1
  22. package/dist/components/color-select/component.js +6 -6
  23. package/dist/components/combobox/component.js +1 -1
  24. package/dist/components/combobox/component.js.map +1 -1
  25. package/dist/components/command-palette/component.d.ts +6 -0
  26. package/dist/components/command-palette/component.d.ts.map +1 -1
  27. package/dist/components/command-palette/component.js +182 -63
  28. package/dist/components/command-palette/component.js.map +1 -1
  29. package/dist/components/command-palette/index.d.ts +3 -1
  30. package/dist/components/command-palette/index.d.ts.map +1 -1
  31. package/dist/components/command-palette/style.css +1 -1
  32. package/dist/components/drag-drop/draggable.js +1 -1
  33. package/dist/components/drag-drop/draggable.js.map +1 -1
  34. package/dist/components/drag-drop/droppable.js +1 -1
  35. package/dist/components/drag-drop/droppable.js.map +1 -1
  36. package/dist/components/drag-drop/types.d.ts +1 -1
  37. package/dist/components/drag-drop/types.d.ts.map +1 -1
  38. package/dist/components/drag-drop/value.js +13 -13
  39. package/dist/components/dropdown-menu/component.d.ts +5 -3
  40. package/dist/components/dropdown-menu/component.d.ts.map +1 -1
  41. package/dist/components/dropdown-menu/component.js +185 -159
  42. package/dist/components/dropdown-menu/component.js.map +1 -1
  43. package/dist/components/dropdown-menu/divider.js +6 -6
  44. package/dist/components/dropdown-menu/divider.js.map +1 -1
  45. package/dist/components/dropdown-menu/item.d.ts.map +1 -1
  46. package/dist/components/dropdown-menu/item.js +28 -27
  47. package/dist/components/dropdown-menu/item.js.map +1 -1
  48. package/dist/components/dropdown-menu/style.css +1 -1
  49. package/dist/components/dropdown-menu/types.d.ts +2 -2
  50. package/dist/components/dropdown-menu/types.d.ts.map +1 -1
  51. package/dist/components/dropdown-menu/useDropdownMenu.d.ts.map +1 -1
  52. package/dist/components/dropdown-menu/useDropdownMenu.js +72 -68
  53. package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -1
  54. package/dist/components/hooks/antd.d.ts.map +1 -1
  55. package/dist/components/hooks/index.d.ts +1 -0
  56. package/dist/components/hooks/index.d.ts.map +1 -1
  57. package/dist/components/hooks/useBaseUIPlacement.d.ts +64 -0
  58. package/dist/components/hooks/useBaseUIPlacement.d.ts.map +1 -0
  59. package/dist/components/hooks/useBaseUIPlacement.js +61 -0
  60. package/dist/components/hooks/useBaseUIPlacement.js.map +1 -0
  61. package/dist/components/hooks/useControlledState.d.ts +1 -0
  62. package/dist/components/hooks/useControlledState.d.ts.map +1 -1
  63. package/dist/components/hooks/useControlledState.js +16 -16
  64. package/dist/components/hooks/useControlledState.js.map +1 -1
  65. package/dist/components/hooks/useTransitionStatus.js +2 -2
  66. package/dist/components/hooks/useTransitionStatus.js.map +1 -1
  67. package/dist/components/icon-button/style.css +1 -1
  68. package/dist/components/nav/index.d.ts.map +1 -1
  69. package/dist/components/nav/item.d.ts +1 -1
  70. package/dist/components/nav/item.d.ts.map +1 -1
  71. package/dist/components/nav/item.js +1 -1
  72. package/dist/components/nav/item.js.map +1 -1
  73. package/dist/components/popup-panel/component.d.ts +4 -4
  74. package/dist/components/popup-panel/component.d.ts.map +1 -1
  75. package/dist/components/popup-panel/component.js +142 -152
  76. package/dist/components/popup-panel/component.js.map +1 -1
  77. package/dist/components/resizable/component.js +1 -1
  78. package/dist/components/resizable/component.js.map +1 -1
  79. package/dist/components/scroll-area/component.d.ts +1 -1
  80. package/dist/components/scroll-area/component.d.ts.map +1 -1
  81. package/dist/components/scroll-area/component.js +1 -1
  82. package/dist/components/scroll-area/component.js.map +1 -1
  83. package/dist/components/select/component.d.ts.map +1 -1
  84. package/dist/components/select/component.js +153 -138
  85. package/dist/components/select/component.js.map +1 -1
  86. package/dist/components/select/item.js +13 -13
  87. package/dist/components/select-trigger/component.js +19 -19
  88. package/dist/components/splitter/splitter.d.ts.map +1 -1
  89. package/dist/components/splitter/splitter.js +53 -51
  90. package/dist/components/splitter/splitter.js.map +1 -1
  91. package/dist/components/stack/StackChild.js +2 -2
  92. package/dist/components/stack/StackChild.js.map +1 -1
  93. package/dist/components/toast/component.d.ts +1 -1
  94. package/dist/components/toast/component.d.ts.map +1 -1
  95. package/dist/components/toast/component.js +1 -1
  96. package/dist/components/toast/component.js.map +1 -1
  97. package/dist/components/toast/function.d.ts +2 -2
  98. package/dist/components/toast/function.d.ts.map +1 -1
  99. package/dist/components/toast/function.js +1 -1
  100. package/dist/components/toast/function.js.map +1 -1
  101. package/dist/components/transition/component.d.ts +1 -1
  102. package/dist/components/transition/component.d.ts.map +1 -1
  103. package/dist/components/transition/component.js +2 -2
  104. package/dist/components/transition/component.js.map +1 -1
  105. package/dist/components/tree/useTreeCommon.d.ts.map +1 -1
  106. package/dist/components/utils/WithRenderProp.d.ts +1 -1
  107. package/dist/components/utils/WithRenderProp.d.ts.map +1 -1
  108. package/dist/components/utils/WithRenderProp.js +1 -1
  109. package/dist/components/utils/WithRenderProp.js.map +1 -1
  110. package/dist/components/utils/index.d.ts +1 -0
  111. package/dist/components/utils/index.d.ts.map +1 -1
  112. package/dist/components/utils/renderProp.d.ts +24 -0
  113. package/dist/components/utils/renderProp.d.ts.map +1 -0
  114. package/dist/components/utils/renderProp.js +19 -0
  115. package/dist/components/utils/renderProp.js.map +1 -0
  116. package/dist/components/vertical-collapsible-panel/component.js +1 -1
  117. package/dist/components/vertical-collapsible-panel/component.js.map +1 -1
  118. package/dist/index.js +162 -158
  119. package/dist/index.js.map +1 -1
  120. package/dist/metadata.d.ts.map +1 -1
  121. package/dist/metadata.js +14 -14
  122. package/dist/metadata.js.map +1 -1
  123. package/dist/stats.html +1 -1
  124. package/dist/tailwind.css +125 -1
  125. package/package.json +4 -4
  126. package/dist/components/cmdk/command-score.d.ts +0 -2
  127. package/dist/components/cmdk/command-score.d.ts.map +0 -1
  128. package/dist/components/cmdk/command-score.js +0 -48
  129. package/dist/components/cmdk/command-score.js.map +0 -1
  130. package/dist/components/cmdk/index.d.ts +0 -440
  131. package/dist/components/cmdk/index.d.ts.map +0 -1
  132. package/dist/components/cmdk/index.js +0 -595
  133. package/dist/components/cmdk/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/dropdown-menu/component.tsx"],"sourcesContent":["\"use client\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { Popover } from \"@base-ui-components/react/popover\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef } from \"react\";\nimport {\n clsx,\n DROPDOWN_COLLISION_AVOIDANCE,\n parseAntdPlacement,\n useCls,\n} from \"../utils\";\nimport { Command } from \"../cmdk\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { FormItemInputContext } from \"antd/es/form/context\";\n\n// Import component-specific styles\nimport { Input } from \"../input\";\nimport { PopupPanelSize } from \"../popup-panel/constants\";\n\nimport { DropdownMenuItemType } from \"./types\";\nimport { useDropdownMenu, UseDropdownMenuProps } from \"./useDropdownMenu\";\nimport { useControlledState } from \"../hooks\";\n\nimport { useTheme } from \"../theme-provider\";\nimport { BaseMenu } from \"../base-menu\";\n\nexport interface DropdownMenuProps\n extends Omit<UseDropdownMenuProps, \"classNames\"> {\n /** Array of menu items to be displayed in the dropdown */\n items: DropdownMenuItemType[];\n /** Custom render function for the trigger element */\n children?: React.ComponentProps<typeof Menu.Trigger>[\"render\"];\n /**\n * Placement of the dropdown relative to the trigger element\n * @default \"bottomLeft\"\n */\n placement?: PopoverProps[\"placement\"];\n /**\n * Whether to open the dropdown on hover instead of click\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Controlled open state of the dropdown\n */\n open?: boolean;\n /**\n * Callback fired when the dropdown open state changes\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Default open state of the dropdown\n */\n defaultOpen?: boolean;\n /**\n * Additional CSS class for the dropdown component\n */\n className?: string;\n /**\n * Custom class names for different parts of the dropdown\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n itemIcon?: string;\n itemText?: string;\n positioner?: string;\n } & UseDropdownMenuProps[\"classNames\"];\n\n /**\n * Whether to show search input\n * @default false\n */\n showSearch?: boolean;\n /**\n * Size of the dropdown menu\n * @default \"auto\"\n */\n size?: \"auto\" | keyof typeof PopupPanelSize;\n /**\n * Search placeholder\n */\n searchProps?: Omit<\n React.ComponentProps<typeof Command.Input>,\n \"size\" | \"ref\"\n >;\n /**\n * Whether to match the width of the popup with the trigger\n * @default false\n */\n popupMatchTriggerWidth?: boolean;\n /**\n * Content to display before the list\n */\n beforeList?: React.ReactNode;\n /**\n * Content to display after the list\n */\n afterList?: React.ReactNode;\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n defaultOpen = false,\n className,\n itemRender,\n classNames,\n size = \"auto\",\n showSearch,\n inCombobox: inComboboxProp,\n searchProps = {\n placeholder: \"Search...\",\n },\n popupMatchTriggerWidth,\n beforeList,\n afterList,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n getItemKeywords,\n showCheckbox,\n itemLabelRender,\n}: DropdownMenuProps) => {\n const inCombobox =\n typeof inComboboxProp === \"boolean\" ? inComboboxProp : showSearch;\n const [open, onOpenChange] = useControlledState(\n outsideOpen,\n outsideOnOpenChange,\n defaultOpen\n );\n const cls = useCls();\n const { className: themeClassName } = useTheme();\n const baseUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const { itemGroups, renderGroup } = useDropdownMenu({\n items,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n itemLabelRender,\n itemRender,\n inCombobox,\n onOpenChange,\n classNames: {\n item: classNames?.item,\n itemIcon: classNames?.itemIcon,\n itemSuffix: classNames?.itemSuffix,\n group: classNames?.group,\n groupLabel: classNames?.groupLabel,\n divider: classNames?.divider,\n },\n });\n const renderMenuInner = useCallback(\n () =>\n showSearch ? (\n <Command\n className={cls(\"dropdown-menu-container\")}\n disablePointerSelection={showSearch}\n defaultValue={\n highlightedItemKey ? String(highlightedItemKey) : undefined\n }\n // filter={(value, search, keywords) => {\n // console.log({ value, search, keywords });\n // const extendValue = value + \" \" + keywords.join(\" \");\n // if (extendValue.toLowerCase().includes(search.toLowerCase()))\n // return 1;\n // return 0;\n // }}\n >\n <FormItemInputContext.Provider value={{}}>\n <Command.Input\n {...searchProps}\n key=\"search\"\n render={\n <Input\n allowClear\n className={cls(\"dropdown-menu-search\")}\n placeholder=\"Search\"\n />\n }\n />\n </FormItemInputContext.Provider>\n {beforeList}\n <ScrollArea fadeEdges>\n <Command.List className={cls(\"dropdown-menu-list\")}>\n <Command.Empty className={cls(\"dropdown-menu-empty\")}>\n No results found.\n </Command.Empty>\n {itemGroups.map(renderGroup)}\n </Command.List>\n </ScrollArea>\n {afterList}\n </Command>\n ) : (\n <div className={cls(\"dropdown-menu-container\")}>\n {beforeList}\n <ScrollArea fadeEdges>{itemGroups.map(renderGroup)}</ScrollArea>\n {afterList}\n </div>\n ),\n [\n showSearch,\n cls,\n highlightedItemKey,\n searchProps,\n beforeList,\n itemGroups,\n afterList,\n renderGroup,\n ]\n );\n const BaseComponent = showSearch ? Popover : Menu;\n\n return (\n <BaseComponent.Root\n open={open}\n onOpenChange={onOpenChange}\n >\n <BaseComponent.Trigger\n render={children}\n ref={buttonRef}\n nativeButton={false}\n openOnHover={openOnHover}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n themeClassName\n )}\n />\n <BaseComponent.Portal>\n <BaseComponent.Positioner\n side={baseUIPlacement.side}\n align={baseUIPlacement.align}\n sideOffset={4}\n className={clsx(\n cls(\"dropdown-menu-root\"),\n themeClassName,\n classNames?.root\n )}\n collisionAvoidance={DROPDOWN_COLLISION_AVOIDANCE}\n render={(props) => <BaseMenu.Root {...props} />}\n >\n <BaseComponent.Popup\n className={clsx(\n cls(\n \"dropdown-menu\",\n showCheckbox && \"dropdown-menu-show-checkbox\",\n popupMatchTriggerWidth && \"dropdown-menu-match-trigger-width\"\n ),\n className,\n classNames?.popup\n )}\n style={\n {\n \"--size-width\":\n size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n render={(props) => <BaseMenu.Popup {...props} />}\n >\n {renderMenuInner()}\n </BaseComponent.Popup>\n </BaseComponent.Positioner>\n </BaseComponent.Portal>\n </BaseComponent.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","defaultOpen","className","itemRender","classNames","size","showSearch","inComboboxProp","searchProps","popupMatchTriggerWidth","beforeList","afterList","keepOpenOnSelect","highlightedItemKey","selectedItemKeys","getItemKeywords","showCheckbox","itemLabelRender","inCombobox","open","onOpenChange","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","renderGroup","useDropdownMenu","renderMenuInner","useCallback","jsxs","Command","jsx","FormItemInputContext","createElement","Input","ScrollArea","Ba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IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/dropdown-menu/component.tsx"],"sourcesContent":["\"use client\";\nimport { Menu } from \"@base-ui/react/menu\";\nimport { Combobox } from \"@base-ui/react/combobox\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef, useState, RefCallback, useEffect } from \"react\";\nimport {\n clsx,\n DROPDOWN_COLLISION_AVOIDANCE,\n parseAntdPlacement,\n reactNodeToString,\n useCls,\n createRenderProp,\n} from \"../utils\";\nimport { useBaseUIPlacement } from \"../hooks\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { FormItemInputContext } from \"antd/es/form/context\";\n\n// Import component-specific styles\nimport { PopupPanelSize } from \"../popup-panel/constants\";\n\nimport { DropdownMenuItemType } from \"./types\";\nimport { useDropdownMenu, UseDropdownMenuProps } from \"./useDropdownMenu\";\nimport { useControlledState } from \"../hooks\";\n\nimport { useTheme } from \"../theme-provider\";\nimport { BaseMenu } from \"../base-menu\";\n\nimport { Input } from \"../input\";\n\nexport interface DropdownMenuProps\n extends Omit<UseDropdownMenuProps, \"classNames\"> {\n /** Array of menu items to be displayed in the dropdown */\n items: DropdownMenuItemType[];\n /** Custom render function for the trigger element */\n children?: React.ComponentProps<typeof Menu.Trigger>[\"render\"];\n /**\n * Placement of the dropdown relative to the trigger element\n * @default \"bottomLeft\"\n */\n placement?: PopoverProps[\"placement\"];\n /**\n * Whether to open the dropdown on hover instead of click\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Controlled open state of the dropdown\n */\n open?: boolean;\n /**\n * Callback fired when the dropdown open state changes\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Default open state of the dropdown\n */\n defaultOpen?: boolean;\n /**\n * Additional CSS class for the dropdown component\n */\n className?: string;\n /**\n * Custom class names for different parts of the dropdown\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n itemIcon?: string;\n itemText?: string;\n positioner?: string;\n } & UseDropdownMenuProps[\"classNames\"];\n\n /**\n * Whether to show search input\n * @default false\n */\n showSearch?: boolean;\n /**\n * Size of the dropdown menu\n * @default \"auto\"\n */\n size?: \"auto\" | keyof typeof PopupPanelSize;\n /**\n * Search placeholder\n */\n searchProps?: {\n placeholder?: string;\n className?: string;\n };\n /**\n * Whether to match the width of the popup with the trigger\n * @default false\n */\n popupMatchTriggerWidth?: boolean;\n /**\n * Content to display before the list\n */\n beforeList?: React.ReactNode;\n /**\n * Content to display after the list\n */\n afterList?: React.ReactNode;\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n defaultOpen = false,\n className,\n itemRender,\n classNames,\n size = \"auto\",\n showSearch,\n inCombobox: inComboboxProp,\n searchProps = {\n placeholder: \"Search...\",\n },\n popupMatchTriggerWidth,\n beforeList,\n afterList,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n getItemKeywords,\n showCheckbox,\n itemLabelRender,\n}: DropdownMenuProps) => {\n const inCombobox =\n typeof inComboboxProp === \"boolean\" ? inComboboxProp : showSearch;\n const [open, onOpenChange] = useControlledState(\n outsideOpen,\n outsideOnOpenChange,\n defaultOpen\n );\n const cls = useCls();\n const { className: themeClassName } = useTheme();\n const baseUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const { itemGroups, renderGroup } = useDropdownMenu({\n items,\n keepOpenOnSelect,\n highlightedItemKey,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n itemLabelRender,\n itemRender,\n inCombobox,\n onOpenChange,\n classNames: {\n item: classNames?.item,\n itemIcon: classNames?.itemIcon,\n itemSuffix: classNames?.itemSuffix,\n group: classNames?.group,\n groupLabel: classNames?.groupLabel,\n divider: classNames?.divider,\n },\n });\n\n const [searchValue, setSearchValue] = useState(\"\");\n const [positionerRef, setPositionerRef] = useState<HTMLDivElement | null>(\n null\n );\n const inputRef = useRef<HTMLInputElement | null>(null);\n const wasFocusedRef = useRef(false);\n\n // Track placement changes to conditionally position search input\n const { currentSide } = useBaseUIPlacement({\n positionerRef,\n open,\n initialSide: baseUIPlacement.side,\n initialAlign: baseUIPlacement.align,\n });\n\n // When placement is on top, move search to bottom for better UX\n const isTopPlacement = currentSide === \"top\";\n\n // Restore focus after placement changes\n useEffect(() => {\n if (wasFocusedRef.current && inputRef.current) {\n inputRef.current.focus();\n // Don't reset wasFocusedRef - let onBlur handle it\n }\n }, [isTopPlacement]);\n\n const renderMenuInner = useCallback(() => {\n if (!showSearch) {\n return (\n <div className={cls(\"dropdown-menu-container\")}>\n {beforeList}\n <ScrollArea fadeEdges>{itemGroups.map(renderGroup)}</ScrollArea>\n {afterList}\n </div>\n );\n }\n\n const searchInput = (\n <FormItemInputContext.Provider value={{}}>\n <Combobox.Input\n key=\"search\"\n placeholder={searchProps?.placeholder || \"Search\"}\n render={({ ref, ...props }) => (\n <Input\n {...props}\n ref={(antdInputRef) => {\n if (!antdInputRef || !antdInputRef.input) return;\n const comboboxRef = ref as RefCallback<HTMLInputElement>;\n comboboxRef(antdInputRef.input);\n inputRef.current = antdInputRef.input;\n }}\n allowClear\n placeholder={searchProps?.placeholder || \"Search\"}\n value={searchValue}\n onChange={(e) => setSearchValue(e.target.value)}\n onFocus={() => {\n wasFocusedRef.current = true;\n }}\n onBlur={() => {\n wasFocusedRef.current = false;\n }}\n className={clsx(\n cls(\"dropdown-menu-search\"),\n searchProps?.className\n )}\n />\n )}\n {...searchProps}\n />\n </FormItemInputContext.Provider>\n );\n\n const listContent = (\n <ScrollArea fadeEdges>\n <Combobox.Empty className={cls(\"dropdown-menu-empty\")}>\n No results found.\n </Combobox.Empty>\n <Combobox.List className={cls(\"dropdown-menu-list\")}>\n {(group, i) => renderGroup(group, i)}\n </Combobox.List>\n </ScrollArea>\n );\n\n return (\n <div className={cls(\"dropdown-menu-container\")}>\n {!isTopPlacement && searchInput}\n {beforeList}\n {listContent}\n {afterList}\n {isTopPlacement && searchInput}\n </div>\n );\n }, [\n showSearch,\n cls,\n searchProps,\n searchValue,\n beforeList,\n afterList,\n itemGroups,\n renderGroup,\n isTopPlacement,\n ]);\n\n const commonTriggerProps = {\n ref: buttonRef,\n // nativeButton: false,\n openOnHover,\n className: clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n themeClassName\n ),\n render: (props, state) => {\n const { openOnHover: _openOnHover, ...rest } = props;\n return createRenderProp(children, rest, state);\n },\n };\n\n const commonPositionerProps = {\n ref: setPositionerRef,\n side: baseUIPlacement.side,\n align: baseUIPlacement.align,\n sideOffset: 4,\n className: clsx(\n cls(\"dropdown-menu-root\"),\n themeClassName,\n classNames?.root\n ),\n collisionAvoidance: DROPDOWN_COLLISION_AVOIDANCE,\n render: (props: React.ComponentPropsWithoutRef<\"div\">) => (\n <BaseMenu.Root {...props} />\n ),\n };\n\n const commonPopupProps = {\n className: clsx(\n cls(\n \"dropdown-menu\",\n showCheckbox && \"dropdown-menu-show-checkbox\",\n popupMatchTriggerWidth && \"dropdown-menu-match-trigger-width\"\n ),\n className,\n classNames?.popup\n ),\n style: {\n \"--size-width\": size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties,\n render: (props: React.ComponentPropsWithoutRef<\"div\">) => (\n <BaseMenu.Popup {...props} />\n ),\n };\n\n return showSearch ? (\n <Combobox.Root<DropdownMenuItemType>\n open={open}\n onOpenChange={onOpenChange}\n items={itemGroups}\n itemToStringLabel={(item) =>\n item.type == \"item\" ? reactNodeToString(item.label) : \"\"\n }\n itemToStringValue={(item) =>\n item.type == \"item\" ? String(item.key) : \"\"\n }\n inputValue={searchValue}\n >\n <Combobox.Trigger {...commonTriggerProps} />\n <Combobox.Portal>\n <Combobox.Positioner {...commonPositionerProps}>\n <Combobox.Popup {...commonPopupProps}>\n {renderMenuInner()}\n </Combobox.Popup>\n </Combobox.Positioner>\n </Combobox.Portal>\n </Combobox.Root>\n ) : (\n <Menu.Root open={open} onOpenChange={onOpenChange}>\n <Menu.Trigger {...commonTriggerProps} />\n <Menu.Portal>\n <Menu.Positioner {...commonPositionerProps}>\n <Menu.Popup {...commonPopupProps}>{renderMenuInner()}</Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","defaultOpen","className","itemRender","classNames","size","showSearch","inComboboxProp","searchProps","popupMatchTriggerWidth","beforeList","afterList","keepOpenOnSelect","highlightedItemKey","selectedItemKeys","getItemKeywords","showCheckbox","itemLabelRender","inCombobox","open","onOpenChange","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","renderGroup","useDropdownMenu","searchValue","setSearchValue","useState","positionerRef","setPositionerRef","inputRef","wasFocusedRef","currentSide","useBaseUIPlacement","isTopPlacement","useEffect","renderMenuInner","useCallback","jsxs","ScrollArea","searchInput","jsx","FormItemInputContext","Combobox","ref","props","Input","antdInputRef","e","clsx","listContent","group","i","commonTriggerProps","state","_openOnHover","rest","createRenderProp","commonPositionerProps","DROPDOWN_COLLISION_AVOIDANCE","BaseMenu","commonPopupProps","PopupPanelSize","item","reactNodeToString","Menu"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0GO,MAAMA,KAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,YAAAC;AAAA,EACA,YAAYC;AAAA,EACZ,aAAAC,IAAc;AAAA,IACZ,aAAa;AAAA,EAAA;AAAA,EAEf,wBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC;AAAA,E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import { Menu as i } from "@base-ui-components/react/menu";
2
+ import { Combobox as n } from "@base-ui/react/combobox";
3
+ import { Menu as p } from "@base-ui/react/menu";
4
4
  import { BaseMenu as s } from "../base-menu/index.js";
5
5
  import { useCls as a } from "../utils/antdUtils.js";
6
6
  import { clsx as d } from "../utils/cn.js";
7
- const x = ({
7
+ const v = ({
8
8
  inCombobox: o,
9
9
  className: e
10
10
  }) => {
11
- const m = a(), t = o ? p.Separator : i.Separator;
11
+ const m = a(), t = o ? n.Separator : p.Separator;
12
12
  return /* @__PURE__ */ r(
13
13
  t,
14
14
  {
15
15
  className: d(m("dropdown-menu-divider"), e),
16
- render: (n) => /* @__PURE__ */ r(s.Divider, { ...n })
16
+ render: (i) => /* @__PURE__ */ r(s.Divider, { ...i })
17
17
  }
18
18
  );
19
19
  };
20
20
  export {
21
- x as DropdownMenuDivider
21
+ v as DropdownMenuDivider
22
22
  };
23
23
  //# sourceMappingURL=divider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"divider.js","sources":["../../../src/components/dropdown-menu/divider.tsx"],"sourcesContent":["import { Command } from \"../cmdk\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { clsx, useCls } from \"../utils\";\nimport { BaseMenu } from \"../base-menu\";\nimport { HTMLAttributes } from \"react\";\n\nexport interface DropdownMenuDividerProps {\n inCombobox?: boolean;\n className?: string;\n}\n\nexport const DropdownMenuDivider = ({\n inCombobox,\n className,\n}: DropdownMenuDividerProps) => {\n const cls = useCls();\n const MenuSeparator = inCombobox ? Command.Separator : Menu.Separator;\n\n return (\n <MenuSeparator\n className={clsx(cls(\"dropdown-menu-divider\"), className)}\n render={(props: HTMLAttributes<HTMLDivElement>) => (\n <BaseMenu.Divider {...props} />\n )}\n />\n );\n};\n"],"names":["DropdownMenuDivider","inCombobox","className","cls","useCls","MenuSeparator","Command","Menu","jsx","clsx","props","BaseMenu"],"mappings":";;;;;;AAWO,MAAMA,IAAsB,CAAC;AAAA,EAClC,YAAAC;AAAA,EACA,WAAAC;AACF,MAAgC;AAC9B,QAAMC,IAAMC,EAAA,GACNC,IAAgBJ,IAAaK,EAAQ,YAAYC,EAAK;AAE5D,SACE,gBAAAC;AAAA,IAACH;AAAA,IAAA;AAAA,MACC,WAAWI,EAAKN,EAAI,uBAAuB,GAAGD,CAAS;AAAA,MACvD,QAAQ,CAACQ,MACP,gBAAAF,EAACG,EAAS,SAAT,EAAkB,GAAGD,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAIrC;"}
1
+ {"version":3,"file":"divider.js","sources":["../../../src/components/dropdown-menu/divider.tsx"],"sourcesContent":["import { Combobox } from \"@base-ui/react/combobox\";\nimport { Menu } from \"@base-ui/react/menu\";\nimport { clsx, useCls } from \"../utils\";\nimport { BaseMenu } from \"../base-menu\";\nimport { HTMLAttributes } from \"react\";\n\nexport interface DropdownMenuDividerProps {\n inCombobox?: boolean;\n className?: string;\n}\n\nexport const DropdownMenuDivider = ({\n inCombobox,\n className,\n}: DropdownMenuDividerProps) => {\n const cls = useCls();\n const MenuSeparator = inCombobox ? Combobox.Separator : Menu.Separator;\n\n return (\n <MenuSeparator\n className={clsx(cls(\"dropdown-menu-divider\"), className)}\n render={(props: HTMLAttributes<HTMLDivElement>) => (\n <BaseMenu.Divider {...props} />\n )}\n />\n );\n};\n"],"names":["DropdownMenuDivider","inCombobox","className","cls","useCls","MenuSeparator","Combobox","Menu","jsx","clsx","props","BaseMenu"],"mappings":";;;;;;AAWO,MAAMA,IAAsB,CAAC;AAAA,EAClC,YAAAC;AAAA,EACA,WAAAC;AACF,MAAgC;AAC9B,QAAMC,IAAMC,EAAA,GACNC,IAAgBJ,IAAaK,EAAS,YAAYC,EAAK;AAE7D,SACE,gBAAAC;AAAA,IAACH;AAAA,IAAA;AAAA,MACC,WAAWI,EAAKN,EAAI,uBAAuB,GAAGD,CAAS;AAAA,MACvD,QAAQ,CAACQ,MACP,gBAAAF,EAACG,EAAS,SAAT,EAAkB,GAAGD,EAAA,CAAO;AAAA,I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,CAAA;KAAE,KAAK,IAAI,CAAC;IACtE;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,EAAE,CAAC;CAC/E;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsH5D,CAAC"}
@@ -1,27 +1,27 @@
1
1
  "use client";
2
- import { jsx as c } from "react/jsx-runtime";
3
- import { useCallback as i, useMemo as x } from "react";
4
- import { Command as y } from "../cmdk/index.js";
5
- import { Menu as O } from "@base-ui-components/react/menu";
2
+ import { jsx as f } from "react/jsx-runtime";
3
+ import { useCallback as g, useMemo as i } from "react";
4
+ import { Combobox as x } from "@base-ui/react/combobox";
5
+ import { Menu as O } from "@base-ui/react/menu";
6
6
  import { BaseMenuItem as S } from "../base-menu/item.js";
7
- import C from "../utils/createSyntheticClickEvent.js";
8
- import { reactNodeToString as w } from "../utils/reactToString.js";
7
+ import y from "../utils/createSyntheticClickEvent.js";
8
+ import { reactNodeToString as C } from "../utils/reactToString.js";
9
9
  import { useCls as E } from "../utils/antdUtils.js";
10
10
  import { clsx as M } from "../utils/cn.js";
11
- const z = ({
11
+ const q = ({
12
12
  item: o,
13
13
  inCombobox: e = !1,
14
14
  selected: u = !1,
15
- itemRender: d,
16
- itemLabelRender: f,
15
+ itemRender: c,
16
+ itemLabelRender: d,
17
17
  itemProps: p = {},
18
18
  classNames: n,
19
- afterSelect: a,
19
+ afterSelect: l,
20
20
  showCheckbox: v,
21
21
  indeterminate: k,
22
- getItemKeywords: l
22
+ getItemKeywords: a
23
23
  }) => {
24
- const t = E(), s = i(
24
+ const t = E(), s = g(
25
25
  (r) => {
26
26
  if (o.onSelect)
27
27
  o.onSelect(o);
@@ -29,17 +29,17 @@ const z = ({
29
29
  if (typeof r == "object")
30
30
  o.onClick(r);
31
31
  else {
32
- const b = C(null);
32
+ const b = y(null);
33
33
  o.onClick(b);
34
34
  }
35
- a && a(o);
35
+ l && l(o);
36
36
  },
37
- [a, o]
38
- ), g = x(
39
- () => l ? l(o) : [String(o.key), w(o.label)],
40
37
  [l, o]
41
38
  );
42
- return d ? d(o, {
39
+ return i(
40
+ () => a ? a(o) : [String(o.key), C(o.label)],
41
+ [a, o]
42
+ ), c ? c(o, {
43
43
  className: M(
44
44
  t("dropdown-menu-item", e && "dropdown-menu-item-combobox"),
45
45
  n?.item,
@@ -55,7 +55,7 @@ const z = ({
55
55
  onMouseOver: o.onMouseOver,
56
56
  onMouseOut: o.onMouseOut,
57
57
  ...p
58
- }) : /* @__PURE__ */ c(
58
+ }) : /* @__PURE__ */ f(
59
59
  S,
60
60
  {
61
61
  disabled: o.disabled,
@@ -78,7 +78,7 @@ const z = ({
78
78
  text: n?.itemText,
79
79
  suffix: n?.itemSuffix
80
80
  },
81
- labelRender: f ? (r) => f(o, r) : void 0,
81
+ labelRender: d ? (r) => d(o, r) : void 0,
82
82
  ref: o.ref,
83
83
  onMouseEnter: o.onMouseEnter,
84
84
  onMouseLeave: o.onMouseLeave,
@@ -86,19 +86,20 @@ const z = ({
86
86
  onMouseOut: o.onMouseOut,
87
87
  "data-value": typeof o.label == "string" ? o.label : String(o.key),
88
88
  "data-actual-selected": u,
89
- render: e ? /* @__PURE__ */ c(
90
- y.Item,
89
+ render: e ? /* @__PURE__ */ f(
90
+ x.Item,
91
91
  {
92
+ role: "option",
92
93
  value: String(o.key),
93
- keywords: g || void 0,
94
- onSelect: s
95
- }
96
- ) : /* @__PURE__ */ c(O.Item, { onClick: s }),
94
+ onClick: s
95
+ },
96
+ String(o.key)
97
+ ) : /* @__PURE__ */ f(O.Item, { onClick: s }),
97
98
  children: o.label
98
99
  }
99
100
  );
100
101
  };
101
102
  export {
102
- z as DropdownMenuItem
103
+ q as DropdownMenuItem
103
104
  };
104
105
  //# sourceMappingURL=item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"item.js","sources":["../../../src/components/dropdown-menu/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { Ref, useCallback, useMemo } from \"react\";\nimport {\n clsx,\n createSyntheticClickEvent,\n reactNodeToString,\n useCls,\n} from \"../utils\";\nimport type { DropdownMenuItemType } from \"./types\";\nimport { Command } from \"../cmdk\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { BaseMenuItem } from \"../base-menu\";\n\nexport interface DropdownMenuItemProps {\n /**\n * The menu item data\n */\n item: DropdownMenuItemType & { type: \"item\" };\n /**\n * Custom render function for the item\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Custom render function for the item label\n */\n itemLabelRender?: (\n item: DropdownMenuItemType & { type: \"item\" },\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Additional props to pass to the item\n */\n itemProps?: React.HTMLAttributes<HTMLElement>;\n /**\n * Class names from parent DropdownMenu\n */\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemText?: string;\n itemSuffix?: string;\n };\n /**\n * Function to be called after the menu item is selected\n */\n afterSelect?: (item: DropdownMenuItemType & { type: \"item\" }) => void;\n /**\n * Whether the menu item is in a combobox\n */\n inCombobox?: boolean;\n /**\n * Whether the menu item is selected (for combobox)\n * @default false\n */\n selected?: boolean;\n /**\n * Whether to show checkbox (only for decoration purpose)\n */\n showCheckbox?: boolean;\n /**\n * Whether the menu item checkbox is indeterminate (for combobox)\n * @default false\n */\n indeterminate?: boolean;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [String(item.key), reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: DropdownMenuItemType & { type: \"item\" }) => string[];\n}\n\nexport const DropdownMenuItem: React.FC<DropdownMenuItemProps> = ({\n item,\n inCombobox = false,\n selected = false,\n itemRender,\n itemLabelRender,\n itemProps = {},\n classNames,\n afterSelect,\n showCheckbox,\n indeterminate,\n getItemKeywords,\n}) => {\n const cls = useCls();\n\n const handler = useCallback(\n (e?: React.MouseEvent<HTMLElement, MouseEvent> | string) => {\n // onSelect has priority over onClick\n if (item.onSelect) {\n item.onSelect(item);\n } else if (item.onClick) {\n if (typeof e === \"object\") {\n item.onClick(e);\n } else {\n const event = createSyntheticClickEvent(null);\n item.onClick(event);\n }\n }\n if (afterSelect) afterSelect(item);\n },\n [afterSelect, item]\n );\n\n const keywords = useMemo(\n () =>\n getItemKeywords\n ? getItemKeywords(item)\n : [String(item.key), reactNodeToString(item.label)],\n [getItemKeywords, item]\n );\n\n // If custom render function is provided, use it\n if (itemRender) {\n return itemRender(item, {\n className: clsx(\n cls(\"dropdown-menu-item\", inCombobox && \"dropdown-menu-item-combobox\"),\n classNames?.item,\n item.className\n ),\n \"data-danger\": item.danger,\n \"data-actual-selected\": selected,\n \"data-value\":\n typeof item.label === \"string\" ? item.label : String(item.key),\n ref: item.ref as Ref<HTMLDivElement>,\n onClick: handler,\n onMouseEnter: item.onMouseEnter,\n onMouseLeave: item.onMouseLeave,\n onMouseOver: item.onMouseOver,\n onMouseOut: item.onMouseOut,\n ...itemProps,\n } as React.HTMLAttributes<HTMLElement>);\n }\n\n return (\n <BaseMenuItem\n // BaseMenuItem props\n disabled={item.disabled}\n danger={item.danger}\n selected={selected}\n showCheckbox={showCheckbox}\n indeterminate={indeterminate}\n icon={item.icon}\n suffix={!inCombobox ? item.suffix : undefined}\n classNames={{\n root: clsx(\n cls(\n \"dropdown-menu-item\",\n inCombobox && \"dropdown-menu-item-combobox\"\n ),\n classNames?.item,\n item.className\n ),\n icon: classNames?.itemIcon,\n text: classNames?.itemText,\n suffix: classNames?.itemSuffix,\n }}\n labelRender={\n itemLabelRender\n ? (props: React.HTMLAttributes<HTMLElement>) =>\n itemLabelRender(item, props)\n : undefined\n }\n ref={item.ref as Ref<HTMLDivElement>}\n onMouseEnter={item.onMouseEnter}\n onMouseLeave={item.onMouseLeave}\n onMouseOver={item.onMouseOver}\n onMouseOut={item.onMouseOut}\n data-value={\n typeof item.label === \"string\" ? item.label : String(item.key)\n }\n data-actual-selected={selected}\n // Render prop to use Base UI components\n render={\n inCombobox ? (\n <Command.Item\n value={String(item.key)}\n keywords={keywords || undefined}\n onSelect={handler}\n />\n ) : (\n <Menu.Item onClick={handler} />\n )\n }\n >\n {item.label}\n </BaseMenuItem>\n );\n};\n"],"names":["DropdownMenuItem","item","inCombobox","selected","itemRender","itemLabelRender","itemProps","classNames","afterSelect","showCheckbox","indeterminate","getItemKeywords","cls","useCls","handler","useCallback","e","event","createSyntheticClickEvent","keywords","useMemo","reactNodeToString","clsx","jsx","BaseMenuItem","props","Command","Menu"],"mappings":";;;;;;;;;;AA0EO,MAAMA,IAAoD,CAAC;AAAA,EAChE,MAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC,IAAY,CAAA;AAAA,EACZ,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACJ,QAAMC,IAAMC,EAAA,GAENC,IAAUC;AAAA,IACd,CAACC,MAA2D;AAE1D,UAAIf,EAAK;AACP,QAAAA,EAAK,SAASA,CAAI;AAAA,eACTA,EAAK;AACd,YAAI,OAAOe,KAAM;AACf,UAAAf,EAAK,QAAQe,CAAC;AAAA,aACT;AACL,gBAAMC,IAAQC,EAA0B,IAAI;AAC5C,UAAAjB,EAAK,QAAQgB,CAAK;AAAA,QACpB;AAEF,MAAIT,OAAyBP,CAAI;AAAA,IACnC;AAAA,IACA,CAACO,GAAaP,CAAI;AAAA,EAAA,GAGdkB,IAAWC;AAA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ACjB,cACE,OAAOA,EAAK,SAAU,WAAWA,EAAK,QAAQ,OAAOA,EAAK,GAAG;AAAA,MAE/D,wBAAsBE;AAAA,MAEtB,QACED,IACE,gBAAAqB;AAAA,QAACG,EAAQ;AAAA,QAAR;AAAA,UACC,OAAO,OAAOzB,EAAK,GAAG;AAAA,UACtB,UAAUkB,KAAY;AAAA,UACtB,UAAUL;AAAA,QAAA;AAAA,MAAA,IAGZ,gBAAAS,EAACI,EAAK,MAAL,EAAU,SAASb,EAAA,CAAS;AAAA,MAIhC,UAAAb,EAAK;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
1
+ {"version":3,"file":"item.js","sources":["../../../src/components/dropdown-menu/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { Ref, useCallback, useMemo } from \"react\";\nimport {\n clsx,\n createSyntheticClickEvent,\n reactNodeToString,\n useCls,\n} from \"../utils\";\nimport type { DropdownMenuItemType } from \"./types\";\nimport { Combobox } from \"@base-ui/react/combobox\";\nimport { Menu } from \"@base-ui/react/menu\";\nimport { BaseMenuItem } from \"../base-menu\";\n\nexport interface DropdownMenuItemProps {\n /**\n * The menu item data\n */\n item: DropdownMenuItemType & { type: \"item\" };\n /**\n * Custom render function for the item\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Custom render function for the item label\n */\n itemLabelRender?: (\n item: DropdownMenuItemType & { type: \"item\" },\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Additional props to pass to the item\n */\n itemProps?: React.HTMLAttributes<HTMLElement>;\n /**\n * Class names from parent DropdownMenu\n */\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemText?: string;\n itemSuffix?: string;\n };\n /**\n * Function to be called after the menu item is selected\n */\n afterSelect?: (item: DropdownMenuItemType & { type: \"item\" }) => void;\n /**\n * Whether the menu item is in a combobox\n */\n inCombobox?: boolean;\n /**\n * Whether the menu item is selected (for combobox)\n * @default false\n */\n selected?: boolean;\n /**\n * Whether to show checkbox (only for decoration purpose)\n */\n showCheckbox?: boolean;\n /**\n * Whether the menu item checkbox is indeterminate (for combobox)\n * @default false\n */\n indeterminate?: boolean;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [String(item.key), reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: DropdownMenuItemType & { type: \"item\" }) => string[];\n}\n\nexport const DropdownMenuItem: React.FC<DropdownMenuItemProps> = ({\n item,\n inCombobox = false,\n selected = false,\n itemRender,\n itemLabelRender,\n itemProps = {},\n classNames,\n afterSelect,\n showCheckbox,\n indeterminate,\n getItemKeywords,\n}) => {\n const cls = useCls();\n\n const handler = useCallback(\n (e?: React.MouseEvent<HTMLElement, MouseEvent> | string) => {\n // onSelect has priority over onClick\n if (item.onSelect) {\n item.onSelect(item);\n } else if (item.onClick) {\n if (typeof e === \"object\") {\n item.onClick(e);\n } else {\n const event = createSyntheticClickEvent(null);\n item.onClick(event);\n }\n }\n if (afterSelect) afterSelect(item);\n },\n [afterSelect, item]\n );\n\n const keywords = useMemo(\n () =>\n getItemKeywords\n ? getItemKeywords(item)\n : [String(item.key), reactNodeToString(item.label)],\n [getItemKeywords, item]\n );\n\n // If custom render function is provided, use it\n if (itemRender) {\n return itemRender(item, {\n className: clsx(\n cls(\"dropdown-menu-item\", inCombobox && \"dropdown-menu-item-combobox\"),\n classNames?.item,\n item.className\n ),\n \"data-danger\": item.danger,\n \"data-actual-selected\": selected,\n \"data-value\":\n typeof item.label === \"string\" ? item.label : String(item.key),\n ref: item.ref as Ref<HTMLDivElement>,\n onClick: handler,\n onMouseEnter: item.onMouseEnter,\n onMouseLeave: item.onMouseLeave,\n onMouseOver: item.onMouseOver,\n onMouseOut: item.onMouseOut,\n ...itemProps,\n } as React.HTMLAttributes<HTMLElement>);\n }\n\n return (\n <BaseMenuItem\n // BaseMenuItem props\n disabled={item.disabled}\n danger={item.danger}\n selected={selected}\n showCheckbox={showCheckbox}\n indeterminate={indeterminate}\n icon={item.icon}\n suffix={!inCombobox ? item.suffix : undefined}\n classNames={{\n root: clsx(\n cls(\n \"dropdown-menu-item\",\n inCombobox && \"dropdown-menu-item-combobox\"\n ),\n classNames?.item,\n item.className\n ),\n icon: classNames?.itemIcon,\n text: classNames?.itemText,\n suffix: classNames?.itemSuffix,\n }}\n labelRender={\n itemLabelRender\n ? (props: React.HTMLAttributes<HTMLElement>) =>\n itemLabelRender(item, props)\n : undefined\n }\n ref={item.ref as Ref<HTMLDivElement>}\n onMouseEnter={item.onMouseEnter}\n onMouseLeave={item.onMouseLeave}\n onMouseOver={item.onMouseOver}\n onMouseOut={item.onMouseOut}\n data-value={\n typeof item.label === \"string\" ? item.label : String(item.key)\n }\n data-actual-selected={selected}\n // Render prop to use Base UI components\n render={\n inCombobox ? (\n <Combobox.Item\n role=\"option\"\n key={String(item.key)}\n value={String(item.key)}\n onClick={handler}\n />\n ) : (\n <Menu.Item onClick={handler} />\n )\n }\n >\n {item.label}\n </BaseMenuItem>\n );\n};\n"],"names":["DropdownMenuItem","item","inCombobox","selected","itemRender","itemLabelRender","itemProps","classNames","afterSelect","showCheckbox","indeterminate","getItemKeywords","cls","useCls","handler","useCallback","e","event","createSyntheticClickEvent","useMemo","reactNodeToString","clsx","jsx","BaseMenuItem","props","Combobox","Menu"],"mappings":";;;;;;;;;;AA0EO,MAAMA,IAAoD,CAAC;AAAA,EAChE,MAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC,IAAY,CAAA;AAAA,EACZ,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACJ,QAAMC,IAAMC,EAAA,GAENC,IAAUC;AAAA,IACd,CAACC,MAA2D;AAE1D,UAAIf,EAAK;AACP,QAAAA,EAAK,SAASA,CAAI;AAAA,eACTA,EAAK;AACd,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AA,QAClB,QAAQA,GAAY;AAAA,MAAA;AAAA,MAEtB,aACEF,IACI,CAACmB,MACCnB,EAAgBJ,GAAMuB,CAAK,IAC7B;AAAA,MAEN,KAAKvB,EAAK;AAAA,MACV,cAAcA,EAAK;AAAA,MACnB,cAAcA,EAAK;AAAA,MACnB,aAAaA,EAAK;AAAA,MAClB,YAAYA,EAAK;AAAA,MACjB,cACE,OAAOA,EAAK,SAAU,WAAWA,EAAK,QAAQ,OAAOA,EAAK,GAAG;AAAA,MAE/D,wBAAsBE;AAAA,MAEtB,QACED,IACE,gBAAAoB;AAAA,QAACG,EAAS;AAAA,QAAT;AAAA,UACC,MAAK;AAAA,UAEL,OAAO,OAAOxB,EAAK,GAAG;AAAA,UACtB,SAASa;AAAA,QAAA;AAAA,QAFJ,OAAOb,EAAK,GAAG;AAAA,MAAA,IAKtB,gBAAAqB,EAACI,EAAK,MAAL,EAAU,SAASZ,EAAA,CAAS;AAAA,MAIhC,UAAAb,EAAK;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -1 +1 @@
1
- @layer components{.ds-dropdown-menu-search{margin-bottom:.25rem}.ds-dropdown-menu-header{font-size:.75rem;font-weight:500;line-height:1rem;text-transform:uppercase;color:var(--ds-color-text-tertiary);padding:.75rem .75rem .25rem}.ds-dropdown-menu-header:first-child{padding-top:.5rem}.ds-dropdown-menu-empty{padding:.375rem .75rem;color:var(--ds-color-text-tertiary)}.ds-dropdown-menu-match-trigger-width{width:min(var(--anchor-width),var(--available-width))}.ds-dropdown-menu-container{display:flex;flex-direction:column;flex-shrink:1;min-height:0}}
1
+ @layer components{.ds-dropdown-menu-header{font-size:.75rem;font-weight:500;line-height:1rem;text-transform:uppercase;color:var(--ds-color-text-tertiary);padding:.75rem .75rem .25rem}.ds-dropdown-menu-header:first-child{padding-top:.5rem}.ds-dropdown-menu-empty{padding:.375rem .75rem;color:var(--ds-color-text-tertiary)}.ds-dropdown-menu-empty:empty{display:none}.ds-dropdown-menu-match-trigger-width{width:min(var(--anchor-width),var(--available-width))}.ds-dropdown-menu-container{display:flex;flex-direction:column;flex-shrink:1;min-height:0;gap:.25rem}}
@@ -81,8 +81,8 @@ export type DropdownMenuItemType = {
81
81
  */
82
82
  className?: string;
83
83
  };
84
- export interface DropdownMenuGroup {
84
+ export type DropdownMenuGroup = {
85
85
  label: React.ReactNode | null;
86
86
  items: DropdownMenuItemType[];
87
- }
87
+ };
88
88
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,oBAAoB,GAC5B;IACE;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;IACvD;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,C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AI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;IACvD;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,CAAC;IAC/D;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;IAC7D;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B,GACD;IACE;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;CACjB,GACD;IACE;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAA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GG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,EAAE,CAAC;CAC/E;AAED,eAAO,MAAM,eAAe,GAAI,kJAW7B,oBAAoB;;2BAGZ,oBAAoB,KAAK,MAAM,KAAK,MAAM;yBAqEzC,iBAAiB,SAAS,MAAM;CA8D3C,CAAC"}
@@ -1,38 +1,37 @@
1
- import { jsx as t, jsxs as D } from "react/jsx-runtime";
2
- import { useCallback as m, useMemo as S } from "react";
3
- import { DropdownMenuItem as k } from "./item.js";
4
- import { DropdownMenuDivider as I } from "./divider.js";
5
- import { Menu as b } from "@base-ui-components/react";
6
- import { Command as L } from "../cmdk/index.js";
1
+ import { jsx as i, jsxs as w } from "react/jsx-runtime";
2
+ import { useCallback as m, useMemo as L } from "react";
3
+ import { DropdownMenuItem as I } from "./item.js";
4
+ import { DropdownMenuDivider as j } from "./divider.js";
5
+ import { Menu as v, Combobox as f } from "@base-ui/react";
7
6
  import './style.css';/* empty css */
8
- import { useCls as j } from "../utils/antdUtils.js";
9
- import { reactNodeToString as T } from "../utils/reactToString.js";
7
+ import { useCls as k } from "../utils/antdUtils.js";
8
+ import { reactNodeToString as x } from "../utils/reactToString.js";
10
9
  import { clsx as d } from "../utils/cn.js";
11
- const U = ({
12
- items: f,
13
- inCombobox: u = !1,
10
+ const J = ({
11
+ items: s,
12
+ inCombobox: n = !1,
14
13
  classNames: o = {},
15
- selectedItemKeys: s,
16
- keepOpenOnSelect: h,
17
- showCheckbox: a = !1,
18
- getItemKeywords: g = (p) => [String(p.key), T(p.label)],
19
- onOpenChange: G,
14
+ selectedItemKeys: h,
15
+ keepOpenOnSelect: a,
16
+ showCheckbox: G = !1,
17
+ getItemKeywords: b = (l) => [String(l.key), x(l.label)],
18
+ onOpenChange: g,
20
19
  itemRender: y,
21
20
  itemLabelRender: M
22
21
  }) => {
23
- const p = j(), l = m(
24
- (e, r, i) => e.type === "item" ? /* @__PURE__ */ t(
25
- k,
22
+ const l = k(), p = m(
23
+ (e, r, t) => e.type === "item" ? /* @__PURE__ */ i(
24
+ I,
26
25
  {
27
26
  item: e,
28
- inCombobox: u,
29
- selected: s?.includes(e.key),
27
+ inCombobox: n,
28
+ selected: h?.includes(e.key),
30
29
  afterSelect: () => {
31
- h || G?.(!1);
30
+ a || g?.(!1);
32
31
  },
33
32
  itemRender: y,
34
- showCheckbox: a,
35
- getItemKeywords: g,
33
+ showCheckbox: G,
34
+ getItemKeywords: b,
36
35
  itemLabelRender: M,
37
36
  classNames: {
38
37
  item: o.item,
@@ -40,85 +39,90 @@ const U = ({
40
39
  itemSuffix: o.itemSuffix
41
40
  }
42
41
  },
43
- r + "-" + i
44
- ) : e.type === "divider" ? /* @__PURE__ */ t(
45
- I,
42
+ r + "-" + t
43
+ ) : e.type === "divider" ? /* @__PURE__ */ i(
44
+ j,
46
45
  {
47
- inCombobox: u,
46
+ inCombobox: n,
48
47
  className: o?.divider
49
48
  },
50
- r + "-" + i
49
+ r + "-" + t
51
50
  ) : null,
52
51
  [
53
52
  o,
54
53
  y,
55
- G,
56
- u,
57
- h,
58
- s,
59
- a,
60
54
  g,
55
+ n,
56
+ a,
57
+ h,
58
+ G,
59
+ b,
61
60
  M
62
61
  ]
63
- ), v = m(
64
- (e, r) => /* @__PURE__ */ D(
65
- b.Group,
62
+ ), D = m(
63
+ (e, r) => /* @__PURE__ */ w(
64
+ v.Group,
66
65
  {
67
- className: d(p("dropdown-menu-group"), o?.group),
66
+ className: d(l("dropdown-menu-group"), o?.group),
68
67
  children: [
69
- e.label && /* @__PURE__ */ t(
70
- b.GroupLabel,
68
+ e.label && /* @__PURE__ */ i(
69
+ v.GroupLabel,
71
70
  {
72
71
  className: d(
73
- p("dropdown-menu-header"),
72
+ l("dropdown-menu-header"),
74
73
  o?.groupLabel
75
74
  ),
76
- children: /* @__PURE__ */ t("span", { children: e.label })
75
+ children: /* @__PURE__ */ i("span", { children: e.label })
77
76
  }
78
77
  ),
79
- e.items.map((i, n) => l(i, r, n))
78
+ e.items.map((t, u) => p(t, r, u))
80
79
  ]
81
80
  },
82
81
  "group" + r
83
82
  ),
84
- [p, o, l]
85
- ), w = m(
86
- (e, r) => e.label ? /* @__PURE__ */ t(
87
- L.Group,
83
+ [l, o, p]
84
+ ), S = m(
85
+ (e, r) => e.label ? /* @__PURE__ */ w(
86
+ f.Group,
88
87
  {
89
- className: d(p("dropdown-menu-group"), o?.group),
90
- heading: /* @__PURE__ */ t(
91
- "div",
92
- {
93
- className: d(
94
- p("dropdown-menu-header"),
95
- o?.groupLabel
96
- ),
97
- children: /* @__PURE__ */ t("span", { children: e.label })
98
- }
99
- ),
100
- children: e.items.map((i, n) => l(i, r, n))
88
+ className: d(l("dropdown-menu-group"), o?.group),
89
+ items: e.items,
90
+ children: [
91
+ /* @__PURE__ */ i(
92
+ f.GroupLabel,
93
+ {
94
+ className: d(
95
+ l("dropdown-menu-header"),
96
+ o?.groupLabel
97
+ ),
98
+ children: /* @__PURE__ */ i("span", { children: e.label })
99
+ }
100
+ ),
101
+ /* @__PURE__ */ i(f.Collection, { children: (t, u) => p(t, r, u) })
102
+ ]
101
103
  },
102
104
  "group" + r
103
- ) : e.items.map((i, n) => l(i, r, n)),
104
- [p, o, l]
105
+ ) : e.items.map((t, u) => p(t, r, u)),
106
+ [l, o, p]
105
107
  );
106
108
  return {
107
- itemGroups: S(
108
- () => f.reduce((e, r) => (e.length === 0 && r.type !== "header" && e.push({
109
+ itemGroups: L(
110
+ () => s.reduce((e, r) => (e.length === 0 && r.type !== "header" && e.push({
109
111
  label: null,
110
112
  items: []
111
113
  }), r.type === "header" ? e.push({
112
114
  label: r.title,
113
115
  items: []
114
- }) : (r.type === "item" || r.type === "divider") && e.length > 0 && e[e.length - 1].items.push(r), e), []),
115
- [f]
116
+ }) : (r.type === "item" || r.type === "divider") && e.length > 0 && e[e.length - 1].items.push({
117
+ ...r
118
+ }), e), []),
119
+ [s]
116
120
  ),
117
- renderMenuItem: l,
118
- renderGroup: u ? w : v
121
+ renderMenuItem: p,
122
+ renderGroup: n ? S : D
119
123
  };
120
124
  };
121
125
  export {
122
- U as useDropdownMenu
126
+ J as useDropdownMenu
123
127
  };
124
128
  //# sourceMappingURL=useDropdownMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDropdownMenu.js","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\nimport { DropdownMenuItemType, DropdownMenuGroup } from \"./types\";\nimport { DropdownMenuItem } from \"./item\";\nimport { DropdownMenuDivider } from \"./divider\";\nimport { reactNodeToString, clsx, useCls } from \"../utils\";\nimport { Menu } from \"@base-ui-components/react\";\nimport { Command } from \"../cmdk\";\n\nimport \"./style.css\";\n\nexport interface UseDropdownMenuProps {\n /**\n * Callback function to handle the open state change of the dropdown menu.\n */\n onOpenChange?: (open: boolean) => void;\n items: DropdownMenuItemType[];\n inCombobox?: boolean;\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemSuffix?: string;\n group?: string;\n groupLabel?: string;\n divider?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Custom render function for menu item labels\n */\n itemLabelRender?: (\n item: DropdownMenuItemType & { type: \"item\" },\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Whether to keep the dropdown open when an item is selected\n * @default false\n */\n keepOpenOnSelect?: boolean;\n /**\n * Control the highlighted state of the menu item\n */\n highlightedItemKey?: React.Key;\n /**\n * Control the selected state of the menu item\n */\n selectedItemKeys?: React.Key[];\n /**\n * Whether to show checkbox\n * @default false\n */\n showCheckbox?: boolean;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [String(item.key), reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: DropdownMenuItemType & { type: \"item\" }) => string[];\n}\n\nexport const useDropdownMenu = ({\n items,\n inCombobox = false,\n classNames = {},\n selectedItemKeys,\n keepOpenOnSelect,\n showCheckbox = false,\n getItemKeywords = (item) => [String(item.key), reactNodeToString(item.label)],\n onOpenChange,\n itemRender,\n itemLabelRender,\n}: UseDropdownMenuProps) => {\n const cls = useCls();\n const renderMenuItem = useCallback(\n (item: DropdownMenuItemType, i: number, j: number) => {\n if (item.type === \"item\") {\n return (\n <DropdownMenuItem\n key={i + \"-\" + j}\n item={item}\n inCombobox={inCombobox}\n selected={selectedItemKeys?.includes(item.key)}\n afterSelect={() => {\n if (!keepOpenOnSelect) onOpenChange?.(false);\n }}\n itemRender={itemRender}\n showCheckbox={showCheckbox}\n getItemKeywords={getItemKeywords}\n itemLabelRender={itemLabelRender}\n classNames={{\n item: classNames.item,\n itemIcon: classNames.itemIcon,\n itemSuffix: classNames.itemSuffix,\n }}\n />\n );\n } else if (item.type === \"divider\") {\n return (\n <DropdownMenuDivider\n key={i + \"-\" + j}\n inCombobox={inCombobox}\n className={classNames?.divider}\n />\n );\n }\n return null;\n },\n [\n classNames,\n itemRender,\n onOpenChange,\n inCombobox,\n keepOpenOnSelect,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n itemLabelRender,\n ]\n );\n\n const renderGroup = useCallback(\n (group: DropdownMenuGroup, index: number) => (\n <Menu.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n >\n {group.label && (\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Menu.Group>\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderGroupCombobox = useCallback(\n (group: DropdownMenuGroup, index: number) =>\n group.label ? (\n <Command.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n heading={\n <div\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </div>\n }\n >\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Command.Group>\n ) : (\n group.items.map((item, j) => renderMenuItem(item, index, j))\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const itemGroups = useMemo(\n () =>\n items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push(current);\n }\n // Skip dividers\n return acc;\n }, []),\n [items]\n );\n return {\n itemGroups,\n renderMenuItem,\n renderGroup: inCombobox ? renderGroupCombobox : renderGroup,\n };\n};\n"],"names":["useDropdownMenu","items","inCombobox","classNames","selectedItemKeys","keepOpenOnSelect","showCheckbox","getItemKeywords","item","reactNodeToString","onOpenChange","itemRender","itemLabelRender","cls","useCls","renderMenuItem","useCallback","i","j","jsx","DropdownMenuItem","DropdownMenuDivider","renderGroup","group","index","jsxs","Menu","clsx","renderGroupCombobox","Command","useMemo","acc","current"],"mappings":";;;;;;;;;;AAgEO,MAAMA,IAAkB,CAAC;AAAA,EAC9B,OAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa,CAAA;AAAA,EACb,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,iBAAAC,IAAkB,CAACC,MAAS,CAAC,OAAOA,EAAK,GAAG,GAAGC,EAAkBD,EAAK,KAAK,CAAC;AAAA,EAC5E,cAAAE;AAAA,EACA,YAAAC;AAAA,EACA,iBAAAC;AACF,MAA4B;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,SAAS,CAAC,EAAE,MAAM,KAAKC,CAAO,GAGjCD,IACN,CAAA,CAAE;AAAA,MACP,CAAC9B,CAAK;AAAA,IAAA;AAAA,IAIN,gBAAAc;AAAA,IACA,aAAab,IAAa0B,IAAsBN;AAAA,EAAA;AAEpD;"}
1
+ {"version":3,"file":"useDropdownMenu.js","sources":["../../../src/components/dropdown-menu/useDropdownMenu.tsx"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\nimport { DropdownMenuItemType, DropdownMenuGroup } from \"./types\";\nimport { DropdownMenuItem } from \"./item\";\nimport { DropdownMenuDivider } from \"./divider\";\nimport { reactNodeToString, clsx, useCls } from \"../utils\";\nimport { Combobox, Menu } from \"@base-ui/react\";\n\nimport \"./style.css\";\n\nexport interface UseDropdownMenuProps {\n /**\n * Callback function to handle the open state change of the dropdown menu.\n */\n onOpenChange?: (open: boolean) => void;\n items: DropdownMenuItemType[];\n inCombobox?: boolean;\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemSuffix?: string;\n group?: string;\n groupLabel?: string;\n divider?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Custom render function for menu item labels\n */\n itemLabelRender?: (\n item: DropdownMenuItemType & { type: \"item\" },\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /**\n * Whether to keep the dropdown open when an item is selected\n * @default false\n */\n keepOpenOnSelect?: boolean;\n /**\n * Control the highlighted state of the menu item\n */\n highlightedItemKey?: React.Key;\n /**\n * Control the selected state of the menu item\n */\n selectedItemKeys?: React.Key[];\n /**\n * Whether to show checkbox\n * @default false\n */\n showCheckbox?: boolean;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [String(item.key), reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: DropdownMenuItemType & { type: \"item\" }) => string[];\n}\n\nexport const useDropdownMenu = ({\n items,\n inCombobox = false,\n classNames = {},\n selectedItemKeys,\n keepOpenOnSelect,\n showCheckbox = false,\n getItemKeywords = (item) => [String(item.key), reactNodeToString(item.label)],\n onOpenChange,\n itemRender,\n itemLabelRender,\n}: UseDropdownMenuProps) => {\n const cls = useCls();\n const renderMenuItem = useCallback(\n (item: DropdownMenuItemType, i: number, j: number) => {\n if (item.type === \"item\") {\n return (\n <DropdownMenuItem\n key={i + \"-\" + j}\n item={item}\n inCombobox={inCombobox}\n selected={selectedItemKeys?.includes(item.key)}\n afterSelect={() => {\n if (!keepOpenOnSelect) onOpenChange?.(false);\n }}\n itemRender={itemRender}\n showCheckbox={showCheckbox}\n getItemKeywords={getItemKeywords}\n itemLabelRender={itemLabelRender}\n classNames={{\n item: classNames.item,\n itemIcon: classNames.itemIcon,\n itemSuffix: classNames.itemSuffix,\n }}\n />\n );\n } else if (item.type === \"divider\") {\n return (\n <DropdownMenuDivider\n key={i + \"-\" + j}\n inCombobox={inCombobox}\n className={classNames?.divider}\n />\n );\n }\n return null;\n },\n [\n classNames,\n itemRender,\n onOpenChange,\n inCombobox,\n keepOpenOnSelect,\n selectedItemKeys,\n showCheckbox,\n getItemKeywords,\n itemLabelRender,\n ]\n );\n\n const renderGroup = useCallback(\n (group: DropdownMenuGroup, index: number) => (\n <Menu.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n >\n {group.label && (\n <Menu.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => renderMenuItem(item, index, j))}\n </Menu.Group>\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const renderGroupCombobox = useCallback(\n (group: DropdownMenuGroup, index: number) =>\n group.label ? (\n <Combobox.Group\n key={\"group\" + index}\n className={clsx(cls(\"dropdown-menu-group\"), classNames?.group)}\n items={group.items}\n >\n <Combobox.GroupLabel\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Combobox.GroupLabel>\n <Combobox.Collection>\n {(item, i) => renderMenuItem(item, index, i)}\n </Combobox.Collection>\n </Combobox.Group>\n ) : (\n group.items.map((item, j) => renderMenuItem(item, index, j))\n ),\n [cls, classNames, renderMenuItem]\n );\n\n const itemGroups = useMemo(\n () =>\n items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push({\n ...current,\n });\n }\n // Skip dividers\n return acc;\n }, []),\n [items]\n );\n return {\n itemGroups,\n renderMenuItem,\n renderGroup: inCombobox ? renderGroupCombobox : renderGroup,\n };\n};\n"],"names":["useDropdownMenu","items","inCombobox","classNames","selectedItemKeys","keepOpenOnSelect","showCheckbox","getItemKeywords","item","reactNodeToString","onOpenChange","itemRender","itemLabelRender","cls","useCls","renderMenuItem","useCallback","i","j","jsx","DropdownMenuItem","DropdownMenuDivider","renderGroup","group","index","jsxs","Menu","clsx","renderGroupCombobox","Combobox","useMemo","acc","current"],"mappings":";;;;;;;;;AA+DO,MAAMA,IAAkB,CAAC;AAAA,EAC9B,OAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa,CAAA;AAAA,EACb,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,iBAAAC,IAAkB,CAACC,MAAS,CAAC,OAAOA,EAAK,GAAG,GAAGC,EAAkBD,EAAK,KAAK,CAAC;AAAA,EAC5E,cAAAE;AAAA,EACA,YAAAC;AAAA,EACA,iBAAAC;AACF,MAA4B;AAC1B,QAAMC,IAAMC,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UA,EAAQ,SAAS,cAC7CD,EAAI,SAAS,KAEbA,EAAIA,EAAI,SAAS,CAAC,EAAE,MAAM,KAAK;AAAA,QAC7B,GAAGC;AAAA,MAAA,CACJ,GAGID,IACN,CAAA,CAAE;AAAA,MACP,CAAC9B,CAAK;AAAA,IAAA;AAAA,IAIN,gBAAAc;AAAA,IACA,aAAab,IAAa0B,IAAsBN;AAAA,EAAA;AAEpD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"antd.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/antd.ts"],"names":[],"mappings":"AAGA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,eAAO,MAAM,QAAQ;kBAGkB,qBAEnC,eAAe,wBAAa,oBACd,wBAAa;;;CANO,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEtD,eAAO,MAAM,UAAU,2DAGtB,CAAC;AAEF,eAAO,MAAM,QAAQ,gDAGpB,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"antd.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/antd.ts"],"names":[],"mappings":"AAGA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,eAAO,MAAM,QAAQ;;;;CAAiB,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEtD,eAAO,MAAM,UAAU,2DAGtB,CAAC;AAEF,eAAO,MAAM,QAAQ,gDAGpB,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -8,4 +8,5 @@ export * from './useDraggable';
8
8
  export * from './useBreakpoint';
9
9
  export * from './useWindowSize';
10
10
  export * from './useResizeObserver';
11
+ export * from './useBaseUIPlacement';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}