@bioturing/components 0.31.0 → 0.32.0

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.
@@ -1,21 +1,21 @@
1
1
  "use client";
2
2
  import { jsxs as i, jsx as n } from "react/jsx-runtime";
3
- import { useRef as T, useCallback as U, createElement as W } from "react";
4
- import { Menu as q } from "@base-ui-components/react/menu";
5
- import { Popover as H } from "@base-ui-components/react/popover";
3
+ import { useRef as U, useCallback as W, createElement as q } from "react";
4
+ import { Menu as H } from "@base-ui-components/react/menu";
5
+ import { Popover as J } from "@base-ui-components/react/popover";
6
6
  import { Command as d } from "../cmdk/index.js";
7
- import { FormItemInputContext as J } from "antd/es/form/context";
7
+ import { FormItemInputContext as Q } from "antd/es/form/context";
8
8
  import { PopupPanelSize as b } from "../popup-panel/constants.js";
9
- import { useDropdownMenu as Q } from "./useDropdownMenu.js";
9
+ import { useDropdownMenu as X } from "./useDropdownMenu.js";
10
10
  import './style.css';/* empty css */
11
- import { parseAntdPlacement as X } from "../utils/placement.js";
12
- import { Input as Y } from "../input/component.js";
11
+ import { parseAntdPlacement as Y } from "../utils/placement.js";
12
+ import { Input as Z } from "../input/component.js";
13
13
  import { ScrollArea as h } from "../scroll-area/component.js";
14
- import { DROPDOWN_COLLISION_AVOIDANCE as Z } from "../utils/constants.js";
15
- import { useControlledState as $ } from "../hooks/useControlledState.js";
16
- import { useCls as K, useAntdCssVarClassname as a } from "../utils/antdUtils.js";
14
+ import { DROPDOWN_COLLISION_AVOIDANCE as $ } from "../utils/constants.js";
15
+ import { useControlledState as K } from "../hooks/useControlledState.js";
16
+ import { useCls as a, useAntdCssVarClassname as N } from "../utils/antdUtils.js";
17
17
  import { clsx as l } from "../utils/cn.js";
18
- const vo = ({
18
+ const Io = ({
19
19
  children: A,
20
20
  items: S,
21
21
  placement: D,
@@ -39,20 +39,22 @@ const vo = ({
39
39
  highlightedItemKey: m,
40
40
  selectedItemKeys: G,
41
41
  getItemKeywords: _,
42
- showCheckbox: I
42
+ showCheckbox: I,
43
+ itemLabelRender: z
43
44
  }) => {
44
- const z = typeof w == "boolean" ? w : e, [B, P] = $(
45
+ const B = typeof w == "boolean" ? w : e, [F, P] = K(
45
46
  c,
46
47
  M,
47
48
  R
48
- ), r = K(), x = a(), O = X(D), F = T(null), { itemGroups: f, renderGroup: g } = Q({
49
+ ), r = a(), x = N(), O = Y(D), L = U(null), { itemGroups: f, renderGroup: g } = X({
49
50
  items: S,
50
51
  keepOpenOnSelect: j,
51
52
  selectedItemKeys: G,
52
53
  showCheckbox: I,
53
54
  getItemKeywords: _,
55
+ itemLabelRender: z,
54
56
  itemRender: k,
55
- inCombobox: z,
57
+ inCombobox: B,
56
58
  onOpenChange: P,
57
59
  classNames: {
58
60
  item: o == null ? void 0 : o.item,
@@ -62,7 +64,7 @@ const vo = ({
62
64
  groupLabel: o == null ? void 0 : o.groupLabel,
63
65
  divider: o == null ? void 0 : o.divider
64
66
  }
65
- }), L = U(
67
+ }), T = W(
66
68
  () => e ? /* @__PURE__ */ i(
67
69
  d,
68
70
  {
@@ -70,13 +72,13 @@ const vo = ({
70
72
  disablePointerSelection: e,
71
73
  defaultValue: m ? String(m) : void 0,
72
74
  children: [
73
- /* @__PURE__ */ n(J.Provider, { value: {}, children: /* @__PURE__ */ W(
75
+ /* @__PURE__ */ n(Q.Provider, { value: {}, children: /* @__PURE__ */ q(
74
76
  d.Input,
75
77
  {
76
78
  ...v,
77
79
  key: "search",
78
80
  render: /* @__PURE__ */ n(
79
- Y,
81
+ Z,
80
82
  {
81
83
  allowClear: !0,
82
84
  className: r("dropdown-menu-search"),
@@ -108,19 +110,19 @@ const vo = ({
108
110
  u,
109
111
  g
110
112
  ]
111
- ), t = e ? H : q;
113
+ ), t = e ? J : H;
112
114
  return /* @__PURE__ */ i(
113
115
  t.Root,
114
116
  {
115
117
  openOnHover: E,
116
- open: B,
118
+ open: F,
117
119
  onOpenChange: P,
118
120
  children: [
119
121
  /* @__PURE__ */ n(
120
122
  t.Trigger,
121
123
  {
122
124
  render: A,
123
- ref: F,
125
+ ref: L,
124
126
  className: l(
125
127
  r("dropdown-menu-trigger"),
126
128
  o == null ? void 0 : o.trigger,
@@ -135,7 +137,7 @@ const vo = ({
135
137
  align: O.align,
136
138
  sideOffset: 4,
137
139
  className: l(r("dropdown-menu-root"), o == null ? void 0 : o.root),
138
- collisionAvoidance: Z,
140
+ collisionAvoidance: $,
139
141
  children: /* @__PURE__ */ n(
140
142
  t.Popup,
141
143
  {
@@ -152,7 +154,7 @@ const vo = ({
152
154
  style: {
153
155
  "--size-width": C in b ? b[C] : void 0
154
156
  },
155
- children: L()
157
+ children: T()
156
158
  }
157
159
  )
158
160
  }
@@ -162,6 +164,6 @@ const vo = ({
162
164
  );
163
165
  };
164
166
  export {
165
- vo as DropdownMenu
167
+ Io as DropdownMenu
166
168
  };
167
169
  //# sourceMappingURL=component.js.map
@@ -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 useAntdCssVarClassname,\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 \"./style.css\";\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,\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}: 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 antdCssVarClassname = useAntdCssVarClassname();\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 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 >\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 openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <BaseComponent.Trigger\n render={children}\n ref={buttonRef}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n antdCssVarClassname,\n )}\n />\n <BaseComponent.Portal>\n <BaseComponent.Positioner\n side={baseUIPlacement.side}\n align={baseUIPlacement.align}\n sideOffset={4}\n className={clsx(cls(\"dropdown-menu-root\"), classNames?.root)}\n collisionAvoidance={DROPDOWN_COLLISION_AVOIDANCE}\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 antdCssVarClassname,\n )}\n style={\n {\n \"--size-width\":\n size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\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","inCombobox","open","onOpenChange","useControlledState","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","baseUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","renderGroup","useDropdownMenu","renderMenuInner","useCallback","jsxs","Command","jsx","FormItemInputContext","createElement","Input","ScrollArea","BaseComponent","Popover","Menu","clsx","DROPDOWN_COLLISION_AVOIDANCE","PopupPanelSize"],"mappings":";;;;;;;;;;;;;;;;;AAuGO,MAAMA,KAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,YAAAC;AAAA,EACA,YAAYC;AAA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,cACZmB;AAAA,YAAA;AAAA,UACF;AAAA,QACF;AAAA,QACA,gBAAAa,EAACK,EAAc,QAAd,EACC,UAAA,gBAAAL;AAAA,UAACK,EAAc;AAAA,UAAd;AAAA,YACC,MAAMhB,EAAgB;AAAA,YACtB,OAAOA,EAAgB;AAAA,YACvB,YAAY;AAAA,YACZ,WAAWmB,EAAKvB,EAAI,oBAAoB,GAAGjB,KAAA,gBAAAA,EAAY,IAAI;AAAA,YAC3D,oBAAoByC;AAAA,YAEpB,UAAA,gBAAAT;AAAA,cAACK,EAAc;AAAA,cAAd;AAAA,gBACC,WAAWG;AAAA,kBACTvB;AAAA,oBACE;AAAA,oBACAL,KAAgB;AAAA,oBAChBP,KAA0B;AAAA,kBAC5B;AAAA,kBACAP;AAAA,kBACAE,KAAA,gBAAAA,EAAY;AAAA,kBACZmB;AAAA,gBACF;AAAA,gBACA,OACE;AAAA,kBACE,gBACElB,KAAQyC,IAAiBA,EAAezC,CAAI,IAAI;AAAA,gBACpD;AAAA,gBAGD,UAAgB2B,EAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACnB;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
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 useAntdCssVarClassname,\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 \"./style.css\";\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,\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 antdCssVarClassname = useAntdCssVarClassname();\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 openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <BaseComponent.Trigger\n render={children}\n ref={buttonRef}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n antdCssVarClassname\n )}\n />\n <BaseComponent.Portal>\n <BaseComponent.Positioner\n side={baseUIPlacement.side}\n align={baseUIPlacement.align}\n sideOffset={4}\n className={clsx(cls(\"dropdown-menu-root\"), classNames?.root)}\n collisionAvoidance={DROPDOWN_COLLISION_AVOIDANCE}\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 antdCssVarClassname\n )}\n style={\n {\n \"--size-width\":\n size in PopupPanelSize ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\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","antdCssVarClassname","useAntdCssVarClassname","baseUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","renderGroup","useDropdownMenu","renderMenuInner","useCallback","jsxs","Command","jsx","FormItemInputContext","createElement","Input","ScrollArea","BaseComponent","Popover","Menu","clsx","DROP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B;AAAA,MACAoB;AAAA,IAAA;AAAA,EAEJ,GACMW,IAAgBpC,IAAaqC,IAAUC;AAG3C,SAAA,gBAAAT;AAAA,IAACO,EAAc;AAAA,IAAd;AAAA,MACC,aAAA5C;AAAA,MACA,MAAAqB;AAAA,MACA,cAAAC;AAAA,MAEA,UAAA;AAAA,QAAA,gBAAAiB;AAAA,UAACK,EAAc;AAAA,UAAd;AAAA,YACC,QAAQ/C;AAAA,YACR,KAAKiC;AAAA,YACL,WAAWiB;AAAA,cACTvB,EAAI,uBAAuB;AAAA,cAC3BlB,KAAA,gBAAAA,EAAY;AAAA,cACZoB;AAAA,YAAA;AAAA,UACF;AAAA,QACF;AAAA,QACA,gBAAAa,EAACK,EAAc,QAAd,EACC,UAAA,gBAAAL;AAAA,UAACK,EAAc;AAAA,UAAd;AAAA,YACC,MAAMhB,EAAgB;AAAA,YACtB,OAAOA,EAAgB;AAAA,YACvB,YAAY;AAAA,YACZ,WAAWmB,EAAKvB,EAAI,oBAAoB,GAAGlB,KAAA,gBAAAA,EAAY,IAAI;AAAA,YAC3D,oBAAoB0C;AAAA,YAEpB,UAAA,gBAAAT;AAAA,cAACK,EAAc;AAAA,cAAd;AAAA,gBACC,WAAWG;AAAA,kBACTvB;AAAA,oBACE;AAAA,oBACAN,KAAgB;AAAA,oBAChBP,KAA0B;AAAA,kBAC5B;AAAA,kBACAP;AAAA,kBACAE,KAAA,gBAAAA,EAAY;AAAA,kBACZoB;AAAA,gBACF;AAAA,gBACA,OACE;AAAA,kBACE,gBACEnB,KAAQ0C,IAAiBA,EAAe1C,CAAI,IAAI;AAAA,gBACpD;AAAA,gBAGD,UAAgB4B,EAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACnB;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1,38 +1,40 @@
1
1
  "use client";
2
- import { jsxs as I, Fragment as h, jsx as r } from "react/jsx-runtime";
3
- import { useMemo as e } from "react";
4
- import { Command as j } from "../cmdk/index.js";
5
- import { Menu as E } from "@base-ui-components/react/menu";
2
+ import { jsxs as w, Fragment as y, jsx as r } from "react/jsx-runtime";
3
+ import { useMemo as h } from "react";
4
+ import { Command as q } from "../cmdk/index.js";
5
+ import { Menu as z } from "@base-ui-components/react/menu";
6
6
  import './item.css';/* empty css */
7
- import { Checkbox as w } from "antd";
8
- import { reactNodeToString as L } from "../utils/reactToString.js";
9
- import { useCls as D } from "../utils/antdUtils.js";
10
- import { clsx as u } from "../utils/cn.js";
11
- const J = ({
7
+ import { Checkbox as O } from "antd";
8
+ import { reactNodeToString as T } from "../utils/reactToString.js";
9
+ import { useCls as A } from "../utils/antdUtils.js";
10
+ import { clsx as M } from "../utils/cn.js";
11
+ import { WithRenderProp as j } from "../utils/WithRenderProp.js";
12
+ const Z = ({
12
13
  item: o,
13
14
  inCombobox: p = !1,
14
- selected: f = !1,
15
- itemRender: t,
16
- itemProps: S = {},
15
+ selected: v = !1,
16
+ itemRender: u,
17
+ itemLabelRender: f,
18
+ itemProps: E = {},
17
19
  classNames: n,
18
- onSelect: k,
19
- showCheckbox: x,
20
- indeterminate: M,
21
- renderAsNativeElement: y,
22
- getItemKeywords: g
20
+ onSelect: S,
21
+ showCheckbox: t,
22
+ indeterminate: g,
23
+ renderAsNativeElement: P,
24
+ getItemKeywords: i
23
25
  }) => {
24
- const d = D(), O = e(
25
- () => p ? j.Item : E.Item,
26
+ const d = A(), D = h(
27
+ () => p ? q.Item : z.Item,
26
28
  [p]
27
- ), i = e(() => ({
28
- className: u(
29
+ ), x = h(() => ({
30
+ className: M(
29
31
  d("dropdown-menu-item", p && "dropdown-menu-item-combobox"),
30
32
  n == null ? void 0 : n.item,
31
33
  o.className
32
34
  ),
33
35
  disabled: o.disabled,
34
36
  "data-danger": o.danger,
35
- "data-actual-selected": f,
37
+ "data-actual-selected": v,
36
38
  ref: o.ref,
37
39
  onClick: o.onClick,
38
40
  onMouseEnter: o.onMouseEnter,
@@ -40,20 +42,20 @@ const J = ({
40
42
  onMouseOver: o.onMouseOver,
41
43
  onMouseOut: o.onMouseOut,
42
44
  "data-value": typeof o.label == "string" ? o.label : String(o.key),
43
- render: t ? (b) => t(o, b) : void 0,
44
- children: p ? /* @__PURE__ */ I(h, { children: [
45
- x && /* @__PURE__ */ r(
46
- w,
45
+ render: u ? (k) => u(o, k) : void 0,
46
+ children: p ? /* @__PURE__ */ w(y, { children: [
47
+ t && /* @__PURE__ */ r(
48
+ O,
47
49
  {
48
- checked: f,
50
+ checked: v,
49
51
  tabIndex: -1,
50
- indeterminate: M
52
+ indeterminate: g
51
53
  }
52
54
  ),
53
55
  o.icon && /* @__PURE__ */ r(
54
56
  "span",
55
57
  {
56
- className: u(
58
+ className: M(
57
59
  d("dropdown-menu-item-icon"),
58
60
  n == null ? void 0 : n.itemIcon
59
61
  ),
@@ -61,28 +63,30 @@ const J = ({
61
63
  }
62
64
  ),
63
65
  /* @__PURE__ */ r(
64
- "span",
66
+ j,
65
67
  {
66
- className: u(
68
+ render: f ? (k) => f(o, k) : void 0,
69
+ as: "span",
70
+ className: M(
67
71
  d("dropdown-menu-item-text"),
68
72
  n == null ? void 0 : n.itemText
69
73
  ),
70
74
  children: o.label
71
75
  }
72
76
  )
73
- ] }) : /* @__PURE__ */ I(h, { children: [
74
- x && /* @__PURE__ */ r(
75
- w,
77
+ ] }) : /* @__PURE__ */ w(y, { children: [
78
+ t && /* @__PURE__ */ r(
79
+ O,
76
80
  {
77
- checked: f,
81
+ checked: v,
78
82
  tabIndex: -1,
79
- indeterminate: M
83
+ indeterminate: g
80
84
  }
81
85
  ),
82
86
  o.icon && /* @__PURE__ */ r(
83
87
  "span",
84
88
  {
85
- className: u(
89
+ className: M(
86
90
  d("dropdown-menu-item-icon"),
87
91
  n == null ? void 0 : n.itemIcon
88
92
  ),
@@ -90,19 +94,17 @@ const J = ({
90
94
  }
91
95
  ),
92
96
  /* @__PURE__ */ r(
93
- "span",
97
+ j,
94
98
  {
95
- className: u(
96
- d("dropdown-menu-item-text"),
97
- n == null ? void 0 : n.itemText
98
- ),
99
+ render: f ? (k) => f(o, k) : void 0,
100
+ as: "span",
99
101
  children: o.label
100
102
  }
101
103
  ),
102
104
  o.suffix && /* @__PURE__ */ r(
103
105
  "span",
104
106
  {
105
- className: u(
107
+ className: M(
106
108
  d("dropdown-menu-item-suffix"),
107
109
  n == null ? void 0 : n.itemSuffix
108
110
  ),
@@ -117,31 +119,38 @@ const J = ({
117
119
  n == null ? void 0 : n.itemSuffix,
118
120
  d,
119
121
  p,
120
- M,
122
+ g,
121
123
  o,
124
+ u,
125
+ v,
122
126
  t,
123
- f,
124
- x
125
- ]);
126
- if (t)
127
- return t(o, {
128
- ...i,
129
- ...S
127
+ f
128
+ ]), F = h(
129
+ () => i ? i(o) : [String(o.key), T(o.label)],
130
+ [i, o]
131
+ );
132
+ if (u)
133
+ return console.log(u), u(o, {
134
+ ...x,
135
+ ...E
130
136
  });
131
- const { render: v, ...T } = i;
132
- return y ? v ? v(i) : /* @__PURE__ */ r("div", { onClick: k, ...T }) : /* @__PURE__ */ r(
133
- O,
137
+ const { render: I, ...W } = x;
138
+ return console.log(
139
+ "keywords",
140
+ i ? i(o) : [String(o.key), T(o.label)]
141
+ ), P ? I ? I(x) : /* @__PURE__ */ r("div", { onClick: S, ...W }) : /* @__PURE__ */ r(
142
+ D,
134
143
  {
135
144
  value: String(o.key),
136
- keywords: g ? g(o) : [String(o.key), L(o.label)],
145
+ keywords: F || void 0,
137
146
  onSelect: () => {
138
- k(o);
147
+ S(o);
139
148
  },
140
- ...i
149
+ ...x
141
150
  }
142
151
  );
143
152
  };
144
153
  export {
145
- J as DropdownMenuItem
154
+ Z as DropdownMenuItem
146
155
  };
147
156
  //# 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, useMemo } from \"react\";\nimport { clsx, reactNodeToString, useCls } from \"../utils\";\nimport type { DropdownMenuItemType } from \"./types\";\nimport { Command } from \"../cmdk\";\nimport { Menu } from \"@base-ui-components/react/menu\";\n\nimport \"./item.css\";\nimport { Checkbox } from \"antd\";\n\nexport interface DropdownMenuItemProps {\n /** The menu item data */\n item: DropdownMenuItemType & { type: \"item\" };\n /** Custom render function for the item */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>,\n ) => React.ReactElement;\n /** Additional props to pass to the item */\n itemProps?: React.HTMLAttributes<HTMLElement>;\n /** Class names from parent DropdownMenu */\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemText?: string;\n itemSuffix?: string;\n };\n onSelect?: (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 in a menu\n */\n renderAsNativeElement?: 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 itemProps = {},\n classNames,\n onSelect,\n showCheckbox,\n indeterminate,\n renderAsNativeElement,\n getItemKeywords,\n}) => {\n const cls = useCls();\n\n const MenuItem = useMemo(\n () => (inCombobox ? Command.Item : Menu.Item),\n [inCombobox],\n );\n\n const props = useMemo(() => {\n return {\n className: clsx(\n cls(\"dropdown-menu-item\", inCombobox && \"dropdown-menu-item-combobox\"),\n classNames?.item,\n item.className,\n ),\n disabled: item.disabled,\n \"data-danger\": item.danger,\n \"data-actual-selected\": selected,\n ref: item.ref as Ref<HTMLDivElement>,\n onClick: item.onClick,\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 render: itemRender\n ? (itemProps: React.HTMLAttributes<HTMLElement>) =>\n itemRender(item, itemProps)\n : undefined,\n children: inCombobox ? (\n <>\n {showCheckbox && (\n <Checkbox\n checked={selected}\n tabIndex={-1}\n indeterminate={indeterminate}\n />\n )}\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon,\n )}\n >\n {item.icon}\n </span>\n )}\n <span\n className={clsx(\n cls(\"dropdown-menu-item-text\"),\n classNames?.itemText,\n )}\n >\n {item.label}\n </span>\n </>\n ) : (\n <>\n {showCheckbox && (\n <Checkbox\n checked={selected}\n tabIndex={-1}\n indeterminate={indeterminate}\n />\n )}\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon,\n )}\n >\n {item.icon}\n </span>\n )}\n <span\n className={clsx(\n cls(\"dropdown-menu-item-text\"),\n classNames?.itemText,\n )}\n >\n {item.label}\n </span>\n {item.suffix && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-suffix\"),\n classNames?.itemSuffix,\n )}\n >\n {item.suffix}\n </span>\n )}\n </>\n ),\n };\n }, [\n classNames?.item,\n classNames?.itemIcon,\n classNames?.itemText,\n classNames?.itemSuffix,\n cls,\n inCombobox,\n indeterminate,\n item,\n itemRender,\n selected,\n showCheckbox,\n ]);\n // If custom render function is provided, use it\n if (itemRender) {\n return itemRender(item, {\n ...props,\n ...itemProps,\n });\n }\n const { render, ...restProps } = props;\n // Default rendering\n return renderAsNativeElement ? (\n render ? (\n render(props)\n ) : (\n <div onClick={onSelect} {...restProps} />\n )\n ) : (\n <MenuItem\n value={String(item.key)}\n keywords={\n getItemKeywords\n ? getItemKeywords(item)\n : [String(item.key), reactNodeToString(item.label)]\n }\n onSelect={() => {\n onSelect(item);\n }}\n {...props}\n ></MenuItem>\n );\n};\n"],"names":["DropdownMenuItem","item","inCombobox","selected","itemRender","itemProps","classNames","onSelect","showCheckbox","indeterminate","renderAsNativeElement","getItemKeywords","cls","useCls","MenuItem","useMemo","Command","Menu","props","clsx","jsxs","Fragment","jsx","Checkbox","render","restProps","reactNodeToString"],"mappings":";;;;;;;;;;AAyDO,MAAMA,IAAoD,CAAC;AAAA,EAChE,MAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,WAAAC,IAAY,CAAC;AAAA,EACb,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACJ,QAAMC,IAAMC,EAAO,GAEbC,IAAWC;AAAA,IACf,MAAOb,IAAac,EAAQ,OAAOC,EAAK;AAAA,IACxC,CAACf,CAAU;AAAA,EACb,GAEMgB,IAAQH,EAAQ,OACb;AAAA,IACL,WAAWI;AAAA,MACTP,EAAI,sBAAsBV,KAAc,6BAA6B;AAAA,MACrEI,KAAA,gBAAAA,EAAY;AAAA,MACZL,EAAK;AAAA,IACP;AAAA,IACA,UAAUA,EAAK;AAAA,IACf,eAAeA,EAAK;AAAA,IACpB,wBAAwBE;AAAA,IACxB,KAAKF,EAAK;AAAA,IACV,SAASA,EAAK;AAAA,IACd,cAAcA,EAAK;AAAA,IACnB,cAAcA,EAAK;AAAA,IACnB,aAAaA,EAAK;AAAA,IAClB,YAAYA,EAAK;AAAA,IACjB,cACE,OAAOA,EAAK,SAAU,WAAWA,EAAK,QAAQ,OAAOA,EAAK,GAAG;AAAA,IAC/D,QAAQG,IACJ,CAACC,MACCD,EAAWH,GAAMI,CAAS,IAC5B;AAAA,IACJ,UAAUH,IAEL,gBAAAkB,EAAAC,GAAA,EAAA,UAAA;AAA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EC,UAAKL,EAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACR,EAEJ,CAAA;AAAA,EAEJ,IACC;AAAA,IACDK,KAAA,gBAAAA,EAAY;AAAA,IACZA,KAAA,gBAAAA,EAAY;AAAA,IACZA,KAAA,gBAAAA,EAAY;AAAA,IACZA,KAAA,gBAAAA,EAAY;AAAA,IACZM;AAAA,IACAV;AAAA,IACAO;AAAA,IACAR;AAAA,IACAG;AAAA,IACAD;AAAA,IACAK;AAAA,EAAA,CACD;AAED,MAAIJ;AACF,WAAOA,EAAWH,GAAM;AAAA,MACtB,GAAGiB;AAAA,MACH,GAAGb;AAAA,IAAA,CACJ;AAEH,QAAM,EAAE,QAAAmB,GAAQ,GAAGC,EAAA,IAAcP;AAE1B,SAAAR,IACLc,IACEA,EAAON,CAAK,IAEX,gBAAAI,EAAA,OAAA,EAAI,SAASf,GAAW,GAAGkB,EAAA,CAAW,IAGzC,gBAAAH;AAAA,IAACR;AAAA,IAAA;AAAA,MACC,OAAO,OAAOb,EAAK,GAAG;AAAA,MACtB,UACEU,IACIA,EAAgBV,CAAI,IACpB,CAAC,OAAOA,EAAK,GAAG,GAAGyB,EAAkBzB,EAAK,KAAK,CAAC;AAAA,MAEtD,UAAU,MAAM;AACd,QAAAM,EAASN,CAAI;AAAA,MACf;AAAA,MACC,GAAGiB;AAAA,IAAA;AAAA,EACL;AAEL;"}
1
+ {"version":3,"file":"item.js","sources":["../../../src/components/dropdown-menu/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { Ref, useMemo } from \"react\";\nimport { clsx, reactNodeToString, useCls, WithRenderProp } from \"../utils\";\nimport type { DropdownMenuItemType } from \"./types\";\nimport { Command } from \"../cmdk\";\nimport { Menu } from \"@base-ui-components/react/menu\";\n\nimport \"./item.css\";\nimport { Checkbox } from \"antd\";\n\nexport interface DropdownMenuItemProps {\n /** The menu item data */\n item: DropdownMenuItemType & { type: \"item\" };\n /** Custom render function for the item */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n itemLabelRender?: (\n item: DropdownMenuItemType & { type: \"item\" },\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /** Additional props to pass to the item */\n itemProps?: React.HTMLAttributes<HTMLElement>;\n /** Class names from parent DropdownMenu */\n classNames?: {\n item?: string;\n itemIcon?: string;\n itemText?: string;\n itemSuffix?: string;\n };\n onSelect?: (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 in a menu\n */\n renderAsNativeElement?: 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 onSelect,\n showCheckbox,\n indeterminate,\n renderAsNativeElement,\n getItemKeywords,\n}) => {\n const cls = useCls();\n\n const MenuItem = useMemo(\n () => (inCombobox ? Command.Item : Menu.Item),\n [inCombobox]\n );\n\n const props = useMemo(() => {\n return {\n className: clsx(\n cls(\"dropdown-menu-item\", inCombobox && \"dropdown-menu-item-combobox\"),\n classNames?.item,\n item.className\n ),\n disabled: item.disabled,\n \"data-danger\": item.danger,\n \"data-actual-selected\": selected,\n ref: item.ref as Ref<HTMLDivElement>,\n onClick: item.onClick,\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 render: itemRender\n ? (itemProps: React.HTMLAttributes<HTMLElement>) =>\n itemRender(item, itemProps)\n : undefined,\n children: inCombobox ? (\n <>\n {showCheckbox && (\n <Checkbox\n checked={selected}\n tabIndex={-1}\n indeterminate={indeterminate}\n />\n )}\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n )}\n <WithRenderProp\n render={\n itemLabelRender\n ? (props) => itemLabelRender(item, props)\n : undefined\n }\n as={\"span\"}\n className={clsx(\n cls(\"dropdown-menu-item-text\"),\n classNames?.itemText\n )}\n >\n {item.label}\n </WithRenderProp>\n </>\n ) : (\n <>\n {showCheckbox && (\n <Checkbox\n checked={selected}\n tabIndex={-1}\n indeterminate={indeterminate}\n />\n )}\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n )}\n <WithRenderProp\n render={\n itemLabelRender\n ? (props) => itemLabelRender(item, props)\n : undefined\n }\n as={\"span\"}\n >\n {item.label}\n </WithRenderProp>\n {item.suffix && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-suffix\"),\n classNames?.itemSuffix\n )}\n >\n {item.suffix}\n </span>\n )}\n </>\n ),\n };\n }, [\n classNames?.item,\n classNames?.itemIcon,\n classNames?.itemText,\n classNames?.itemSuffix,\n cls,\n inCombobox,\n indeterminate,\n item,\n itemRender,\n selected,\n showCheckbox,\n itemLabelRender,\n ]);\n const keywords = useMemo(\n () =>\n getItemKeywords\n ? getItemKeywords(item)\n : [String(item.key), reactNodeToString(item.label)],\n [getItemKeywords, item]\n );\n // If custom render function is provided, use it\n if (itemRender) {\n console.log(itemRender);\n return itemRender(item, {\n ...props,\n ...itemProps,\n });\n }\n const { render, ...restProps } = props;\n console.log(\n \"keywords\",\n getItemKeywords\n ? getItemKeywords(item)\n : [String(item.key), reactNodeToString(item.label)]\n );\n // Default rendering\n return renderAsNativeElement ? (\n render ? (\n render(props)\n ) : (\n <div onClick={onSelect} {...restProps} />\n )\n ) : (\n <MenuItem\n value={String(item.key)}\n keywords={keywords || undefined}\n onSelect={() => {\n onSelect(item);\n }}\n {...props}\n ></MenuItem>\n );\n};\n"],"names":["DropdownMenuItem","item","inCombobox","selected","itemRender","itemLabelRender","itemProps","classNames","onSelect","showCheckbox","indeterminate","renderAsNativeElement","getItemKeywords","cls","useCls","MenuItem","useMemo","Command","Menu","props","clsx","jsxs","Fragment","jsx","Checkbox","WithRenderProp","keywords","reactNodeToString","render","restProps"],"mappings":";;;;;;;;;;;AA6DO,MAAMA,IAAoD,CAAC;AAAA,EAChE,MAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC,IAAY,CAAC;AAAA,EACb,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACJ,QAAMC,IAAMC,EAAO,GAEbC,IAAWC;AAAA,IACf,MAAOd,IAAae,EAAQ,OAAOC,EAAK;AAAA,IACxC,CAAChB,CAAU;AAAA,EACb,GAEMiB,IAAQH,EAAQ,OACb;AAAA,IACL,WAAWI;AAAA,MACTP,EAAI,sBAAsBX,KAAc,6BAA6B;AAAA,MACrEK,KAAA,gBAAAA,EAAY;AAAA,MACZN,EAAK;AAAA,IACP;AAAA,IACA,UAAUA,EAAK;AAAA,IACf,eAAeA,EAAK;AAAA,IACpB,wBAAwBE;AAAA,IACxB,KAAKF,EAAK;AAAA,IACV,SAASA,EAAK;AAAA,IACd,cAAcA,EAAK;AAAA,IACnB,cAAcA,EAAK;AAAA,IACnB,aAAaA,EAAK;AAAA,IAClB,YAAYA,EAAK;AAAA,IACjB,cACE,OAAOA,EAAK,SAAU,WAAWA,EAAK,QAAQ,OAAO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MACtB,UAAU,MAAM;AACd,QAAAlB,EAASP,CAAI;AAAA,MACf;AAAA,MACC,GAAGkB;AAAA,IAAA;AAAA,EACL;AAEL;"}
@@ -1,31 +1,32 @@
1
- import { jsx as e, jsxs as D } from "react/jsx-runtime";
2
- import { useCallback as b, useMemo as L } from "react";
3
- import { DropdownMenuItem as y } from "./item.js";
4
- import { DropdownMenuDivider as j } from "./divider.js";
5
- import { Menu as G } from "@base-ui-components/react";
6
- import { Command as E } from "../cmdk/index.js";
7
- import { useCls as T } from "../utils/antdUtils.js";
8
- import { reactNodeToString as q } from "../utils/reactToString.js";
1
+ import { jsx as d, jsxs as L } from "react/jsx-runtime";
2
+ import { useCallback as G, useMemo as y } from "react";
3
+ import { DropdownMenuItem as j } from "./item.js";
4
+ import { DropdownMenuDivider as E } from "./divider.js";
5
+ import { Menu as b } from "@base-ui-components/react";
6
+ import { Command as T } from "../cmdk/index.js";
7
+ import { useCls as q } from "../utils/antdUtils.js";
8
+ import { reactNodeToString as z } from "../utils/reactToString.js";
9
9
  import { clsx as h } from "../utils/cn.js";
10
- const W = ({
10
+ const X = ({
11
11
  items: M,
12
- inCombobox: n = !1,
12
+ inCombobox: e = !1,
13
13
  classNames: o = {},
14
14
  selectedItemKeys: f,
15
15
  keepOpenOnSelect: v,
16
16
  showCheckbox: w = !1,
17
- getItemKeywords: S = (u) => [String(u.key), q(u.label)],
17
+ getItemKeywords: S = (i) => [String(i.key), z(i.label)],
18
18
  onOpenChange: l,
19
- itemRender: g
19
+ itemRender: g,
20
+ itemLabelRender: k
20
21
  }) => {
21
- const u = T(), d = b(
22
- (r, i, p) => r.type === "item" ? /* @__PURE__ */ e(
23
- y,
22
+ const i = q(), n = G(
23
+ (r, u, p) => r.type === "item" ? /* @__PURE__ */ d(
24
+ j,
24
25
  {
25
26
  item: r,
26
- inCombobox: n,
27
+ inCombobox: e,
27
28
  selected: f == null ? void 0 : f.includes(r.key),
28
- onSelect: n ? r.onSelect ? r.onSelect : () => {
29
+ onSelect: e ? r.onSelect ? r.onSelect : () => {
29
30
  const t = new MouseEvent("click", {
30
31
  bubbles: !0,
31
32
  cancelable: !0
@@ -35,90 +36,92 @@ const W = ({
35
36
  itemRender: g,
36
37
  showCheckbox: w,
37
38
  getItemKeywords: S,
39
+ itemLabelRender: k,
38
40
  classNames: {
39
41
  item: o.item,
40
42
  itemIcon: o.itemIcon,
41
43
  itemSuffix: o.itemSuffix
42
44
  }
43
45
  },
44
- i + "-" + p
45
- ) : r.type === "divider" ? /* @__PURE__ */ e(
46
- j,
46
+ u + "-" + p
47
+ ) : r.type === "divider" ? /* @__PURE__ */ d(
48
+ E,
47
49
  {
48
- inCombobox: n,
50
+ inCombobox: e,
49
51
  className: o == null ? void 0 : o.divider
50
52
  },
51
- i + "-" + p
53
+ u + "-" + p
52
54
  ) : null,
53
55
  [
54
56
  o,
55
57
  g,
56
58
  l,
57
- n,
59
+ e,
58
60
  v,
59
61
  f,
60
62
  w,
61
- S
63
+ S,
64
+ k
62
65
  ]
63
- ), k = b(
64
- (r, i) => /* @__PURE__ */ D(
65
- G.Group,
66
+ ), D = G(
67
+ (r, u) => /* @__PURE__ */ L(
68
+ b.Group,
66
69
  {
67
- className: h(u("dropdown-menu-group"), o == null ? void 0 : o.group),
70
+ className: h(i("dropdown-menu-group"), o == null ? void 0 : o.group),
68
71
  children: [
69
- r.label && /* @__PURE__ */ e(
70
- G.GroupLabel,
72
+ r.label && /* @__PURE__ */ d(
73
+ b.GroupLabel,
71
74
  {
72
75
  className: h(
73
- u("dropdown-menu-header"),
76
+ i("dropdown-menu-header"),
74
77
  o == null ? void 0 : o.groupLabel
75
78
  ),
76
- children: /* @__PURE__ */ e("span", { children: r.label })
79
+ children: /* @__PURE__ */ d("span", { children: r.label })
77
80
  }
78
81
  ),
79
- r.items.map((p, t) => d(p, i, t))
82
+ r.items.map((p, t) => n(p, u, t))
80
83
  ]
81
84
  },
82
- "group" + i
85
+ "group" + u
83
86
  ),
84
- [u, o, d]
85
- ), m = b(
86
- (r, i) => r.label ? /* @__PURE__ */ e(
87
- E.Group,
87
+ [i, o, n]
88
+ ), m = G(
89
+ (r, u) => r.label ? /* @__PURE__ */ d(
90
+ T.Group,
88
91
  {
89
- className: h(u("dropdown-menu-group"), o == null ? void 0 : o.group),
90
- heading: /* @__PURE__ */ e(
91
- G.GroupLabel,
92
+ className: h(i("dropdown-menu-group"), o == null ? void 0 : o.group),
93
+ heading: /* @__PURE__ */ d(
94
+ b.GroupLabel,
92
95
  {
93
96
  className: h(
94
- u("dropdown-menu-header"),
97
+ i("dropdown-menu-header"),
95
98
  o == null ? void 0 : o.groupLabel
96
99
  ),
97
- children: /* @__PURE__ */ e("span", { children: r.label })
100
+ children: /* @__PURE__ */ d("span", { children: r.label })
98
101
  }
99
102
  ),
100
- children: r.items.map((p, t) => d(p, i, t))
103
+ children: r.items.map((p, t) => n(p, u, t))
101
104
  },
102
- "group" + i
103
- ) : r.items.map((p, t) => d(p, i, t)),
104
- [u, o, d]
105
+ "group" + u
106
+ ) : r.items.map((p, t) => n(p, u, t)),
107
+ [i, o, n]
105
108
  );
106
109
  return {
107
- itemGroups: L(
108
- () => M.reduce((r, i) => (r.length === 0 && i.type !== "header" && r.push({
110
+ itemGroups: y(
111
+ () => M.reduce((r, u) => (r.length === 0 && u.type !== "header" && r.push({
109
112
  label: null,
110
113
  items: []
111
- }), i.type === "header" ? r.push({
112
- label: i.title,
114
+ }), u.type === "header" ? r.push({
115
+ label: u.title,
113
116
  items: []
114
- }) : (i.type === "item" || i.type === "divider") && r.length > 0 && r[r.length - 1].items.push(i), r), []),
117
+ }) : (u.type === "item" || u.type === "divider") && r.length > 0 && r[r.length - 1].items.push(u), r), []),
115
118
  [M]
116
119
  ),
117
- renderMenuItem: d,
118
- renderGroup: n ? m : k
120
+ renderMenuItem: n,
121
+ renderGroup: e ? m : D
119
122
  };
120
123
  };
121
124
  export {
122
- W as useDropdownMenu
125
+ X as useDropdownMenu
123
126
  };
124
127
  //# sourceMappingURL=useDropdownMenu.js.map