@bioturing/components 0.15.1 → 0.15.3

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 +1 @@
1
- @layer theme,base,antd,components,utilities;@layer components{.ds-root{display:contents}}@supports (scrollbar-width: auto){*{scrollbar-color:var(--ds-scrollbar-color-thumb) var(--ds-scrollbar-color-track);scrollbar-width:var(--ds-scrollbar-width)}}@supports selector(::-webkit-scrollbar){*::-webkit-scrollbar-thumb{background:var(--ds-scrollbar-color-thumb)}*::-webkit-scrollbar-track{background:var(--ds-scrollbar-color-track)}*::-webkit-scrollbar{max-width:var(--ds-scrollbar-width-legacy);max-height:var(--ds-scrollbar-width-legacy)}}body{margin:0;padding:0}a[href],button:not(:disabled){cursor:pointer}svg{vertical-align:baseline}
1
+ @layer base{body{margin:0;padding:0}a[href],button:not(:disabled){cursor:pointer}svg{vertical-align:baseline}}@layer components{.ds-root{display:contents}@supports (scrollbar-width: auto){*{scrollbar-color:var(--ds-scrollbar-color-thumb) var(--ds-scrollbar-color-track);scrollbar-width:var(--ds-scrollbar-width)}}@supports selector(::-webkit-scrollbar){*::-webkit-scrollbar-thumb{background:var(--ds-scrollbar-color-thumb)}*::-webkit-scrollbar-track{background:var(--ds-scrollbar-color-track)}*::-webkit-scrollbar{max-width:var(--ds-scrollbar-width-legacy);max-height:var(--ds-scrollbar-width-legacy)}}}
@@ -1,94 +1,146 @@
1
- import { jsxs as d, jsx as s } from "react/jsx-runtime";
2
- import { Menu as l } from "@base-ui-components/react/menu";
3
- import { useCallback as N, useRef as g } from "react";
4
- import { useControlled as P } from "@base-ui-components/react/utils";
1
+ import { jsxs as l, jsx as d } from "react/jsx-runtime";
2
+ import { Menu as p } from "@base-ui-components/react/menu";
3
+ import { useCallback as A, useRef as E } from "react";
4
+ import { useControlled as R } from "@base-ui-components/react/utils";
5
5
  import './style.css';/* empty css */
6
- import { useCls as x, useAntdCssVarClassname as G, parseAntdPlacement as L } from "../utils/antdUtils.js";
7
- import { clsx as i } from "../utils/cn.js";
8
- const S = ({
9
- children: m,
10
- items: u,
11
- placement: c,
12
- openOnHover: h,
13
- open: f,
14
- onOpenChange: a
6
+ import { useCls as D, useAntdCssVarClassname as S, parseAntdPlacement as T } from "../utils/antdUtils.js";
7
+ import { clsx as u } from "../utils/cn.js";
8
+ const J = ({
9
+ children: M,
10
+ items: w,
11
+ placement: v,
12
+ openOnHover: y,
13
+ open: C,
14
+ onOpenChange: i,
15
+ className: L,
16
+ itemRender: h,
17
+ classNames: o
15
18
  }) => {
16
- const [b, t] = P({
17
- controlled: f,
19
+ const [P, f] = R({
20
+ controlled: C,
18
21
  default: !1,
19
22
  name: "open"
20
- }), M = N(
21
- (o) => {
22
- t(o), a == null || a(o);
23
+ }), x = A(
24
+ (n) => {
25
+ f(n), i == null || i(n);
23
26
  },
24
- [t, a]
25
- ), r = x(), v = G(), p = L(c), y = g(null), w = u.reduce((o, n) => (o.length === 0 && n.type !== "header" && o.push({
27
+ [f, i]
28
+ ), t = D(), b = S(), g = T(v), G = E(null), k = w.reduce((n, e) => (n.length === 0 && e.type !== "header" && n.push({
26
29
  label: null,
27
30
  items: []
28
- }), n.type === "header" ? o.push({
29
- label: n.title,
31
+ }), e.type === "header" ? n.push({
32
+ label: e.title,
30
33
  items: []
31
- }) : (n.type === "item" || n.type === "divider") && o.length > 0 && o[o.length - 1].items.push(n), o), []);
32
- return /* @__PURE__ */ d(
33
- l.Root,
34
+ }) : (e.type === "item" || e.type === "divider") && n.length > 0 && n[n.length - 1].items.push(e), n), []);
35
+ return /* @__PURE__ */ l(
36
+ p.Root,
34
37
  {
35
- openOnHover: h,
36
- open: b,
37
- onOpenChange: M,
38
+ openOnHover: y,
39
+ open: P,
40
+ onOpenChange: x,
38
41
  children: [
39
- /* @__PURE__ */ s(l.Trigger, { render: m, ref: y }),
40
- /* @__PURE__ */ s(l.Portal, { children: /* @__PURE__ */ s(
41
- l.Positioner,
42
+ /* @__PURE__ */ d(
43
+ p.Trigger,
42
44
  {
43
- side: p.placement,
44
- align: p.align,
45
+ render: M,
46
+ ref: G,
47
+ className: u(
48
+ t("dropdown-menu-trigger"),
49
+ o == null ? void 0 : o.trigger,
50
+ b
51
+ )
52
+ }
53
+ ),
54
+ /* @__PURE__ */ d(p.Portal, { children: /* @__PURE__ */ d(
55
+ p.Positioner,
56
+ {
57
+ side: g.placement,
58
+ align: g.align,
45
59
  sideOffset: 4,
46
- children: /* @__PURE__ */ s(
47
- l.Popup,
60
+ className: u(t("dropdown-menu-root"), o == null ? void 0 : o.root),
61
+ children: /* @__PURE__ */ d(
62
+ p.Popup,
48
63
  {
49
- className: i(r("dropdown-menu"), v),
50
- children: w.map((o, n) => /* @__PURE__ */ d(l.Group, { children: [
51
- o.label && /* @__PURE__ */ s(
52
- l.GroupLabel,
53
- {
54
- className: r("dropdown-menu-header"),
55
- children: /* @__PURE__ */ s("span", { children: o.label })
56
- },
57
- n
58
- ),
59
- o.items.map((e, C) => e.type == "item" ? /* @__PURE__ */ d(
60
- l.Item,
61
- {
62
- className: i(r("dropdown-menu-item")),
63
- disabled: e.disabled,
64
- "data-danger": e.danger,
65
- ref: e.ref,
66
- onClick: e.onClick,
67
- onMouseEnter: e.onMouseEnter,
68
- onMouseLeave: e.onMouseLeave,
69
- onMouseOver: e.onMouseOver,
70
- onMouseOut: e.onMouseOut,
71
- children: [
72
- e.icon && /* @__PURE__ */ s("span", { className: r("dropdown-menu-item-icon"), children: e.icon }),
73
- /* @__PURE__ */ s("span", { children: e.label })
74
- ]
75
- },
76
- n + "-" + C
77
- ) : e.type == "divider" ? /* @__PURE__ */ s(
78
- l.Separator,
79
- {
80
- className: r("dropdown-menu-divider")
81
- },
82
- n
83
- ) : e.type == "header" ? /* @__PURE__ */ s(
84
- l.GroupLabel,
85
- {
86
- className: r("dropdown-menu-header"),
87
- children: /* @__PURE__ */ s("span", { children: e.title })
88
- },
89
- n
90
- ) : null)
91
- ] }, "group" + n))
64
+ className: u(
65
+ t("dropdown-menu"),
66
+ L,
67
+ o == null ? void 0 : o.popup,
68
+ b
69
+ ),
70
+ children: k.map((n, e) => /* @__PURE__ */ l(
71
+ p.Group,
72
+ {
73
+ className: u(
74
+ t("dropdown-menu-group"),
75
+ o == null ? void 0 : o.group
76
+ ),
77
+ children: [
78
+ n.label && /* @__PURE__ */ d(
79
+ p.GroupLabel,
80
+ {
81
+ className: u(
82
+ t("dropdown-menu-header"),
83
+ o == null ? void 0 : o.groupLabel
84
+ ),
85
+ children: /* @__PURE__ */ d("span", { children: n.label })
86
+ },
87
+ e
88
+ ),
89
+ n.items.map((r, I) => r.type == "item" ? /* @__PURE__ */ l(
90
+ p.Item,
91
+ {
92
+ className: u(
93
+ t("dropdown-menu-item"),
94
+ o == null ? void 0 : o.item
95
+ ),
96
+ disabled: r.disabled,
97
+ "data-danger": r.danger,
98
+ ref: r.ref,
99
+ onClick: r.onClick,
100
+ onMouseEnter: r.onMouseEnter,
101
+ onMouseLeave: r.onMouseLeave,
102
+ onMouseOver: r.onMouseOver,
103
+ onMouseOut: r.onMouseOut,
104
+ render: h ? (j) => h(r, j) : void 0,
105
+ children: [
106
+ r.icon && /* @__PURE__ */ d(
107
+ "span",
108
+ {
109
+ className: u(
110
+ t("dropdown-menu-item-icon"),
111
+ o == null ? void 0 : o.itemIcon
112
+ ),
113
+ children: r.icon
114
+ }
115
+ ),
116
+ /* @__PURE__ */ d("span", { children: r.label })
117
+ ]
118
+ },
119
+ e + "-" + I
120
+ ) : r.type == "divider" ? /* @__PURE__ */ d(
121
+ p.Separator,
122
+ {
123
+ className: u(
124
+ t("dropdown-menu-divider"),
125
+ o == null ? void 0 : o.separator
126
+ )
127
+ },
128
+ e
129
+ ) : r.type == "header" ? /* @__PURE__ */ d(
130
+ p.GroupLabel,
131
+ {
132
+ className: u(
133
+ t("dropdown-menu-header"),
134
+ o == null ? void 0 : o.groupLabel
135
+ ),
136
+ children: /* @__PURE__ */ d("span", { children: r.title })
137
+ },
138
+ e
139
+ ) : null)
140
+ ]
141
+ },
142
+ "group" + e
143
+ ))
92
144
  }
93
145
  )
94
146
  }
@@ -98,6 +150,6 @@ const S = ({
98
150
  );
99
151
  };
100
152
  export {
101
- S as DropdownMenu
153
+ J as DropdownMenu
102
154
  };
103
155
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/DropdownMenu/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCls,\n clsx,\n useAntdCssVarClassname,\n parseAntdPlacement,\n} from \"../utils\";\nimport { Menu } from \"@base-ui-components/react/menu\";\n\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef } from \"react\";\nimport { useControlled } from \"@base-ui-components/react/utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport type DropdownMenuItemType =\n | {\n type: \"item\";\n label?: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n key: React.Key;\n onClick?: React.HTMLAttributes<HTMLElement>[\"onClick\"];\n onMouseEnter?: React.HTMLAttributes<HTMLElement>[\"onMouseEnter\"];\n onMouseLeave?: React.HTMLAttributes<HTMLElement>[\"onMouseLeave\"];\n onMouseOver?: React.HTMLAttributes<HTMLElement>[\"onMouseOver\"];\n onMouseOut?: React.HTMLAttributes<HTMLElement>[\"onMouseOut\"];\n danger?: boolean;\n ref?: React.Ref<HTMLElement>;\n }\n | {\n type: \"divider\";\n }\n | {\n type: \"header\";\n title?: React.ReactNode;\n };\n\nexport interface DropdownMenuProps {\n items: DropdownMenuItemType[];\n children?: React.ComponentProps<typeof Menu.Trigger>[\"render\"];\n placement?: PopoverProps[\"placement\"];\n openOnHover?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\ninterface DropdownMenuGroup {\n label: React.ReactNode | null;\n items: DropdownMenuItemType[];\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n}: DropdownMenuProps) => {\n const [open, setOpen] = useControlled({\n controlled: outsideOpen,\n default: false,\n name: \"open\",\n });\n const onOpenChange = useCallback(\n (newValue: boolean) => {\n setOpen(newValue);\n outsideOnOpenChange?.(newValue);\n },\n [setOpen, outsideOnOpenChange]\n );\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const headlessUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const itemGroups = 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\n return (\n <Menu.Root\n openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <Menu.Trigger render={children} ref={buttonRef}></Menu.Trigger>\n <Menu.Portal>\n <Menu.Positioner\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n >\n <Menu.Popup\n className={clsx(cls(\"dropdown-menu\"), antdCssVarClassname)}\n >\n {itemGroups.map((group, i) => {\n return (\n <Menu.Group key={\"group\" + i}>\n {group.label && (\n <Menu.GroupLabel\n key={i}\n className={cls(\"dropdown-menu-header\")}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => {\n return item.type == \"item\" ? (\n <Menu.Item\n key={i + \"-\" + j}\n className={clsx(cls(\"dropdown-menu-item\"))}\n disabled={item.disabled}\n data-danger={item.danger}\n ref={item.ref}\n onClick={item.onClick}\n onMouseEnter={item.onMouseEnter}\n onMouseLeave={item.onMouseLeave}\n onMouseOver={item.onMouseOver}\n onMouseOut={item.onMouseOut}\n >\n {item.icon && (\n <span className={cls(\"dropdown-menu-item-icon\")}>\n {item.icon}\n </span>\n )}\n <span>{item.label}</span>\n </Menu.Item>\n ) : item.type == \"divider\" ? (\n <Menu.Separator\n key={i}\n className={cls(\"dropdown-menu-divider\")}\n ></Menu.Separator>\n ) : item.type == \"header\" ? (\n <Menu.GroupLabel\n key={i}\n className={cls(\"dropdown-menu-header\")}\n >\n <span>{item.title}</span>\n </Menu.GroupLabel>\n ) : null;\n })}\n </Menu.Group>\n );\n })}\n </Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","open","setOpen","useControlled","onOpenChange","useCallback","newValue","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","headlessUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","acc","current","jsxs","Menu","jsx","clsx","group","i","item","j"],"mappings":";;;;;;;AAqDO,MAAMA,IAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAcC;AAChB,MAAyB;AACvB,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAc;AAAA,IACpC,YAAYJ;AAAA,IACZ,SAAS;AAAA,IACT,MAAM;AAAA,EAAA,CACP,GACKK,IAAeC;AAAA,IACnB,CAACC,MAAsB;AACrB,MAAAJ,EAAQI,CAAQ,GAChBN,KAAA,QAAAA,EAAsBM;AAAA,IACxB;AAAA,IACA,CAACJ,GAASF,CAAmB;AAAA,EAC/B,GACMO,IAAMC,EAAO,GACbC,IAAsBC,EAAuB,GAC7CC,IAAsBC,EAAmBf,CAAS,GAClDgB,IAAYC,EAA0B,IAAI,GAC1CC,IAAanB,EAAM,OAA4B,CAACoB,GAAKC,OAErDD,EAAI,WAAW,KAAKC,EAAQ,SAAS,YACvCD,EAAI,KAAK;AAAA,IACP,OA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AAUiB,EAAK;AAAA,sBACf,eAAaA,EAAK;AAAA,sBAClB,KAAKA,EAAK;AAAA,sBACV,SAASA,EAAK;AAAA,sBACd,cAAcA,EAAK;AAAA,sBACnB,cAAcA,EAAK;AAAA,sBACnB,aAAaA,EAAK;AAAA,sBAClB,YAAYA,EAAK;AAAA,sBAEhB,UAAA;AAAA,wBAAKA,EAAA,0BACH,QAAK,EAAA,WAAWjB,EAAI,yBAAyB,GAC3C,YAAK,KACR,CAAA;AAAA,wBAEF,gBAAAa,EAAC,QAAM,EAAA,UAAAI,EAAK,MAAM,CAAA;AAAA,sBAAA;AAAA,oBAAA;AAAA,oBAhBbD,IAAI,MAAME;AAAA,kBAAA,IAkBfD,EAAK,QAAQ,YACf,gBAAAJ;AAAA,oBAACD,EAAK;AAAA,oBAAL;AAAA,sBAEC,WAAWZ,EAAI,uBAAuB;AAAA,oBAAA;AAAA,oBADjCgB;AAAA,kBAAA,IAGLC,EAAK,QAAQ,WACf,gBAAAJ;AAAA,oBAACD,EAAK;AAAA,oBAAL;AAAA,sBAEC,WAAWZ,EAAI,sBAAsB;AAAA,sBAErC,UAAA,gBAAAa,EAAC,QAAM,EAAA,UAAAI,EAAK,MAAM,CAAA;AAAA,oBAAA;AAAA,oBAHbD;AAAA,kBAAA,IAKL,IACL;AAAA,gBAAA,EAAA,GA3Cc,UAAUA,CA4C3B,CAEH;AAAA,cAAA;AAAA,YAAA;AAAA,UACH;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/DropdownMenu/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCls,\n clsx,\n useAntdCssVarClassname,\n parseAntdPlacement,\n} from \"../utils\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef } from \"react\";\nimport { useControlled } from \"@base-ui-components/react/utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport type DropdownMenuItemType =\n | {\n type: \"item\";\n label?: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n key: React.Key;\n onClick?: React.HTMLAttributes<HTMLElement>[\"onClick\"];\n onMouseEnter?: React.HTMLAttributes<HTMLElement>[\"onMouseEnter\"];\n onMouseLeave?: React.HTMLAttributes<HTMLElement>[\"onMouseLeave\"];\n onMouseOver?: React.HTMLAttributes<HTMLElement>[\"onMouseOver\"];\n onMouseOut?: React.HTMLAttributes<HTMLElement>[\"onMouseOut\"];\n danger?: boolean;\n ref?: React.Ref<HTMLElement>;\n }\n | {\n type: \"divider\";\n }\n | {\n type: \"header\";\n title?: React.ReactNode;\n };\n\nexport interface DropdownMenuProps {\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 * 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 group?: string;\n groupLabel?: string;\n item?: string;\n itemIcon?: string;\n itemText?: string;\n separator?: string;\n positioner?: 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\ninterface DropdownMenuGroup {\n label: React.ReactNode | null;\n items: DropdownMenuItemType[];\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n className,\n itemRender,\n classNames,\n}: DropdownMenuProps) => {\n const [open, setOpen] = useControlled({\n controlled: outsideOpen,\n default: false,\n name: \"open\",\n });\n const onOpenChange = useCallback(\n (newValue: boolean) => {\n setOpen(newValue);\n outsideOnOpenChange?.(newValue);\n },\n [setOpen, outsideOnOpenChange]\n );\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const headlessUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const itemGroups = 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\n return (\n <Menu.Root\n openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <Menu.Trigger\n render={children}\n ref={buttonRef}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n antdCssVarClassname\n )}\n ></Menu.Trigger>\n <Menu.Portal>\n <Menu.Positioner\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n className={clsx(cls(\"dropdown-menu-root\"), classNames?.root)}\n >\n <Menu.Popup\n className={clsx(\n cls(\"dropdown-menu\"),\n className,\n classNames?.popup,\n antdCssVarClassname\n )}\n >\n {itemGroups.map((group, i) => {\n return (\n <Menu.Group\n key={\"group\" + i}\n className={clsx(\n cls(\"dropdown-menu-group\"),\n classNames?.group\n )}\n >\n {group.label && (\n <Menu.GroupLabel\n key={i}\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) => {\n return item.type == \"item\" ? (\n <Menu.Item\n key={i + \"-\" + j}\n className={clsx(\n cls(\"dropdown-menu-item\"),\n classNames?.item\n )}\n disabled={item.disabled}\n data-danger={item.danger}\n ref={item.ref}\n onClick={item.onClick}\n onMouseEnter={item.onMouseEnter}\n onMouseLeave={item.onMouseLeave}\n onMouseOver={item.onMouseOver}\n onMouseOut={item.onMouseOut}\n render={\n itemRender\n ? (itemProps) => itemRender(item, itemProps)\n : undefined\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>{item.label}</span>\n </Menu.Item>\n ) : item.type == \"divider\" ? (\n <Menu.Separator\n key={i}\n className={clsx(\n cls(\"dropdown-menu-divider\"),\n classNames?.separator\n )}\n ></Menu.Separator>\n ) : item.type == \"header\" ? (\n <Menu.GroupLabel\n key={i}\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{item.title}</span>\n </Menu.GroupLabel>\n ) : null;\n })}\n </Menu.Group>\n );\n })}\n </Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","className","itemRender","classNames","open","setOpen","useControlled","onOpenChange","useCallback","newValue","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","headlessUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","acc","current","jsxs","Menu","jsx","clsx","group","i","item","j","itemProps"],"mappings":";;;;;;;AA+FO,MAAMA,IAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AACF,MAAyB;AACvB,QAAM,CAACC,GAAMC,CA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AAA,0BAGL,UAAA;AAAA,4BAAAF,EAAK,QACJ,gBAAAJ;AAAA,8BAAC;AAAA,8BAAA;AAAA,gCACC,WAAWC;AAAA,kCACTd,EAAI,yBAAyB;AAAA,kCAC7BP,KAAA,gBAAAA,EAAY;AAAA,gCACd;AAAA,gCAEC,UAAKwB,EAAA;AAAA,8BAAA;AAAA,4BACR;AAAA,4BAEF,gBAAAJ,EAAC,QAAM,EAAA,UAAAI,EAAK,MAAM,CAAA;AAAA,0BAAA;AAAA,wBAAA;AAAA,wBA7BbD,IAAI,MAAME;AAAA,sBAAA,IA+BfD,EAAK,QAAQ,YACf,gBAAAJ;AAAA,wBAACD,EAAK;AAAA,wBAAL;AAAA,0BAEC,WAAWE;AAAA,4BACTd,EAAI,uBAAuB;AAAA,4BAC3BP,KAAA,gBAAAA,EAAY;AAAA,0BAAA;AAAA,wBACd;AAAA,wBAJKuB;AAAA,sBAAA,IAMLC,EAAK,QAAQ,WACf,gBAAAJ;AAAA,wBAACD,EAAK;AAAA,wBAAL;AAAA,0BAEC,WAAWE;AAAA,4BACTd,EAAI,sBAAsB;AAAA,4BAC1BP,KAAA,gBAAAA,EAAY;AAAA,0BACd;AAAA,0BAEA,UAAA,gBAAAoB,EAAC,QAAM,EAAA,UAAAI,EAAK,MAAM,CAAA;AAAA,wBAAA;AAAA,wBANbD;AAAA,sBAAA,IAQL,IACL;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAtEI,UAAUA;AAAA,gBAuEjB,CAEH;AAAA,cAAA;AAAA,YAAA;AAAA,UACH;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1 +1 @@
1
- @layer components{.ds-dropdown-menu{box-shadow:var(--ds-box-shadow-secondary);border-radius:var(--ds-border-radius);background:var(--ds-color-bg-elevated);list-style:none;padding:.25rem;color:var(--ds-color-text);font-size:var(--ds-font-size);font-family:var(--ds-font-family);transition-property:transform,scale,opacity;transition-duration:.2s;transition-timing-function:var(--ds-motion-ease-out);transform-origin:var(--transform-origin)}.ds-dropdown-menu[data-ending-style],.ds-dropdown-menu[data-starting-style]{transform:scale(.9);opacity:0}.ds-dropdown-menu:focus{outline:none}.ds-dropdown-menu-item{padding:.375rem .75rem;border-radius:var(--ds-border-radius-sm);transition:all .3s var(--ds-motion-ease-out);cursor:pointer;display:flex;align-items:center}.ds-dropdown-menu-item:focus{outline:none}.ds-dropdown-menu-item:hover{background:var(--ds-control-item-bg-hover)}.ds-dropdown-menu-item:active,.ds-dropdown-menu-item:focus,.ds-dropdown-menu-item[data-focus]{background:var(--ds-control-item-bg-active)}.ds-dropdown-menu-item[data-disabled]{pointer-events:none;color:var(--ds-color-text-disabled)}.ds-dropdown-menu-item[data-danger]{color:var(--ds-color-error)}.ds-dropdown-menu-item[data-danger]:hover{background:var(--ds-color-error-bg)}.ds-dropdown-menu-item[data-danger]:active,.ds-dropdown-menu-item[data-danger]:focus,.ds-dropdown-menu-item[data-danger][data-focus]{background:var(--ds-color-error-bg-hover)}.ds-dropdown-menu-item-icon{display:flex;align-items:center;justify-content:center;margin-right:.5rem;font-size:1rem;color:var(--ds-color-icon)}[data-danger] .ds-dropdown-menu-item-icon{color:var(--ds-color-error)}.ds-dropdown-menu-divider{border-bottom:1px solid var(--ds-color-split);margin:.25rem 0}.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}}
1
+ @layer components{.ds-dropdown-menu-root{z-index:2000}.ds-dropdown-menu{box-shadow:var(--ds-box-shadow-secondary);border-radius:var(--ds-border-radius);background:var(--ds-color-bg-elevated);list-style:none;padding:.25rem;color:var(--ds-color-text);font-size:var(--ds-font-size);font-family:var(--ds-font-family);transition-property:transform,scale,opacity;transition-duration:.2s;transition-timing-function:var(--ds-motion-ease-out);transform-origin:var(--transform-origin)}.ds-dropdown-menu[data-ending-style],.ds-dropdown-menu[data-starting-style]{transform:scale(.9);opacity:0}.ds-dropdown-menu:focus{outline:none}.ds-dropdown-menu-item{padding:.375rem .75rem;border-radius:var(--ds-border-radius-sm);transition:all .3s var(--ds-motion-ease-out);cursor:pointer;display:flex;align-items:center}.ds-dropdown-menu-item:focus{outline:none}.ds-dropdown-menu-item:hover{background:var(--ds-control-item-bg-hover)}.ds-dropdown-menu-item:active,.ds-dropdown-menu-item:focus,.ds-dropdown-menu-item[data-focus]{background:var(--ds-control-item-bg-active)}.ds-dropdown-menu-item[data-disabled]{pointer-events:none;color:var(--ds-color-text-disabled)}.ds-dropdown-menu-item[data-danger]{color:var(--ds-color-error)}.ds-dropdown-menu-item[data-danger]:hover{background:var(--ds-color-error-bg)}.ds-dropdown-menu-item[data-danger]:active,.ds-dropdown-menu-item[data-danger]:focus,.ds-dropdown-menu-item[data-danger][data-focus]{background:var(--ds-color-error-bg-hover)}.ds-dropdown-menu-item-icon{display:flex;align-items:center;justify-content:center;margin-right:.5rem;font-size:1rem;color:var(--ds-color-icon)}[data-danger] .ds-dropdown-menu-item-icon{color:var(--ds-color-error)}.ds-dropdown-menu-divider{border-bottom:1px solid var(--ds-color-split);margin:.25rem 0}.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}}
@@ -1,175 +1,201 @@
1
- import { jsx as t, jsxs as o, Fragment as L } from "react/jsx-runtime";
2
- import { Popover as r } from "@base-ui-components/react/popover";
3
- import { useRef as Q, useState as c, useCallback as y, useEffect as C, useMemo as Y } from "react";
4
- import Z from "antd/es/flex";
5
- import { X as _ } from "@bioturing/assets";
6
- import { PopupPanelSize as B } from "./constants.js";
7
- import { useResizable as ee } from "react-use-resizable";
1
+ import { jsx as n, jsxs as i, Fragment as m } from "react/jsx-runtime";
2
+ import { Popover as p } from "@base-ui-components/react/popover";
3
+ import { useState as l, useCallback as k, useEffect as O, useMemo as a } from "react";
4
+ import N from "antd/es/flex";
5
+ import { X as s } from "@bioturing/assets";
6
+ import { PopupPanelSize as ee } from "./constants.js";
7
+ import { useResizable as te } from "react-use-resizable";
8
+ import ne from "merge-refs";
8
9
  import './style.css';/* empty css */
9
- import { useControlledState as te } from "../hooks/useControlledState.js";
10
- import { useCls as ne, useAntdCssVarClassname as re, parseAntdPlacement as se } from "../utils/antdUtils.js";
11
- import { IconButton as oe } from "../IconButton/component.js";
12
- import { clsx as le } from "../utils/cn.js";
13
- const ze = ({
14
- children: H,
15
- placement: b,
16
- openOnHover: x = !1,
17
- open: k,
18
- onOpenChange: w,
19
- content: O,
20
- title: p,
21
- trigger: S = "click",
22
- className: I,
23
- anchor: V,
24
- beforeCloseButton: f,
25
- afterCloseButton: h,
26
- afterTitle: d,
10
+ import { useControlledState as re } from "../hooks/useControlledState.js";
11
+ import { useCls as oe, useAntdCssVarClassname as pe, parseAntdPlacement as ie } from "../utils/antdUtils.js";
12
+ import { clsx as o } from "../utils/cn.js";
13
+ import { IconButton as de } from "../IconButton/component.js";
14
+ const be = ({
15
+ children: S,
16
+ placement: I,
17
+ openOnHover: V = !1,
18
+ open: D,
19
+ onOpenChange: W,
20
+ content: j,
21
+ title: f,
22
+ trigger: A = "click",
23
+ className: E,
24
+ anchor: F,
25
+ beforeCloseButton: P,
26
+ afterCloseButton: C,
27
+ afterTitle: h,
27
28
  size: g = "medium",
28
- footer: i,
29
- defaultOpen: D,
30
- resizable: j = !1
29
+ footer: d,
30
+ defaultOpen: $,
31
+ resizable: M = !1,
32
+ classNames: e
31
33
  }) => {
32
- const [A, v] = te(
33
- k,
34
- w,
35
- D ?? !1
34
+ const [T, H] = re(
35
+ D,
36
+ W,
37
+ $ ?? !1
36
38
  // Always provide a default value to prevent undefined
37
- ), n = ne(), E = re(), R = se(b), F = Q(null), [u, W] = c(null), [$, M] = c(), [T, U] = c(), X = y((e) => {
38
- W(e);
39
+ ), t = oe(), y = pe(), b = ie(I), [c, U] = l(null), [X, q] = l(), [G, J] = l(), K = k((r) => {
40
+ U(r);
39
41
  }, []);
40
- C(() => {
41
- if (!u) return;
42
- const e = new ResizeObserver((l) => {
43
- for (const s of l)
44
- M(s.contentRect.width), U(s.contentRect.height);
42
+ O(() => {
43
+ if (!c) return;
44
+ const r = new ResizeObserver((R) => {
45
+ for (const u of R)
46
+ q(u.contentRect.width), J(u.contentRect.height);
45
47
  });
46
- return e.observe(u), () => {
47
- e.disconnect();
48
+ return r.observe(c), () => {
49
+ r.disconnect();
48
50
  };
49
- }, [u]);
50
- const z = Y(() => /* @__PURE__ */ t(_, { size: 16 }), []), q = y(() => /* @__PURE__ */ o("div", { className: n("popup-panel-header"), children: [
51
- /* @__PURE__ */ o(
52
- Z,
51
+ }, [c]);
52
+ const w = a(() => /* @__PURE__ */ n(s, { size: 16 }), []), L = k(() => /* @__PURE__ */ i("div", { className: o(t("popup-panel-header"), e == null ? void 0 : e.header), children: [
53
+ /* @__PURE__ */ i(
54
+ N,
53
55
  {
54
56
  align: "center",
55
57
  gap: 8,
56
- className: n("popup-panel-title-wrapper"),
58
+ className: t("popup-panel-title-wrapper"),
57
59
  children: [
58
- /* @__PURE__ */ t(
59
- r.Title,
60
+ /* @__PURE__ */ n(
61
+ p.Title,
60
62
  {
61
- render: /* @__PURE__ */ t("div", { className: n("grow", "truncate"), children: p })
63
+ render: /* @__PURE__ */ n("div", { className: o(t("grow", "truncate"), e == null ? void 0 : e.title), children: f })
62
64
  }
63
65
  ),
64
- /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
65
- f,
66
- /* @__PURE__ */ t(
67
- r.Close,
66
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
67
+ P,
68
+ /* @__PURE__ */ n(
69
+ p.Close,
68
70
  {
69
- render: /* @__PURE__ */ t(oe, { children: z })
71
+ render: /* @__PURE__ */ n(de, { children: w })
70
72
  }
71
73
  ),
72
- h
74
+ C
73
75
  ] })
74
76
  ]
75
77
  }
76
78
  ),
77
- d || null
79
+ h || null
78
80
  ] }), [
81
+ C,
79
82
  h,
80
- d,
81
- f,
82
- n,
83
- z,
84
- p
85
- ]), [m, N] = c(!1), { getRootProps: G, getHandleProps: a, rootRef: P } = ee({
86
- initialWidth: $,
87
- initialHeight: T,
88
- onDragStart: () => N(!0),
89
- onDragEnd: () => N(!1)
83
+ P,
84
+ t,
85
+ e == null ? void 0 : e.header,
86
+ e == null ? void 0 : e.title,
87
+ w,
88
+ f
89
+ ]), [v, x] = l(!1), { getRootProps: Q, getHandleProps: z, rootRef: Y } = te({
90
+ initialWidth: X,
91
+ initialHeight: G,
92
+ onDragStart: () => x(!0),
93
+ onDragEnd: () => x(!1)
90
94
  });
91
- C(() => {
92
- m ? document.body.style.userSelect = "none" : document.body.style.userSelect = "";
93
- }, [m]);
94
- const J = (e, l) => {
95
- if (!e.current) return;
96
- const { heightDiff: s } = l;
97
- e.current.style.top = `${parseInt(e.current.style.top || "0") - s}px`;
98
- }, K = (e, l) => {
99
- if (!e.current) return;
100
- const { widthDiff: s } = l;
101
- e.current.style.left = `${parseInt(e.current.style.left || "0") - s}px`;
95
+ O(() => {
96
+ v ? document.body.style.userSelect = "none" : document.body.style.userSelect = "";
97
+ }, [v]);
98
+ const { ref: Z, ..._ } = Q(), B = (r, R) => {
99
+ if (!r.current) return;
100
+ const { widthDiff: u } = R;
101
+ r.current.style.left = `${parseInt(r.current.style.left || "0") - u}px`;
102
102
  };
103
- return /* @__PURE__ */ o(
104
- r.Root,
103
+ return /* @__PURE__ */ i(
104
+ p.Root,
105
105
  {
106
- openOnHover: S === "hover" ? !0 : x,
107
- open: A,
108
- onOpenChange: (e) => {
109
- v(e);
110
- },
111
- delay: 100,
106
+ openOnHover: A === "hover" ? !0 : V,
107
+ open: T,
108
+ onOpenChange: H,
112
109
  children: [
113
- /* @__PURE__ */ t(r.Trigger, { render: H, ref: F }),
114
- /* @__PURE__ */ t(r.Portal, { children: /* @__PURE__ */ t(
115
- r.Positioner,
110
+ /* @__PURE__ */ n(
111
+ p.Trigger,
112
+ {
113
+ render: S,
114
+ className: o(t("popup-panel-trigger"), e == null ? void 0 : e.trigger)
115
+ }
116
+ ),
117
+ /* @__PURE__ */ n(p.Portal, { children: /* @__PURE__ */ n(
118
+ p.Positioner,
116
119
  {
117
- className: n("popup-panel-root"),
118
- side: R.placement,
119
- align: R.align,
120
+ className: o(
121
+ t("popup-panel-root"),
122
+ e == null ? void 0 : e.root,
123
+ y
124
+ ),
125
+ side: b.placement,
126
+ align: b.align,
120
127
  sideOffset: 4,
121
- anchor: V,
128
+ anchor: F,
122
129
  style: {
123
- "--size-width": g ? B[g] : void 0
130
+ "--size-width": g ? ee[g] : void 0
124
131
  },
125
- ref: X,
126
- children: /* @__PURE__ */ o(
127
- r.Popup,
132
+ children: /* @__PURE__ */ i(
133
+ p.Popup,
128
134
  {
129
- className: le(n("popup-panel"), E, I),
130
- ...G(),
131
- ...m ? { "data-resizing": !0 } : {},
135
+ className: o(
136
+ t("popup-panel"),
137
+ t(`popup-panel-size-${g}`),
138
+ E,
139
+ e == null ? void 0 : e.popup,
140
+ y
141
+ ),
142
+ ref: ne(Z, K),
143
+ ..._,
144
+ ...v ? { "data-resizing": !0 } : {},
132
145
  children: [
133
- p && q(),
134
- /* @__PURE__ */ t("div", { className: n("popup-panel-content"), children: /* @__PURE__ */ t("div", { className: n("popup-panel-content-inner"), children: O }) }),
135
- i && /* @__PURE__ */ t("div", { className: n("popup-panel-footer"), children: typeof i == "function" ? i({ close: () => v(!1) }) : i }),
136
- j && /* @__PURE__ */ o(L, { children: [
137
- /* @__PURE__ */ t(
138
- "div",
139
- {
140
- className: n("resize-handle-top"),
141
- ...a({
142
- reverse: !0,
143
- lockHorizontal: !0,
144
- onResize: (e) => J(P, e)
145
- })
146
- }
147
- ),
148
- /* @__PURE__ */ t(
146
+ f && L(),
147
+ /* @__PURE__ */ n(
148
+ "div",
149
+ {
150
+ className: o(t("popup-panel-content"), e == null ? void 0 : e.content),
151
+ children: /* @__PURE__ */ n("div", { className: t("popup-panel-content-inner"), children: j })
152
+ }
153
+ ),
154
+ d && /* @__PURE__ */ n(
155
+ "div",
156
+ {
157
+ className: o(t("popup-panel-footer"), e == null ? void 0 : e.footer),
158
+ children: typeof d == "function" ? d({ close: () => H(!1) }) : d
159
+ }
160
+ ),
161
+ M && /* @__PURE__ */ i(m, { children: [
162
+ /* @__PURE__ */ n(
149
163
  "div",
150
164
  {
151
- className: n("resize-handle-bottom"),
152
- ...a({
165
+ className: o(
166
+ t("popup-panel-resize-handle"),
167
+ e == null ? void 0 : e.resizeHandle
168
+ ),
169
+ "data-placement": "bottom-left",
170
+ ...z({
153
171
  lockHorizontal: !0
154
172
  })
155
173
  }
156
174
  ),
157
- /* @__PURE__ */ t(
175
+ /* @__PURE__ */ n(
158
176
  "div",
159
177
  {
160
- className: n("resize-handle-left"),
161
- ...a({
178
+ className: o(
179
+ t("popup-panel-resize-handle"),
180
+ e == null ? void 0 : e.resizeHandle
181
+ ),
182
+ "data-placement": "top-left",
183
+ ...z({
162
184
  reverse: !0,
163
185
  lockVertical: !0,
164
- onResize: (e) => K(P, e)
186
+ onResize: (r) => B(Y, r)
165
187
  })
166
188
  }
167
189
  ),
168
- /* @__PURE__ */ t(
190
+ /* @__PURE__ */ n(
169
191
  "div",
170
192
  {
171
- className: n("resize-handle-right"),
172
- ...a({
193
+ className: o(
194
+ t("popup-panel-resize-handle"),
195
+ e == null ? void 0 : e.resizeHandle
196
+ ),
197
+ "data-placement": "top-right",
198
+ ...z({
173
199
  lockVertical: !0
174
200
  })
175
201
  }
@@ -185,6 +211,6 @@ const ze = ({
185
211
  );
186
212
  };
187
213
  export {
188
- ze as PopupPanel
214
+ be as PopupPanel
189
215
  };
190
216
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/PopupPanel/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCls,\n clsx,\n useAntdCssVarClassname,\n parseAntdPlacement,\n} from \"../utils\";\nimport { Popover } from \"@base-ui-components/react/popover\";\n\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport Flex from \"antd/es/flex\";\nimport { IconButton } from \"../IconButton\";\nimport { X } from \"@bioturing/assets\";\nimport { PopupPanelSize } from \"./constants\";\nimport { useControlledState } from \"../hooks\";\nimport { useResizable, type MoveValues } from \"react-use-resizable\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface PopupPanelProps\n extends Omit<\n React.ComponentPropsWithRef<\"div\">,\n \"title\" | \"content\" | \"children\"\n > {\n /** The trigger element that opens the popup panel */\n children?: React.ComponentProps<typeof Popover.Trigger>[\"render\"];\n /** Placement of the popup panel relative to its trigger */\n placement?: PopoverProps[\"placement\"];\n /** Whether to open the popup panel on hover */\n openOnHover?: boolean;\n /** Controls the open state of the popup panel */\n open?: boolean;\n /** Callback fired when the open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Content to display inside the popup panel */\n content?: React.ReactNode;\n /** Title text or element to display in the panel header */\n title?: React.ReactNode;\n /** The event that triggers the popup panel */\n /**\n * @default \"click\"\n */\n trigger?: \"click\" | \"hover\";\n /** Custom anchor element for positioning the panel */\n anchor?: Popover.Positioner.Props[\"anchor\"];\n /** Content to display before the close button */\n beforeCloseButton?: React.ReactNode;\n /** Content to display after the close button */\n afterCloseButton?: React.ReactNode;\n /** Content to display after the title */\n afterTitle?: React.ReactNode;\n /**\n * Predefined sizes for the popup panel\n * - xsmall: 320px\n * - small: 400px\n * - medium: 480px (default)\n * - large: 640px\n * - xlarge: 840px\n * @default \"medium\" for default type, \"xsmall\" for other types\n */\n size?: keyof typeof PopupPanelSize;\n /**\n * Footer content for the popup panel\n * Can be a React node or a function that returns a React node\n */\n footer?:\n | React.ReactNode\n | ((props: { close: () => void }) => React.ReactNode);\n /**\n * Whether the panel should be open by default when uncontrolled\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Whether the panel should be resizable\n * @default false\n */\n resizable?: boolean;\n}\n\nexport const PopupPanel = ({\n children,\n placement,\n openOnHover = false,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n content,\n title,\n trigger = \"click\",\n className,\n anchor,\n beforeCloseButton,\n afterCloseButton,\n afterTitle,\n size = \"medium\",\n footer,\n defaultOpen,\n resizable = false,\n}: PopupPanelProps) => {\n // Use controlled state with proper initialization to prevent switching between controlled/uncontrolled\n const [open, setOpen] = useControlledState(\n outsideOpen,\n outsideOnOpenChange,\n defaultOpen ?? false // Always provide a default value to prevent undefined\n );\n\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const headlessUIPlacement = parseAntdPlacement(placement);\n const triggerRef = useRef<HTMLElement>(null);\n const [popupRef, setPopupRef] = useState<HTMLDivElement | null>(null);\n const [width, setWidth] = useState<number>();\n const [height, setHeight] = useState<number>();\n const callbackRef = useCallback((node: HTMLDivElement) => {\n setPopupRef(node);\n }, []);\n useEffect(() => {\n if (!popupRef) return;\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setWidth(entry.contentRect.width);\n setHeight(entry.contentRect.height);\n }\n });\n observer.observe(popupRef);\n return () => {\n observer.disconnect();\n };\n }, [popupRef]);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\n const renderTitle = useCallback(() => {\n return (\n <div className={cls(\"popup-panel-header\")}>\n <Flex\n align=\"center\"\n gap={8}\n className={cls(\"popup-panel-title-wrapper\")}\n >\n <Popover.Title\n render={<div className={cls(\"grow\", \"truncate\")}>{title}</div>}\n ></Popover.Title>\n <div className=\"flex items-center gap-2\">\n {beforeCloseButton}\n <Popover.Close\n render={<IconButton>{defaultCloseIcon}</IconButton>}\n />\n {afterCloseButton}\n </div>\n </Flex>\n {afterTitle ? afterTitle : null}\n </div>\n );\n }, [\n afterCloseButton,\n afterTitle,\n beforeCloseButton,\n cls,\n defaultCloseIcon,\n title,\n ]);\n const [resizing, setResizing] = useState(false);\n const { getRootProps, getHandleProps, rootRef } = useResizable({\n initialWidth: width,\n initialHeight: height,\n onDragStart: () => setResizing(true),\n onDragEnd: () => setResizing(false),\n });\n useEffect(() => {\n if (resizing) {\n document.body.style.userSelect = \"none\";\n } else {\n document.body.style.userSelect = \"\";\n }\n }, [resizing]);\n // Handle reverse handle change\n const onReverseHandleChangeVertical = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues\n ) => {\n if (!parent.current) return;\n const { heightDiff } = values;\n parent.current.style.top = `${\n parseInt(parent.current.style.top || \"0\") - heightDiff\n }px`;\n };\n\n // Handle reverse handle change\n const onReverseHandleChangeHorizontal = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues\n ) => {\n if (!parent.current) return;\n const { widthDiff } = values;\n parent.current.style.left = `${\n parseInt(parent.current.style.left || \"0\") - widthDiff\n }px`;\n };\n\n return (\n <Popover.Root\n openOnHover={trigger === \"hover\" ? true : openOnHover}\n open={open}\n onOpenChange={(newOpen) => {\n // Ensure we're properly handling the state change\n setOpen(newOpen);\n }}\n delay={100}\n >\n <Popover.Trigger render={children} ref={triggerRef}></Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner\n className={cls(\"popup-panel-root\")}\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n anchor={anchor}\n style={\n {\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n ref={callbackRef}\n >\n <Popover.Popup\n className={clsx(cls(\"popup-panel\"), antdCssVarClassname, className)}\n {...getRootProps()}\n {...(resizing ? { \"data-resizing\": true } : {})}\n >\n {/* <div ref={popupRef}> */}\n {title && renderTitle()}\n <div className={cls(\"popup-panel-content\")}>\n <div className={cls(\"popup-panel-content-inner\")}>{content}</div>\n </div>\n {footer && (\n <div className={cls(\"popup-panel-footer\")}>\n {typeof footer === \"function\"\n ? footer({ close: () => setOpen(false) })\n : footer}\n </div>\n )}\n {resizable && (\n <>\n <div\n className={cls(\"resize-handle-top\")}\n {...getHandleProps({\n reverse: true,\n lockHorizontal: true,\n onResize: (values) =>\n onReverseHandleChangeVertical(rootRef, values),\n })}\n />\n <div\n className={cls(\"resize-handle-bottom\")}\n {...getHandleProps({\n lockHorizontal: true,\n })}\n />\n <div\n className={cls(\"resize-handle-left\")}\n {...getHandleProps({\n reverse: true,\n lockVertical: true,\n onResize: (values) =>\n onReverseHandleChangeHorizontal(rootRef, values),\n })}\n />\n <div\n className={cls(\"resize-handle-right\")}\n {...getHandleProps({\n lockVertical: true,\n })}\n />\n </>\n )}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n"],"names":["PopupPanel","children","placement","openOnHover","outsideOpen","outsideOnOpenChange","content","title","trigger","className","anchor","beforeCloseButton","afterCloseButton","afterTitle","size","footer","defaultOpen","resizable","open","setOpen","useControlledState","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","headlessUIPlacement","parseAntdPlacement","triggerRef","useRef","popupRef","setPopupRef","useState","width","setWidth","height","setHeight","callbackRef","useCallback","node","useEffect","observer","entries","entry","defaultCloseIcon","useMemo","jsx","X","renderTitle","jsxs","Flex","Popover","IconButton","resizing","setResizing","getRootProps","getHandleProps","rootRef","useResizable","onReverseHandleChangeVertical","parent","values","heightDiff","onReverseHandleChangeHorizontal","widthDiff","newOpen","PopupPanelSize","clsx","Fragment"],"mappings":";;;;;;;;;;;;AAkFO,MAAMA,KAAa,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,MAAMC;AAAA,EACN,cAAcC;AAAA,EACd,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAA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;AAAA,wBACC,WAAWxB,EAAI,mBAAmB;AAAA,wBACjC,GAAGkC,EAAe;AAAA,0BACjB,SAAS;AAAA,0BACT,gBAAgB;AAAA,0BAChB,UAAU,CAACK,MACTF,EAA8BF,GAASI,CAAM;AAAA,wBAChD,CAAA;AAAA,sBAAA;AAAA,oBACH;AAAA,oBACA,gBAAAf;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,WAAWxB,EAAI,sBAAsB;AAAA,wBACpC,GAAGkC,EAAe;AAAA,0BACjB,gBAAgB;AAAA,wBACjB,CAAA;AAAA,sBAAA;AAAA,oBACH;AAAA,oBACA,gBAAAV;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,WAAWxB,EAAI,oBAAoB;AAAA,wBAClC,GAAGkC,EAAe;AAAA,0BACjB,SAAS;AAAA,0BACT,cAAc;AAAA,0BACd,UAAU,CAACK,MACTE,EAAgCN,GAASI,CAAM;AAAA,wBAClD,CAAA;AAAA,sBAAA;AAAA,oBACH;AAAA,oBACA,gBAAAf;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,WAAWxB,EAAI,qBAAqB;AAAA,wBACnC,GAAGkC,EAAe;AAAA,0BACjB,cAAc;AAAA,wBACf,CAAA;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACH,EACF,CAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/PopupPanel/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCls,\n clsx,\n useAntdCssVarClassname,\n parseAntdPlacement,\n} from \"../utils\";\nimport { Popover } from \"@base-ui-components/react/popover\";\n\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport Flex from \"antd/es/flex\";\nimport { IconButton } from \"../IconButton\";\nimport { X } from \"@bioturing/assets\";\nimport { PopupPanelSize } from \"./constants\";\nimport { useControlledState } from \"../hooks\";\nimport { useResizable, type MoveValues } from \"react-use-resizable\";\nimport mergeRefs from \"merge-refs\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface PopupPanelProps\n extends Omit<\n React.ComponentPropsWithRef<\"div\">,\n \"title\" | \"content\" | \"children\"\n > {\n /** The trigger element that opens the popup panel */\n children?: React.ComponentProps<typeof Popover.Trigger>[\"render\"];\n /** Placement of the popup panel relative to its trigger */\n placement?: PopoverProps[\"placement\"];\n /** Whether to open the popup panel on hover */\n openOnHover?: boolean;\n /** Controls the open state of the popup panel */\n open?: boolean;\n /** Callback fired when the open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Content to display inside the popup panel */\n content?: React.ReactNode;\n /** Title text or element to display in the panel header */\n title?: React.ReactNode;\n /** The event that triggers the popup panel */\n /**\n * @default \"click\"\n */\n trigger?: \"click\" | \"hover\";\n /** Custom anchor element for positioning the panel */\n anchor?: Popover.Positioner.Props[\"anchor\"];\n /** Content to display before the close button */\n beforeCloseButton?: React.ReactNode;\n /** Content to display after the close button */\n afterCloseButton?: React.ReactNode;\n /** Content to display after the title */\n afterTitle?: React.ReactNode;\n /**\n * Predefined sizes for the popup panel\n * - xsmall: 320px\n * - small: 400px\n * - medium: 480px (default)\n * - large: 640px\n * - xlarge: 840px\n * @default \"medium\" for default type, \"xsmall\" for other types\n */\n size?: keyof typeof PopupPanelSize;\n /**\n * Footer content for the popup panel\n * Can be a React node or a function that returns a React node\n */\n footer?:\n | React.ReactNode\n | ((props: { close: () => void }) => React.ReactNode);\n /**\n * Whether the panel should be open by default when uncontrolled\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Whether the panel should be resizable\n * @default false\n */\n resizable?: boolean;\n /**\n * Custom class names for different parts of the popup panel\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n header?: string;\n title?: string;\n content?: string;\n footer?: string;\n resizeHandle?: string;\n };\n}\n\nexport const PopupPanel = ({\n children,\n placement,\n openOnHover = false,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n content,\n title,\n trigger = \"click\",\n className,\n anchor,\n beforeCloseButton,\n afterCloseButton,\n afterTitle,\n size = \"medium\",\n footer,\n defaultOpen,\n resizable = false,\n classNames,\n}: PopupPanelProps) => {\n // Use controlled state with proper initialization to prevent switching between controlled/uncontrolled\n const [open, setOpen] = useControlledState(\n outsideOpen,\n outsideOnOpenChange,\n defaultOpen ?? false // Always provide a default value to prevent undefined\n );\n\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const headlessUIPlacement = parseAntdPlacement(placement);\n // We don't need triggerRef since we're using callbackRef for the popup\n const [popupRef, setPopupRef] = useState<HTMLDivElement | null>(null);\n const [width, setWidth] = useState<number>();\n const [height, setHeight] = useState<number>();\n const callbackRef = useCallback((node: HTMLDivElement) => {\n setPopupRef(node);\n }, []);\n useEffect(() => {\n if (!popupRef) return;\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setWidth(entry.contentRect.width);\n setHeight(entry.contentRect.height);\n }\n });\n observer.observe(popupRef);\n return () => {\n observer.disconnect();\n };\n }, [popupRef]);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\n const renderTitle = useCallback(() => {\n return (\n <div className={clsx(cls(\"popup-panel-header\"), classNames?.header)}>\n <Flex\n align=\"center\"\n gap={8}\n className={cls(\"popup-panel-title-wrapper\")}\n >\n <Popover.Title\n render={\n <div className={clsx(cls(\"grow\", \"truncate\"), classNames?.title)}>\n {title}\n </div>\n }\n ></Popover.Title>\n <div className=\"flex items-center gap-2\">\n {beforeCloseButton}\n <Popover.Close\n render={<IconButton>{defaultCloseIcon}</IconButton>}\n />\n {afterCloseButton}\n </div>\n </Flex>\n {afterTitle ? afterTitle : null}\n </div>\n );\n }, [\n afterCloseButton,\n afterTitle,\n beforeCloseButton,\n cls,\n classNames?.header,\n classNames?.title,\n defaultCloseIcon,\n title,\n ]);\n const [resizing, setResizing] = useState(false);\n const { getRootProps, getHandleProps, rootRef } = useResizable({\n initialWidth: width,\n initialHeight: height,\n onDragStart: () => setResizing(true),\n onDragEnd: () => setResizing(false),\n });\n useEffect(() => {\n if (resizing) {\n document.body.style.userSelect = \"none\";\n } else {\n document.body.style.userSelect = \"\";\n }\n }, [resizing]);\n const { ref: rootRefProp, ...rootPropsWithoutRef } = getRootProps();\n // Handle reverse handle change for vertical resizing\n // Currently not used but kept for future implementation\n const _onReverseHandleChangeVertical = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues\n ) => {\n if (!parent.current) return;\n const { heightDiff } = values;\n parent.current.style.top = `${\n parseInt(parent.current.style.top || \"0\") - heightDiff\n }px`;\n };\n\n // Handle reverse handle change\n const onReverseHandleChangeHorizontal = (\n parent: React.RefObject<HTMLDivElement>,\n values: MoveValues\n ) => {\n if (!parent.current) return;\n const { widthDiff } = values;\n parent.current.style.left = `${\n parseInt(parent.current.style.left || \"0\") - widthDiff\n }px`;\n };\n\n return (\n <Popover.Root\n openOnHover={trigger === \"hover\" ? true : openOnHover}\n open={open}\n onOpenChange={setOpen}\n >\n <Popover.Trigger\n render={children}\n className={clsx(cls(\"popup-panel-trigger\"), classNames?.trigger)}\n ></Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner\n className={clsx(\n cls(\"popup-panel-root\"),\n classNames?.root,\n antdCssVarClassname\n )}\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n anchor={anchor}\n style={\n {\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n >\n <Popover.Popup\n className={clsx(\n cls(\"popup-panel\"),\n cls(`popup-panel-size-${size}`),\n className,\n classNames?.popup,\n antdCssVarClassname\n )}\n ref={mergeRefs(rootRefProp, callbackRef)}\n {...rootPropsWithoutRef}\n {...(resizing ? { \"data-resizing\": true } : {})}\n >\n {/* <div ref={popupRef}> */}\n {title && renderTitle()}\n <div\n className={clsx(cls(\"popup-panel-content\"), classNames?.content)}\n >\n <div className={cls(\"popup-panel-content-inner\")}>{content}</div>\n </div>\n {footer && (\n <div\n className={clsx(cls(\"popup-panel-footer\"), classNames?.footer)}\n >\n {typeof footer === \"function\"\n ? footer({ close: () => setOpen(false) })\n : footer}\n </div>\n )}\n {resizable && (\n <>\n <div\n className={clsx(\n cls(\"popup-panel-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"bottom-left\"\n {...getHandleProps({\n lockHorizontal: true,\n })}\n />\n <div\n className={clsx(\n cls(\"popup-panel-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-left\"\n {...getHandleProps({\n reverse: true,\n lockVertical: true,\n onResize: (values) =>\n onReverseHandleChangeHorizontal(rootRef, values),\n })}\n />\n <div\n className={clsx(\n cls(\"popup-panel-resize-handle\"),\n classNames?.resizeHandle\n )}\n data-placement=\"top-right\"\n {...getHandleProps({\n lockVertical: true,\n })}\n />\n </>\n )}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n"],"names":["PopupPanel","children","placement","openOnHover","outsideOpen","outsideOnOpenChange","content","title","trigger","className","anchor","beforeCloseButton","afterCloseButton","afterTitle","size","footer","defaultOpen","resizable","classNames","open","setOpen","useControlledState","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","headlessUIPlacement","parseAntdPlacement","popupRef","setPopupRef","useState","width","setWidth","height","setHeight","callbackRef","useCallback","node","useEffect","observer","entries","entry","defaultCloseIcon","useMemo","jsx","X","renderTitle","jsxs","clsx","Flex","Popover","IconButton","resizing","setResizing","getRootProps","getHandleProps","rootRef","useResizable","rootRefProp","rootPropsWithoutRef","onReverseHandleChangeHorizontal","parent","values","widthDiff","PopupPanelSize","mergeRefs","Fragment"],"mappings":";;;;;;;;;;;;;AAiGO,MAAMA,KAAa,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,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C,WAAWI;AAAA,0BACT1B,EAAI,2BAA2B;AAAA,0BAC/BJ,KAAA,gBAAAA,EAAY;AAAA,wBACd;AAAA,wBACA,kBAAe;AAAA,wBACd,GAAGqC,EAAe;AAAA,0BACjB,cAAc;AAAA,wBACf,CAAA;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACH,EACF,CAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1 +1 @@
1
- @layer components{.ds-popup-panel{box-shadow:var(--ds-box-shadow-secondary);border-radius:var(--ds-border-radius);background:var(--ds-color-bg-elevated);list-style:none;color:var(--ds-color-text);font-size:var(--ds-font-size);font-family:var(--ds-font-family);transition-property:transform,scale,opacity;transition-duration:.2s;transition-timing-function:var(--ds-motion-ease-out);transform-origin:var(--transform-origin);width:min(var(--size-width),var(--available-width));max-width:var(--available-width);max-height:var(--available-height);height:max-content;display:flex;flex-direction:column}.ds-popup-panel[data-ending-style],.ds-popup-panel[data-starting-style]{transform:scale(.9);opacity:0}.ds-popup-panel:focus{outline:none}.ds-popup-panel-header{border-bottom:1px solid var(--ds-color-split);margin-bottom:0;padding:calc(var(--ds-popup-panel-padding) / 2) var(--ds-popup-panel-padding);flex:0}.ds-popup-panel-header .ds-popup-panel-title-wrapper{font-weight:500;font-size:var(--ds-font-size);line-height:var(--ds-line-height);color:var(--ds-color-text)}.ds-popup-panel-footer{border-top:1px solid var(--ds-color-split);margin-top:0;padding:calc(var(--ds-popup-panel-padding) / 2) var(--ds-popup-panel-padding);flex:0}.ds-popup-panel-content{display:flex;flex-direction:column;flex:1;overflow:auto}.ds-popup-panel-content .ds-popup-panel-content-inner{flex:1;padding:var(--ds-popup-panel-padding)}.ds-resize-handle-top{position:absolute;top:0;width:100%;padding:.5rem;height:4px;border-top-left-radius:.5rem;border-top-right-radius:.5rem;color:#fff;display:block;justify-content:center}.ds-resize-handle-bottom{position:absolute;bottom:0;width:100%;height:4px;padding:.5rem;border-bottom-left-radius:.5rem;border-bottom-right-radius:.5rem;color:#fff;display:block;justify-content:center}.ds-resize-handle-left{position:absolute;left:0;top:0;width:4px;height:100%;padding:.5rem;border-top-left-radius:.5rem;border-bottom-left-radius:.5rem;color:#fff;display:block;align-items:center}.ds-resize-handle-right{position:absolute;right:0;top:0;width:4px;height:100%;padding:.5rem;border-top-right-radius:.5rem;border-bottom-right-radius:.5rem;color:#fff;display:block;align-items:center}}
1
+ @layer components{.ds-popup-panel-root{z-index:1030}.ds-popup-panel{box-shadow:var(--ds-box-shadow-secondary);border-radius:var(--ds-border-radius);background:var(--ds-color-bg-elevated);list-style:none;color:var(--ds-color-text);font-size:var(--ds-font-size);font-family:var(--ds-font-family);transition-property:transform,scale,opacity;transition-duration:.2s;transition-timing-function:var(--ds-motion-ease-out);transform-origin:var(--transform-origin);width:min(var(--size-width),var(--available-width));max-width:var(--available-width);max-height:var(--available-height);height:max-content;display:flex;flex-direction:column}.ds-popup-panel[data-ending-style],.ds-popup-panel[data-starting-style]{transform:scale(.9);opacity:0}.ds-popup-panel:focus{outline:none}.ds-popup-panel-header{border-bottom:1px solid var(--ds-color-split);margin-bottom:0;padding:calc(var(--ds-popup-panel-padding) / 2) var(--ds-popup-panel-padding);flex:0}.ds-popup-panel-title-wrapper{font-weight:500;font-size:var(--ds-font-size);line-height:var(--ds-line-height);color:var(--ds-color-text)}.ds-popup-panel-footer{border-top:1px solid var(--ds-color-split);margin-top:0;padding:calc(var(--ds-popup-panel-padding) / 2) var(--ds-popup-panel-padding);flex:0}.ds-popup-panel-content{display:flex;flex-direction:column;flex:1;overflow:auto}.ds-popup-panel-content .ds-popup-panel-content-inner{flex:1;padding:var(--ds-popup-panel-padding)}.ds-popup-panel-resize-handle{position:absolute;padding:.5rem;color:#fff;display:block}.ds-popup-panel-resize-handle[data-placement=top-left]{left:0;top:0;width:4px;height:100%;border-top-left-radius:.5rem;border-bottom-left-radius:.5rem;align-items:center}.ds-popup-panel-resize-handle[data-placement=top-right]{right:0;top:0;width:4px;height:100%;border-top-right-radius:.5rem;border-bottom-right-radius:.5rem;align-items:center}.ds-popup-panel-resize-handle[data-placement=bottom-left]{bottom:0;width:100%;height:4px;border-bottom-left-radius:.5rem;border-bottom-right-radius:.5rem;justify-content:center}}
@@ -1 +1 @@
1
- @layer components{.ds-scroll-area{display:flex;flex-direction:column;height:100%;min-height:0;flex:1}.ds-scroll-area .ds-scroll-area-viewport{flex-shrink:1;height:100%;max-height:100%;overflow:hidden;overscroll-behavior:contain}:is(.ds-scroll-area .ds-scroll-area-viewport):focus-visible{outline-width:2px;outline-offset:4px;outline-color:var(--ds-color-primary)}.ds-scroll-area .ds-scroll-area-scrollbar{padding:.25rem;display:flex;justify-content:center;background-color:transparent;opacity:0;transition-property:opacity;transition-delay:.1s}:is(.ds-scroll-area .ds-scroll-area-scrollbar) .ds-scroll-area-thumb{border-radius:9999px;background-color:var(--ds-color-bg-fill-tertiary);border:1px solid var(--ds-color-border)}[data-orientation=vertical]:is(.ds-scroll-area .ds-scroll-area-scrollbar){width:.875rem}[data-orientation=vertical]:is(.ds-scroll-area .ds-scroll-area-scrollbar) .ds-scroll-area-thumb{width:100%}[data-orientation=horizontal]:is(.ds-scroll-area .ds-scroll-area-scrollbar){width:100%;height:.875rem;flex-direction:column}[data-orientation=horizontal]:is(.ds-scroll-area .ds-scroll-area-scrollbar) .ds-scroll-area-thumb{height:100%}[data-hovering]:is(.ds-scroll-area .ds-scroll-area-scrollbar){opacity:1;transition-delay:0ms;transition-duration:.2s}[data-scrolling]:is(.ds-scroll-area .ds-scroll-area-scrollbar){opacity:1;transition-delay:0ms;transition-duration:.2s}}
1
+ @layer components{.ds-scroll-area{display:flex;flex-direction:column;height:100%;min-height:0;flex:1}.ds-scroll-area .ds-scroll-area-viewport{flex-shrink:1;height:100%;max-height:100%;overflow:hidden;overscroll-behavior:contain}:is(.ds-scroll-area .ds-scroll-area-viewport):focus-visible{outline-width:2px;outline-offset:4px;outline-color:var(--ds-color-primary)}.ds-scroll-area .ds-scroll-area-scrollbar{padding:.125rem;display:flex;justify-content:center;background-color:transparent;opacity:0;transition-property:opacity;transition-delay:.1s}:is(.ds-scroll-area .ds-scroll-area-scrollbar) .ds-scroll-area-thumb{border-radius:9999px;background-color:var(--ds-color-bg-fill-tertiary);border:1px solid var(--ds-color-border)}[data-orientation=vertical]:is(.ds-scroll-area .ds-scroll-area-scrollbar){width:.625rem}[data-orientation=vertical]:is(.ds-scroll-area .ds-scroll-area-scrollbar) .ds-scroll-area-thumb{width:100%}[data-orientation=horizontal]:is(.ds-scroll-area .ds-scroll-area-scrollbar){width:100%;height:.625rem;flex-direction:column}[data-orientation=horizontal]:is(.ds-scroll-area .ds-scroll-area-scrollbar) .ds-scroll-area-thumb{height:100%}[data-hovering]:is(.ds-scroll-area .ds-scroll-area-scrollbar){opacity:1;transition-delay:0ms;transition-duration:.2s}[data-scrolling]:is(.ds-scroll-area .ds-scroll-area-scrollbar){opacity:1;transition-delay:0ms;transition-duration:.2s}}
@@ -2,14 +2,15 @@ import { jsx as T } from "react/jsx-runtime";
2
2
  import p from "antd/es/tree";
3
3
  import { forwardRef as l } from "react";
4
4
  import { useTreeCommon as u } from "./useTreeCommon.js";
5
+ import './style.css';/* empty css */
5
6
  import { clsx as k } from "../utils/cn.js";
6
7
  const y = (e, r) => {
7
8
  const {
8
9
  cls: c,
9
10
  customSwitcherIcon: n,
10
11
  processedTreeData: t,
11
- currentUniqueExpandedKeys: s,
12
- currentUniqueCheckedKeys: o,
12
+ currentUniqueExpandedKeys: o,
13
+ currentUniqueCheckedKeys: s,
13
14
  handleAntTreeExpand: a,
14
15
  handleAntTreeCheck: d,
15
16
  restProps: h,
@@ -23,9 +24,9 @@ const y = (e, r) => {
23
24
  className: k(c("tree"), i),
24
25
  switcherIcon: m || n,
25
26
  treeData: t,
26
- expandedKeys: s,
27
+ expandedKeys: o,
27
28
  onExpand: a,
28
- checkedKeys: { checked: o, halfChecked: [] },
29
+ checkedKeys: { checked: s, halfChecked: [] },
29
30
  onCheck: d,
30
31
  ...h
31
32
  }
@@ -35,8 +36,8 @@ const y = (e, r) => {
35
36
  cls: c,
36
37
  customSwitcherIcon: n,
37
38
  processedTreeData: t,
38
- currentUniqueExpandedKeys: s,
39
- currentUniqueCheckedKeys: o,
39
+ currentUniqueExpandedKeys: o,
40
+ currentUniqueCheckedKeys: s,
40
41
  handleAntTreeExpand: a,
41
42
  handleAntTreeCheck: d,
42
43
  restProps: h,
@@ -50,18 +51,18 @@ const y = (e, r) => {
50
51
  className: k(c("directory-tree"), i),
51
52
  switcherIcon: m || n,
52
53
  treeData: t,
53
- expandedKeys: s,
54
+ expandedKeys: o,
54
55
  onExpand: a,
55
- checkedKeys: { checked: o, halfChecked: [] },
56
+ checkedKeys: { checked: s, halfChecked: [] },
56
57
  onCheck: d,
57
58
  ...h
58
59
  }
59
60
  );
60
- }, f = l(y), C = l(x), N = Object.assign(f, {
61
+ }, f = l(y), C = l(x), A = Object.assign(f, {
61
62
  DirectoryTree: C,
62
63
  TreeNode: p.TreeNode
63
64
  });
64
65
  export {
65
- N as Tree
66
+ A as Tree
66
67
  };
67
68
  //# sourceMappingURL=components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sources":["../../../src/components/Tree/components.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntTree,\n type DataNode as AntTreeDataNode,\n} from \"antd/es/tree\";\n\nimport { forwardRef } from \"react\";\nimport { clsx } from \"../utils\";\nimport type { TreeDataNode, TreeProps, DirectoryTreeProps } from \"./types\";\nimport { useTreeCommon } from \"./useTreeCommon\";\n\n// Create inner function for main Tree with forwarded ref\n// Ensure generic constraint matches TreeProps if it uses AntTreeDataNode\nconst MainTreeInner = <T extends AntTreeDataNode = TreeDataNode>(\n props: TreeProps<T>,\n ref: React.Ref<React.ComponentRef<typeof AntTree<T>>>\n) => {\n const {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n } = useTreeCommon(props);\n\n return (\n <AntTree\n ref={ref}\n className={clsx(cls(\"tree\"), className)}\n switcherIcon={switcherIcon || customSwitcherIcon}\n // Pass processed props to AntTree\n treeData={processedTreeData}\n expandedKeys={currentUniqueExpandedKeys}\n onExpand={handleAntTreeExpand}\n // Pass checked keys in the object format\n checkedKeys={{ checked: currentUniqueCheckedKeys, halfChecked: [] }}\n onCheck={handleAntTreeCheck}\n {...restProps} // Pass other props like checkable, showLine, etc.\n />\n );\n};\n\n// Create inner function for DirectoryTree with forwarded ref\nconst DirectoryTreeInner = <T extends AntTreeDataNode = TreeDataNode>(\n props: DirectoryTreeProps<T>,\n ref: React.Ref<React.ComponentRef<typeof AntTree<T>>>\n) => {\n const {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n } = useTreeCommon(props as any);\n\n return (\n <AntTree.DirectoryTree\n ref={ref}\n className={clsx(cls(\"directory-tree\"), className)}\n switcherIcon={switcherIcon || customSwitcherIcon}\n // Pass processed props to AntTree.DirectoryTree\n treeData={processedTreeData as T[]}\n expandedKeys={currentUniqueExpandedKeys}\n onExpand={handleAntTreeExpand}\n // Pass checked keys in the object format\n checkedKeys={{ checked: currentUniqueCheckedKeys, halfChecked: [] }}\n onCheck={handleAntTreeCheck}\n {...restProps} // Pass other props like checkable, showLine, etc.\n />\n );\n};\n\n// Use forwardRef with type assertion for main Tree\n// Ensure the generic constraint here matches TreeProps\nconst MainTree = forwardRef(MainTreeInner) as <\n T extends AntTreeDataNode = TreeDataNode // Use AntTreeDataNode if TreeProps uses it\n>(\n props: TreeProps<T> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntTree<T>>>;\n }\n) => ReturnType<typeof MainTreeInner<T>>;\n\n// Use forwardRef with type assertion for DirectoryTree\nconst DirectoryTree = forwardRef(DirectoryTreeInner) as <\n T extends AntTreeDataNode = AntTreeDataNode\n>(\n props: DirectoryTreeProps<T> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntTree<T>>>; // Check ref type consistency\n }\n) => ReturnType<typeof DirectoryTreeInner<T>>;\n\n// Create the final component with DirectoryTree property\nexport const Tree = Object.assign(MainTree, {\n DirectoryTree,\n TreeNode: AntTree.TreeNode,\n});\n"],"names":["MainTreeInner","props","ref","cls","customSwitcherIcon","processedTreeData","currentUniqueExpandedKeys","currentUniqueCheckedKeys","handleAntTreeExpand","handleAntTreeCheck","restProps","className","switcherIcon","useTreeCommon","jsx","AntTree","clsx","DirectoryTreeInner","MainTree","forwardRef","DirectoryTree","Tree"],"mappings":";;;;;AAaA,MAAMA,IAAgB,CACpBC,GACAC,MACG;AACG,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEC,EAAcZ,CAAK;AAGrB,SAAA,gBAAAa;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAb;AAAA,MACA,WAAWc,EAAKb,EAAI,MAAM,GAAGQ,CAAS;AAAA,MACtC,cAAcC,KAAgBR;AAAA,MAE9B,UAAUC;AAAA,MACV,cAAcC;AAAA,MACd,UAAUE;AAAA,MAEV,aAAa,EAAE,SAASD,GAA0B,aAAa,CAAA,EAAG;AAAA,MAClE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EACN;AAEJ,GAGMO,IAAqB,CACzBhB,GACAC,MACG;AACG,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEC,EAAcZ,CAAY;AAG5B,SAAA,gBAAAa;AAAA,IAACC,EAAQ;AAAA,IAAR;AAAA,MACC,KAAAb;AAAA,MACA,WAAWc,EAAKb,EAAI,gBAAgB,GAAGQ,CAAS;AAAA,MAChD,cAAcC,KAAgBR;AAAA,MAE9B,UAAUC;AAAA,MACV,cAAcC;AAAA,MACd,UAAUE;AAAA,MAEV,aAAa,EAAE,SAASD,GAA0B,aAAa,CAAA,EAAG;AAAA,MAClE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EACN;AAEJ,GAIMQ,IAAWC,EAAWnB,CAAa,GASnCoB,IAAgBD,EAAWF,CAAkB,GAStCI,IAAO,OAAO,OAAOH,GAAU;AAAA,EAC1C,eAAAE;AAAA,EACA,UAAUL,EAAQ;AACpB,CAAC;"}
1
+ {"version":3,"file":"components.js","sources":["../../../src/components/Tree/components.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntTree,\n type DataNode as AntTreeDataNode,\n} from \"antd/es/tree\";\n\nimport { forwardRef } from \"react\";\nimport { clsx } from \"../utils\";\nimport type { TreeDataNode, TreeProps, DirectoryTreeProps } from \"./types\";\nimport { useTreeCommon } from \"./useTreeCommon\";\n\nimport \"./style.css\";\n\n// Create inner function for main Tree with forwarded ref\n// Ensure generic constraint matches TreeProps if it uses AntTreeDataNode\nconst MainTreeInner = <T extends AntTreeDataNode = TreeDataNode>(\n props: TreeProps<T>,\n ref: React.Ref<React.ComponentRef<typeof AntTree<T>>>\n) => {\n const {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n } = useTreeCommon(props);\n\n return (\n <AntTree\n ref={ref}\n className={clsx(cls(\"tree\"), className)}\n switcherIcon={switcherIcon || customSwitcherIcon}\n // Pass processed props to AntTree\n treeData={processedTreeData}\n expandedKeys={currentUniqueExpandedKeys}\n onExpand={handleAntTreeExpand}\n // Pass checked keys in the object format\n checkedKeys={{ checked: currentUniqueCheckedKeys, halfChecked: [] }}\n onCheck={handleAntTreeCheck}\n {...restProps} // Pass other props like checkable, showLine, etc.\n />\n );\n};\n\n// Create inner function for DirectoryTree with forwarded ref\nconst DirectoryTreeInner = <T extends AntTreeDataNode = TreeDataNode>(\n props: DirectoryTreeProps<T>,\n ref: React.Ref<React.ComponentRef<typeof AntTree<T>>>\n) => {\n const {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n } = useTreeCommon(props as any);\n\n return (\n <AntTree.DirectoryTree\n ref={ref}\n className={clsx(cls(\"directory-tree\"), className)}\n switcherIcon={switcherIcon || customSwitcherIcon}\n // Pass processed props to AntTree.DirectoryTree\n treeData={processedTreeData as T[]}\n expandedKeys={currentUniqueExpandedKeys}\n onExpand={handleAntTreeExpand}\n // Pass checked keys in the object format\n checkedKeys={{ checked: currentUniqueCheckedKeys, halfChecked: [] }}\n onCheck={handleAntTreeCheck}\n {...restProps} // Pass other props like checkable, showLine, etc.\n />\n );\n};\n\n// Use forwardRef with type assertion for main Tree\n// Ensure the generic constraint here matches TreeProps\nconst MainTree = forwardRef(MainTreeInner) as <\n T extends AntTreeDataNode = TreeDataNode // Use AntTreeDataNode if TreeProps uses it\n>(\n props: TreeProps<T> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntTree<T>>>;\n }\n) => ReturnType<typeof MainTreeInner<T>>;\n\n// Use forwardRef with type assertion for DirectoryTree\nconst DirectoryTree = forwardRef(DirectoryTreeInner) as <\n T extends AntTreeDataNode = AntTreeDataNode\n>(\n props: DirectoryTreeProps<T> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntTree<T>>>; // Check ref type consistency\n }\n) => ReturnType<typeof DirectoryTreeInner<T>>;\n\n// Create the final component with DirectoryTree property\nexport const Tree = Object.assign(MainTree, {\n DirectoryTree,\n TreeNode: AntTree.TreeNode,\n});\n"],"names":["MainTreeInner","props","ref","cls","customSwitcherIcon","processedTreeData","currentUniqueExpandedKeys","currentUniqueCheckedKeys","handleAntTreeExpand","handleAntTreeCheck","restProps","className","switcherIcon","useTreeCommon","jsx","AntTree","clsx","DirectoryTreeInner","MainTree","forwardRef","DirectoryTree","Tree"],"mappings":";;;;;;AAeA,MAAMA,IAAgB,CACpBC,GACAC,MACG;AACG,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEC,EAAcZ,CAAK;AAGrB,SAAA,gBAAAa;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAb;AAAA,MACA,WAAWc,EAAKb,EAAI,MAAM,GAAGQ,CAAS;AAAA,MACtC,cAAcC,KAAgBR;AAAA,MAE9B,UAAUC;AAAA,MACV,cAAcC;AAAA,MACd,UAAUE;AAAA,MAEV,aAAa,EAAE,SAASD,GAA0B,aAAa,CAAA,EAAG;AAAA,MAClE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EACN;AAEJ,GAGMO,IAAqB,CACzBhB,GACAC,MACG;AACG,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEC,EAAcZ,CAAY;AAG5B,SAAA,gBAAAa;AAAA,IAACC,EAAQ;AAAA,IAAR;AAAA,MACC,KAAAb;AAAA,MACA,WAAWc,EAAKb,EAAI,gBAAgB,GAAGQ,CAAS;AAAA,MAChD,cAAcC,KAAgBR;AAAA,MAE9B,UAAUC;AAAA,MACV,cAAcC;AAAA,MACd,UAAUE;AAAA,MAEV,aAAa,EAAE,SAASD,GAA0B,aAAa,CAAA,EAAG;AAAA,MAClE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EACN;AAEJ,GAIMQ,IAAWC,EAAWnB,CAAa,GASnCoB,IAAgBD,EAAWF,CAAkB,GAStCI,IAAO,OAAO,OAAOH,GAAU;AAAA,EAC1C,eAAAE;AAAA,EACA,UAAUL,EAAQ;AACpB,CAAC;"}
@@ -0,0 +1 @@
1
+ @layer components{.ds-tree{background:none}.ds-tree-treenode{display:flex;width:100%}.ds-tree-node-content-wrapper{display:flex;flex-grow:1}.ds-tree-title{flex:1}.ds-tree-switcher{display:flex;align-items:center;justify-content:center}.ds-tree-icon__customize{display:flex;align-items:center;justify-content:center;font-size:1rem;color:var(--ds-color-icon);margin-right:.5rem}.ds-tree-treenode-selected .ds-tree-icon__customize{color:var(--ds-tree-directory-node-selected-color)}.ds-tree-treenode:not(.ds-tree-treenode-disabled).ds-tree-treenode-selected .ds-tree-node-content-wrapper:hover{color:var(--ds-tree-directory-node-selected-color)}.ds-tree-switcher .ds-tree-switcher-icon{font-size:.75rem}.ds-caret-switcher-icon{transition:transform .2s ease-in-out}.ds-tree-switcher_open .ds-caret-switcher-icon{transform:rotate(90deg)}.ds-tree .ds-tree-switcher:before{height:max(100%,var(--ds-tree-title-height))}}
package/dist/index.d.ts CHANGED
@@ -917,7 +917,7 @@ export { DrawerProps }
917
917
 
918
918
  export { Dropdown }
919
919
 
920
- export declare const DropdownMenu: ({ children, items, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, }: DropdownMenuProps) => JSX.Element;
920
+ export declare const DropdownMenu: ({ children, items, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, className, itemRender, classNames, }: DropdownMenuProps) => JSX.Element;
921
921
 
922
922
  export declare type DropdownMenuItemType = {
923
923
  type: "item";
@@ -940,12 +940,52 @@ export declare type DropdownMenuItemType = {
940
940
  };
941
941
 
942
942
  export declare interface DropdownMenuProps {
943
+ /** Array of menu items to be displayed in the dropdown */
943
944
  items: DropdownMenuItemType[];
945
+ /** Custom render function for the trigger element */
944
946
  children?: React.ComponentProps<typeof Menu_2.Trigger>["render"];
947
+ /**
948
+ * Placement of the dropdown relative to the trigger element
949
+ * @default "bottomLeft"
950
+ */
945
951
  placement?: PopoverProps_2["placement"];
952
+ /**
953
+ * Whether to open the dropdown on hover instead of click
954
+ * @default false
955
+ */
946
956
  openOnHover?: boolean;
957
+ /**
958
+ * Controlled open state of the dropdown
959
+ */
947
960
  open?: boolean;
961
+ /**
962
+ * Callback fired when the dropdown open state changes
963
+ */
948
964
  onOpenChange?: (open: boolean) => void;
965
+ /**
966
+ * Additional CSS class for the dropdown component
967
+ */
968
+ className?: string;
969
+ /**
970
+ * Custom class names for different parts of the dropdown
971
+ * @default {}
972
+ */
973
+ classNames?: {
974
+ root?: string;
975
+ trigger?: string;
976
+ popup?: string;
977
+ group?: string;
978
+ groupLabel?: string;
979
+ item?: string;
980
+ itemIcon?: string;
981
+ itemText?: string;
982
+ separator?: string;
983
+ positioner?: string;
984
+ };
985
+ /**
986
+ * Custom render function for menu items
987
+ */
988
+ itemRender?: (item: DropdownMenuItemType, props: React.HTMLAttributes<HTMLElement>) => React.ReactElement;
949
989
  }
950
990
 
951
991
  export { DropDownProps }
@@ -1299,7 +1339,7 @@ export declare interface PopoverProps extends PopoverProps_2 {
1299
1339
  arrow?: PopoverProps_2["arrow"];
1300
1340
  }
1301
1341
 
1302
- export declare const PopupPanel: ({ children, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, content, title, trigger, className, anchor, beforeCloseButton, afterCloseButton, afterTitle, size, footer, defaultOpen, resizable, }: PopupPanelProps) => JSX.Element;
1342
+ export declare const PopupPanel: ({ children, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, content, title, trigger, className, anchor, beforeCloseButton, afterCloseButton, afterTitle, size, footer, defaultOpen, resizable, classNames, }: PopupPanelProps) => JSX.Element;
1303
1343
 
1304
1344
  export declare interface PopupPanelProps extends Omit<React.ComponentPropsWithRef<"div">, "title" | "content" | "children"> {
1305
1345
  /** The trigger element that opens the popup panel */
@@ -1356,6 +1396,20 @@ export declare interface PopupPanelProps extends Omit<React.ComponentPropsWithRe
1356
1396
  * @default false
1357
1397
  */
1358
1398
  resizable?: boolean;
1399
+ /**
1400
+ * Custom class names for different parts of the popup panel
1401
+ * @default {}
1402
+ */
1403
+ classNames?: {
1404
+ root?: string;
1405
+ trigger?: string;
1406
+ popup?: string;
1407
+ header?: string;
1408
+ title?: string;
1409
+ content?: string;
1410
+ footer?: string;
1411
+ resizeHandle?: string;
1412
+ };
1359
1413
  }
1360
1414
 
1361
1415
  declare enum PopupPanelSize {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bioturing/components",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -20,6 +20,7 @@
20
20
  "@base-ui-components/react": "1.0.0-alpha.8",
21
21
  "@floating-ui/react": "^0.27.8",
22
22
  "es-toolkit": "^1.37.2",
23
+ "merge-refs": "^2.0.0",
23
24
  "prism-react-renderer": "^2.4.1",
24
25
  "rc-select": "^14.16.7",
25
26
  "rc-table": "^7.50.4",