@bioturing/components 0.38.0 → 0.39.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.
@@ -95,6 +95,18 @@ export interface PopupPanelProps extends Omit<React.ComponentPropsWithRef<"div">
95
95
  * Callback function when the placement changes
96
96
  */
97
97
  onPlacementChange?: (placement: PopoverProps["placement"]) => void;
98
+ /**
99
+ * Props to pass to the positioner
100
+ */
101
+ positionerProps?: Popover.Positioner.Props;
102
+ /**
103
+ * Props to pass to the trigger
104
+ */
105
+ triggerProps?: Popover.Trigger.Props;
106
+ /**
107
+ * Props to pass to the portal
108
+ */
109
+ portalProps?: Popover.Portal.Props;
98
110
  }
99
- export declare const PopupPanel: ({ children, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, content, title, trigger, className, anchor, beforeCloseButton, afterCloseButton, afterTitle, size, footer, defaultOpen, resizable, draggable, maintainAspectRatio, classNames, modal, closeOnClickOutside, onPlacementChange, ...rest }: PopupPanelProps) => import("react/jsx-runtime").JSX.Element;
111
+ export declare const PopupPanel: ({ children, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, content, title, trigger, className, anchor, beforeCloseButton, afterCloseButton, afterTitle, size, footer, defaultOpen, resizable, draggable, maintainAspectRatio, classNames, modal, closeOnClickOutside, onPlacementChange, positionerProps, triggerProps, portalProps, ...rest }: PopupPanelProps) => import("react/jsx-runtime").JSX.Element;
100
112
  //# sourceMappingURL=component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/popup-panel/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAW5D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAK7C,OAAO,aAAa,CAAC;AAGrB,MAAM,WAAW,eACf,SAAQ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KAAK,CAAC,SAAS,CAAC,CAAC;IACxD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACpC;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACpE;AAED,eAAO,MAAM,UAAU,GAAI,mUAyBxB,eAAe,4CA+MjB,CAAC"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/popup-panel/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAY5D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAK7C,OAAO,aAAa,CAAC;AAGrB,MAAM,WAAW,eACf,SAAQ,IAAI,CACR,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAClC,OAAO,GAA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,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACpC;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACnE;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;IAC3C;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;CACpC;AAED,eAAO,MAAM,UAAU,GAAI,+WA4BxB,eAAe,4CAkNjB,CAAC"}
@@ -1,86 +1,90 @@
1
1
  "use client";
2
2
  import { jsx as e, jsxs as c } from "react/jsx-runtime";
3
3
  import { Popover as a } from "@base-ui-components/react/popover";
4
- import { X as Y } from "@bioturing/assets";
5
- import { useMemo as Z, useRef as S, useState as A, useEffect as _, useCallback as B } from "react";
6
- import { Stack as ee } from "../stack/index.js";
7
- import { PopupPanelSize as re } from "./constants.js";
4
+ import { mergeProps as S } from "@base-ui-components/react";
5
+ import { X as re } from "@bioturing/assets";
6
+ import { useMemo as te, useRef as A, useState as x, useEffect as ne, useCallback as oe } from "react";
7
+ import { Stack as ie } from "../stack/index.js";
8
+ import { PopupPanelSize as ae } from "./constants.js";
8
9
  import './style.css';/* empty css */
9
- import { anchorToResizeHandles as te } from "./utils.js";
10
- import { parseAntdPlacement as ne, buildAntdPlacement as oe } from "../utils/placement.js";
11
- import { useDraggable as ie } from "../hooks/useDraggable.js";
12
- import { Resizable as ae } from "../resizable/component.js";
13
- import { useControlledState as pe } from "../hooks/useControlledState.js";
14
- import { useCls as le } from "../utils/antdUtils.js";
15
- import { useTheme as se } from "../theme-provider/context/themeStore.js";
10
+ import { anchorToResizeHandles as pe } from "./utils.js";
11
+ import { parseAntdPlacement as se, buildAntdPlacement as le } from "../utils/placement.js";
12
+ import { useDraggable as ce } from "../hooks/useDraggable.js";
13
+ import { Resizable as ue } from "../resizable/component.js";
14
+ import { useControlledState as de } from "../hooks/useControlledState.js";
15
+ import { useCls as me } from "../utils/antdUtils.js";
16
+ import { useTheme as fe } from "../theme-provider/context/themeStore.js";
16
17
  import { clsx as p } from "../utils/cn.js";
17
- import { IconButton as ce } from "../icon-button/component.js";
18
- const Ae = ({
19
- children: x,
20
- placement: z,
21
- openOnHover: H = !1,
22
- open: k,
23
- onOpenChange: E,
24
- content: I,
18
+ import { IconButton as ge } from "../icon-button/component.js";
19
+ const Ie = ({
20
+ children: z,
21
+ placement: H,
22
+ openOnHover: k = !1,
23
+ open: E,
24
+ onOpenChange: I,
25
+ content: K,
25
26
  title: h,
26
- trigger: K = "click",
27
- className: T,
28
- anchor: j,
27
+ trigger: T = "click",
28
+ className: j,
29
+ anchor: M,
29
30
  beforeCloseButton: N,
30
31
  afterCloseButton: w,
31
32
  afterTitle: b,
32
33
  size: P = "medium",
33
34
  footer: u,
34
- defaultOpen: M = !1,
35
+ defaultOpen: D = !1,
35
36
  resizable: y = !1,
36
- draggable: D = !1,
37
- maintainAspectRatio: F = !1,
37
+ draggable: F = !1,
38
+ maintainAspectRatio: U = !1,
38
39
  classNames: n,
39
- modal: U = !1,
40
- closeOnClickOutside: V = !0,
40
+ modal: V = !1,
41
+ closeOnClickOutside: X = !0,
41
42
  onPlacementChange: v,
42
- ...X
43
+ positionerProps: $ = {},
44
+ triggerProps: q = {},
45
+ portalProps: G = {},
46
+ ...J
43
47
  }) => {
44
- const [R, C] = pe(
45
- k,
48
+ const [R, C] = de(
46
49
  E,
47
- M
50
+ I,
51
+ D
48
52
  // Always provide a default value to prevent undefined
49
- ), r = le(), { className: $ } = se(), d = ne(z), O = Z(() => /* @__PURE__ */ e(Y, { size: 16 }), []), f = S(d.side), m = S(d.align), [q, G] = A(0), [s, J] = A(
53
+ ), r = me(), { className: L } = fe(), d = se(H), O = te(() => /* @__PURE__ */ e(re, { size: 16 }), []), m = A(d.side), f = A(d.align), [Q, W] = x(0), [l, Y] = x(
50
54
  null
51
55
  );
52
- _(() => {
53
- if (!s || !R) return;
54
- const i = new MutationObserver((l) => {
56
+ ne(() => {
57
+ if (!l || !R) return;
58
+ const i = new MutationObserver((s) => {
55
59
  let g = !1;
56
- if (l.forEach((t) => {
60
+ if (s.forEach((t) => {
57
61
  if (t.type === "attributes" && t.attributeName === "data-side") {
58
- const o = s.getAttribute(t.attributeName);
59
- o && o !== f.current && (f.current = o, g = !0);
62
+ const o = l.getAttribute(t.attributeName);
63
+ o && o !== m.current && (m.current = o, g = !0);
60
64
  }
61
65
  if (t.type === "attributes" && t.attributeName === "data-align") {
62
- const o = s.getAttribute(t.attributeName);
63
- o && o !== m.current && (m.current = o, g = !0);
66
+ const o = l.getAttribute(t.attributeName);
67
+ o && o !== f.current && (f.current = o, g = !0);
64
68
  }
65
69
  }), g) {
66
- const t = oe({
67
- side: f.current,
68
- align: m.current
70
+ const t = le({
71
+ side: m.current,
72
+ align: f.current
69
73
  });
70
- G((o) => o + 1), v && v(t);
74
+ W((o) => o + 1), v && v(t);
71
75
  }
72
76
  });
73
- return i.observe(s, {
77
+ return i.observe(l, {
74
78
  attributes: !0,
75
79
  attributeFilter: ["data-side", "data-align"],
76
80
  attributeOldValue: !0
77
81
  }), () => {
78
82
  i.disconnect();
79
83
  };
80
- }, [v, R, s]);
81
- const L = B(() => /* @__PURE__ */ c("div", { className: p(r("popup-panel-header"), n?.header), children: [
84
+ }, [v, R, l]);
85
+ const Z = oe(() => /* @__PURE__ */ c("div", { className: p(r("popup-panel-header"), n?.header), children: [
82
86
  /* @__PURE__ */ c(
83
- ee,
87
+ ie,
84
88
  {
85
89
  align: "center",
86
90
  gap: 8,
@@ -97,7 +101,7 @@ const Ae = ({
97
101
  /* @__PURE__ */ e(
98
102
  a.Close,
99
103
  {
100
- render: /* @__PURE__ */ e(ce, { children: O })
104
+ render: /* @__PURE__ */ e(ge, { children: O })
101
105
  }
102
106
  ),
103
107
  w
@@ -115,75 +119,78 @@ const Ae = ({
115
119
  n?.title,
116
120
  O,
117
121
  h
118
- ]), { ref: Q } = ie(D), W = /* @__PURE__ */ c(
122
+ ]), { ref: _ } = ce(F), B = /* @__PURE__ */ c(
119
123
  a.Popup,
120
124
  {
121
125
  className: p(
122
126
  r("popup-panel"),
123
127
  r(`popup-panel-size-${P}`),
124
- T,
128
+ j,
125
129
  n?.popup
126
130
  ),
127
- ref: Q,
131
+ ref: _,
128
132
  children: [
129
- h && L(),
130
- /* @__PURE__ */ e("div", { className: p(r("popup-panel-content"), n?.content), children: /* @__PURE__ */ e("div", { className: r("popup-panel-content-inner"), children: I }) }),
133
+ h && Z(),
134
+ /* @__PURE__ */ e("div", { className: p(r("popup-panel-content"), n?.content), children: /* @__PURE__ */ e("div", { className: r("popup-panel-content-inner"), children: K }) }),
131
135
  u && /* @__PURE__ */ e("div", { className: p(r("popup-panel-footer"), n?.footer), children: typeof u == "function" ? u({ close: () => C(!1) }) : u })
132
136
  ]
133
137
  }
134
- );
138
+ ), ee = {
139
+ ref: Y,
140
+ className: p(r("popup-panel-root"), L, n?.root),
141
+ side: d.side,
142
+ align: d.align,
143
+ sideOffset: 4,
144
+ anchor: M,
145
+ style: {
146
+ "--size-width": P ? ae[P] : void 0
147
+ },
148
+ render: ({ children: i, onDragEnd: s, onDragStart: g, ...t }) => y ? /* @__PURE__ */ e(
149
+ ue,
150
+ {
151
+ resizable: y,
152
+ resetKey: Q,
153
+ maintainAspectRatio: U,
154
+ classNames: {
155
+ resizeHandle: n?.resizeHandle
156
+ },
157
+ handles: pe(
158
+ m.current,
159
+ f.current
160
+ ),
161
+ ...t,
162
+ children: i
163
+ }
164
+ ) : /* @__PURE__ */ e("div", { ...t, children: i })
165
+ };
135
166
  return /* @__PURE__ */ c(
136
167
  a.Root,
137
168
  {
138
- openOnHover: K === "hover" ? !0 : H,
139
169
  open: R,
140
- onOpenChange: (i, l) => {
141
- (l.reason === "outside-press" || l.reason === "focus-out") && !V || C(i, l);
170
+ onOpenChange: (i, s) => {
171
+ (s.reason === "outside-press" || s.reason === "focus-out") && !X || C(i, s);
142
172
  },
143
- modal: U,
144
- ...X,
173
+ modal: V,
174
+ ...J,
145
175
  children: [
146
176
  /* @__PURE__ */ e(
147
177
  a.Trigger,
148
178
  {
149
- render: x,
150
- className: p(r("popup-panel-trigger"), n?.trigger)
179
+ ...S(
180
+ {
181
+ render: z,
182
+ className: p(r("popup-panel-trigger"), n?.trigger),
183
+ openOnHover: T === "hover" ? !0 : k
184
+ },
185
+ q
186
+ )
151
187
  }
152
188
  ),
153
- /* @__PURE__ */ e(a.Portal, { children: /* @__PURE__ */ e(
189
+ /* @__PURE__ */ e(a.Portal, { ...G, children: /* @__PURE__ */ e(
154
190
  a.Positioner,
155
191
  {
156
- ref: J,
157
- className: p(
158
- r("popup-panel-root"),
159
- $,
160
- n?.root
161
- ),
162
- side: d.side,
163
- align: d.align,
164
- sideOffset: 4,
165
- anchor: j,
166
- style: {
167
- "--size-width": P ? re[P] : void 0
168
- },
169
- render: ({ children: i, onDragEnd: l, onDragStart: g, ...t }) => y ? /* @__PURE__ */ e(
170
- ae,
171
- {
172
- resizable: y,
173
- resetKey: q,
174
- maintainAspectRatio: F,
175
- classNames: {
176
- resizeHandle: n?.resizeHandle
177
- },
178
- handles: te(
179
- f.current,
180
- m.current
181
- ),
182
- ...t,
183
- children: i
184
- }
185
- ) : /* @__PURE__ */ e("div", { ...t, children: i }),
186
- children: W
192
+ ...S(ee, $),
193
+ children: B
187
194
  }
188
195
  ) })
189
196
  ]
@@ -191,6 +198,6 @@ const Ae = ({
191
198
  );
192
199
  };
193
200
  export {
194
- Ae as PopupPanel
201
+ Ie as PopupPanel
195
202
  };
196
203
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/popup-panel/component.tsx"],"sourcesContent":["\"use client\";\nimport { Popover } from \"@base-ui-components/react/popover\";\nimport {\n BaseUIAlign,\n BaseUISide,\n buildAntdPlacement,\n clsx,\n parseAntdPlacement,\n useCls,\n} from \"../utils\";\n\nimport { X } from \"@bioturing/assets\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useControlledState, useDraggable } from \"../hooks\";\nimport { IconButton } from \"../icon-button\";\nimport { Resizable } from \"../resizable\";\nimport { Stack } from \"../stack\";\nimport { PopupPanelSize } from \"./constants\";\n\n// Import component-specific styles\nimport { useRef } from \"react\";\nimport { useTheme } from \"../theme-provider\";\nimport \"./style.css\";\nimport { anchorToResizeHandles } from \"./utils\";\n\nexport interface PopupPanelProps\n extends Omit<\n React.ComponentPropsWithRef<\"div\">,\n \"title\" | \"content\" | \"children\"\n >,\n Omit<Popover.Root.Props, \"children\"> {\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?: Popover.Root.Props[\"onOpenChange\"];\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 * Whether the panel should be draggable\n * @default false\n */\n draggable?: boolean;\n /**\n * Whether to maintain aspect ratio when resizing\n * Only applies when resizable is true\n * @default false\n */\n maintainAspectRatio?: 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 * Whether to close the panel when clicking outside\n * @default true\n */\n closeOnClickOutside?: boolean;\n /**\n * Whether to use modal mode\n * @default false\n */\n modal?: Popover.Root.Props[\"modal\"];\n /**\n * Callback function when the placement changes\n */\n onPlacementChange?: (placement: PopoverProps[\"placement\"]) => void;\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 = false,\n resizable = false,\n draggable = false,\n maintainAspectRatio = false,\n classNames,\n modal = false,\n closeOnClickOutside = true,\n onPlacementChange,\n ...rest\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 // Always provide a default value to prevent undefined\n );\n\n const cls = useCls();\n const { className: themeClassName } = useTheme();\n const baseUIPlacement = parseAntdPlacement(placement);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\n\n // const positionerRef = useRef<HTMLDivElement>(null);\n\n const currentSideRef = useRef<BaseUISide>(baseUIPlacement.side);\n const currentAlignRef = useRef<BaseUIAlign>(baseUIPlacement.align);\n const [placementChangeKey, setPlacementChangeKey] = useState(0);\n const [positionerRef, setPositionerRef] = useState<HTMLDivElement | null>(\n null\n );\n\n useEffect(() => {\n if (!positionerRef || !open) return; // Only observe when popup is open\n\n // Create MutationObserver to watch for data-side changes\n const observer = new MutationObserver((mutations) => {\n let hasPlacementChanged = false;\n mutations.forEach((mutation) => {\n if (\n mutation.type === \"attributes\" &&\n mutation.attributeName === \"data-side\"\n ) {\n const newSide = positionerRef.getAttribute(mutation.attributeName);\n if (newSide && newSide !== currentSideRef.current) {\n currentSideRef.current = newSide as BaseUISide;\n hasPlacementChanged = true;\n }\n }\n if (\n mutation.type === \"attributes\" &&\n mutation.attributeName === \"data-align\"\n ) {\n const newAlign = positionerRef.getAttribute(mutation.attributeName);\n if (newAlign && newAlign !== currentAlignRef.current) {\n currentAlignRef.current = newAlign as BaseUIAlign;\n hasPlacementChanged = true;\n }\n }\n });\n\n // Only trigger callbacks if placement actually changed\n if (hasPlacementChanged) {\n const newPlacement = buildAntdPlacement({\n side: currentSideRef.current,\n align: currentAlignRef.current,\n });\n\n // Trigger resizable dimensions reset when placement changes\n setPlacementChangeKey((prev) => prev + 1);\n\n if (onPlacementChange) {\n onPlacementChange(newPlacement);\n }\n }\n });\n\n // Start observing\n observer.observe(positionerRef, {\n attributes: true,\n attributeFilter: [\"data-side\", \"data-align\"],\n attributeOldValue: true,\n });\n\n return () => {\n observer.disconnect();\n };\n }, [onPlacementChange, open, positionerRef]);\n\n const renderTitle = useCallback(() => {\n return (\n <div className={clsx(cls(\"popup-panel-header\"), classNames?.header)}>\n <Stack\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 </Stack>\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\n const { ref: draggableRef } = useDraggable(draggable);\n\n const popup = (\n <Popover.Popup\n className={clsx(\n cls(\"popup-panel\"),\n cls(`popup-panel-size-${size}`),\n className,\n classNames?.popup\n )}\n ref={draggableRef}\n >\n {title && renderTitle()}\n <div className={clsx(cls(\"popup-panel-content\"), classNames?.content)}>\n <div className={cls(\"popup-panel-content-inner\")}>{content}</div>\n </div>\n {footer && (\n <div className={clsx(cls(\"popup-panel-footer\"), classNames?.footer)}>\n {typeof footer === \"function\"\n ? footer({ close: () => setOpen(false) })\n : footer}\n </div>\n )}\n </Popover.Popup>\n );\n\n return (\n <Popover.Root\n openOnHover={trigger === \"hover\" ? true : openOnHover}\n open={open}\n onOpenChange={(open, eventDetails) => {\n if (\n (eventDetails.reason === \"outside-press\" ||\n eventDetails.reason === \"focus-out\") &&\n !closeOnClickOutside\n )\n return;\n setOpen(open, eventDetails);\n }}\n modal={modal}\n {...rest}\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 ref={setPositionerRef}\n className={clsx(\n cls(\"popup-panel-root\"),\n themeClassName,\n classNames?.root\n )}\n side={baseUIPlacement.side}\n align={baseUIPlacement.align}\n sideOffset={4}\n anchor={anchor}\n style={\n {\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties\n }\n render={({ children, onDragEnd, onDragStart, ...props }) => {\n return resizable ? (\n <Resizable\n resizable={resizable}\n resetKey={placementChangeKey}\n maintainAspectRatio={maintainAspectRatio}\n classNames={{\n resizeHandle: classNames?.resizeHandle,\n }}\n handles={anchorToResizeHandles(\n currentSideRef.current,\n currentAlignRef.current\n )}\n {...props}\n >\n {children}\n </Resizable>\n ) : (\n <div {...props}>{children}</div>\n );\n }}\n >\n {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","draggable","maintainAspectRatio","classNames","modal","closeOnClickOutside","onPlacementChange","rest","open","setOpen","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","defaultCloseIcon","useMemo","jsx","X","currentSideRef","useRef","currentAlignRef","placementChangeKey","setPlacementChangeKey","useState","positionerRef","setPositionerRef","useEffect","observer","mutations","hasPlacementChanged","mutation","newSide","newAlign","newPlacement","buildAntdPlacement","prev","renderTitle","useCallback","jsxs","clsx","Stack","Popover","IconButton","draggableRef","useDraggable","popup","eventDetails","PopupPanelSize","onDragEnd","onDragStart","props","Resizable","anchorToResizeHandles"],"mappings":";;;;;;;;;;;;;;;;;AA+HO,MAAMA,KAAa,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,WAAAC;AAA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sx"],"sourcesContent":["\"use client\";\nimport { Popover } from \"@base-ui-components/react/popover\";\nimport {\n BaseUIAlign,\n BaseUISide,\n buildAntdPlacement,\n clsx,\n parseAntdPlacement,\n useCls,\n} from \"../utils\";\n\nimport { mergeProps } from \"@base-ui-components/react\";\nimport { X } from \"@bioturing/assets\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useControlledState, useDraggable } from \"../hooks\";\nimport { IconButton } from \"../icon-button\";\nimport { Resizable } from \"../resizable\";\nimport { Stack } from \"../stack\";\nimport { PopupPanelSize } from \"./constants\";\n\n// Import component-specific styles\nimport { useRef } from \"react\";\nimport { useTheme } from \"../theme-provider\";\nimport \"./style.css\";\nimport { anchorToResizeHandles } from \"./utils\";\n\nexport interface PopupPanelProps\n extends Omit<\n React.ComponentPropsWithRef<\"div\">,\n \"title\" | \"content\" | \"children\"\n >,\n Omit<Popover.Root.Props, \"children\"> {\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?: Popover.Root.Props[\"onOpenChange\"];\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 * Whether the panel should be draggable\n * @default false\n */\n draggable?: boolean;\n /**\n * Whether to maintain aspect ratio when resizing\n * Only applies when resizable is true\n * @default false\n */\n maintainAspectRatio?: 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 * Whether to close the panel when clicking outside\n * @default true\n */\n closeOnClickOutside?: boolean;\n /**\n * Whether to use modal mode\n * @default false\n */\n modal?: Popover.Root.Props[\"modal\"];\n /**\n * Callback function when the placement changes\n */\n onPlacementChange?: (placement: PopoverProps[\"placement\"]) => void;\n /**\n * Props to pass to the positioner\n */\n positionerProps?: Popover.Positioner.Props;\n /**\n * Props to pass to the trigger\n */\n triggerProps?: Popover.Trigger.Props;\n /**\n * Props to pass to the portal\n */\n portalProps?: Popover.Portal.Props;\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 = false,\n resizable = false,\n draggable = false,\n maintainAspectRatio = false,\n classNames,\n modal = false,\n closeOnClickOutside = true,\n onPlacementChange,\n positionerProps = {},\n triggerProps = {},\n portalProps = {},\n ...rest\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 // Always provide a default value to prevent undefined\n );\n\n const cls = useCls();\n const { className: themeClassName } = useTheme();\n const baseUIPlacement = parseAntdPlacement(placement);\n\n const defaultCloseIcon = useMemo(() => <X size={16} />, []);\n\n // const positionerRef = useRef<HTMLDivElement>(null);\n\n const currentSideRef = useRef<BaseUISide>(baseUIPlacement.side);\n const currentAlignRef = useRef<BaseUIAlign>(baseUIPlacement.align);\n const [placementChangeKey, setPlacementChangeKey] = useState(0);\n const [positionerRef, setPositionerRef] = useState<HTMLDivElement | null>(\n null\n );\n\n useEffect(() => {\n if (!positionerRef || !open) return; // Only observe when popup is open\n\n // Create MutationObserver to watch for data-side changes\n const observer = new MutationObserver((mutations) => {\n let hasPlacementChanged = false;\n mutations.forEach((mutation) => {\n if (\n mutation.type === \"attributes\" &&\n mutation.attributeName === \"data-side\"\n ) {\n const newSide = positionerRef.getAttribute(mutation.attributeName);\n if (newSide && newSide !== currentSideRef.current) {\n currentSideRef.current = newSide as BaseUISide;\n hasPlacementChanged = true;\n }\n }\n if (\n mutation.type === \"attributes\" &&\n mutation.attributeName === \"data-align\"\n ) {\n const newAlign = positionerRef.getAttribute(mutation.attributeName);\n if (newAlign && newAlign !== currentAlignRef.current) {\n currentAlignRef.current = newAlign as BaseUIAlign;\n hasPlacementChanged = true;\n }\n }\n });\n\n // Only trigger callbacks if placement actually changed\n if (hasPlacementChanged) {\n const newPlacement = buildAntdPlacement({\n side: currentSideRef.current,\n align: currentAlignRef.current,\n });\n\n // Trigger resizable dimensions reset when placement changes\n setPlacementChangeKey((prev) => prev + 1);\n\n if (onPlacementChange) {\n onPlacementChange(newPlacement);\n }\n }\n });\n\n // Start observing\n observer.observe(positionerRef, {\n attributes: true,\n attributeFilter: [\"data-side\", \"data-align\"],\n attributeOldValue: true,\n });\n\n return () => {\n observer.disconnect();\n };\n }, [onPlacementChange, open, positionerRef]);\n\n const renderTitle = useCallback(() => {\n return (\n <div className={clsx(cls(\"popup-panel-header\"), classNames?.header)}>\n <Stack\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 </Stack>\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\n const { ref: draggableRef } = useDraggable(draggable);\n\n const popup = (\n <Popover.Popup\n className={clsx(\n cls(\"popup-panel\"),\n cls(`popup-panel-size-${size}`),\n className,\n classNames?.popup\n )}\n ref={draggableRef}\n >\n {title && renderTitle()}\n <div className={clsx(cls(\"popup-panel-content\"), classNames?.content)}>\n <div className={cls(\"popup-panel-content-inner\")}>{content}</div>\n </div>\n {footer && (\n <div className={clsx(cls(\"popup-panel-footer\"), classNames?.footer)}>\n {typeof footer === \"function\"\n ? footer({ close: () => setOpen(false) })\n : footer}\n </div>\n )}\n </Popover.Popup>\n );\n\n const defaultPositionerProps = {\n ref: setPositionerRef,\n className: clsx(cls(\"popup-panel-root\"), themeClassName, classNames?.root),\n side: baseUIPlacement.side,\n align: baseUIPlacement.align,\n sideOffset: 4,\n anchor,\n style: {\n \"--size-width\": size ? PopupPanelSize[size] : undefined,\n } as React.CSSProperties,\n render: ({ children, onDragEnd, onDragStart, ...props }) => {\n return resizable ? (\n <Resizable\n resizable={resizable}\n resetKey={placementChangeKey}\n maintainAspectRatio={maintainAspectRatio}\n classNames={{\n resizeHandle: classNames?.resizeHandle,\n }}\n handles={anchorToResizeHandles(\n currentSideRef.current,\n currentAlignRef.current\n )}\n {...props}\n >\n {children}\n </Resizable>\n ) : (\n <div {...props}>{children}</div>\n );\n },\n };\n\n return (\n <Popover.Root\n open={open}\n onOpenChange={(open, eventDetails) => {\n if (\n (eventDetails.reason === \"outside-press\" ||\n eventDetails.reason === \"focus-out\") &&\n !closeOnClickOutside\n )\n return;\n setOpen(open, eventDetails);\n }}\n modal={modal}\n {...rest}\n >\n <Popover.Trigger\n {...mergeProps(\n {\n render: children,\n className: clsx(cls(\"popup-panel-trigger\"), classNames?.trigger),\n openOnHover: trigger === \"hover\" ? true : openOnHover,\n },\n triggerProps\n )}\n ></Popover.Trigger>\n <Popover.Portal {...portalProps}>\n <Popover.Positioner\n {...mergeProps(defaultPositionerProps, positionerProps)}\n >\n {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","draggable","maintainAspectRatio","classNames","modal","closeOnClickOutside","onPlacementChange","positionerProps","triggerProps","portalProps","rest","open","setOpen","useControlledState","cls","useCls","themeClassName","useTheme","baseUIPlacement","parseAntdPlacement","defaultCloseIcon","useMemo","jsx","X","currentSideRef","useRef","currentAlignRef","placementChangeKey","setPlacementChangeKey","useState","positionerRef","setPositionerRef","useEffect","observer","mutations","hasPlacementChanged","mutation","newSide","newAlign","newPlacement","buildAntdPlacement","prev","renderTitle","useCallback","jsxs","clsx","Stack","Popover","IconButton","draggableRef","useDraggable","popup","defaultPositionerProps","PopupPanelSize","onDragEnd","onDragStart","props","Resizable","anchorToResizeHandles","eventDetails","mergeProps"],"mappings":";;;;;;;;;;;;;;;;;;AA4IO,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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 +1,11 @@
1
- import { Toast as BaseToast } from '@base-ui-components/react';
1
+ import { ToastManagerAddOptions } from '@base-ui-components/react';
2
2
  import { ToastData } from './types';
3
- export declare const toastManager: BaseToast.createToastManager.ToastManager;
4
- export declare const toast: ((message: string, options?: Omit<BaseToast.useToastManager.AddOptions<ToastData>, "data" | "description">) => string) & {
5
- info: (message: string, options?: Omit<BaseToast.useToastManager.AddOptions<ToastData>, "data" | "description">) => string;
6
- success: (message: string, options?: Omit<BaseToast.useToastManager.AddOptions<ToastData>, "data" | "description">) => string;
7
- error: (message: string, options?: Omit<BaseToast.useToastManager.AddOptions<ToastData>, "data" | "description">) => string;
8
- warning: (message: string, options?: Omit<BaseToast.useToastManager.AddOptions<ToastData>, "data" | "description">) => string;
9
- progress: (message: string, options?: Omit<BaseToast.useToastManager.AddOptions<ToastData>, "data" | "description">) => string;
3
+ export declare const toastManager: import('@base-ui-components/react').ToastManager;
4
+ export declare const toast: ((message: string, options?: Omit<ToastManagerAddOptions<ToastData>, "data" | "description">) => string) & {
5
+ info: (message: string, options?: Omit<ToastManagerAddOptions<ToastData>, "data" | "description">) => string;
6
+ success: (message: string, options?: Omit<ToastManagerAddOptions<ToastData>, "data" | "description">) => string;
7
+ error: (message: string, options?: Omit<ToastManagerAddOptions<ToastData>, "data" | "description">) => string;
8
+ warning: (message: string, options?: Omit<ToastManagerAddOptions<ToastData>, "data" | "description">) => string;
9
+ progress: (message: string, options?: Omit<ToastManagerAddOptions<ToastData>, "data" | "description">) => string;
10
10
  };
11
11
  //# sourceMappingURL=function.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/components/toast/function.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,YAAY,2CAAiC,CAAC;AAuB3D,eAAO,MAAM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AC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;uBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;wBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAqB3E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"function.js","sources":["../../../src/components/toast/function.ts"],"sourcesContent":["\"use client\";\nimport { Toast as BaseToast } from \"@base-ui-components/react\";\nimport type { ToastData } from \"./types\";\n\nexport const toastManager = BaseToast.createToastManager();\n\nfunction createToastTypeFunction(type: ToastData[\"type\"]) {\n return (\n message: string,\n options?: Omit<\n BaseToast.useToastManager.AddOptions<ToastData>,\n \"data\" | \"description\"\n >\n ) => {\n const toastId = toastManager.add<ToastData>({\n description: message,\n data: {\n type: type,\n },\n // progress and error toasts should not auto close\n ...(type === \"progress\" ? { timeout: 0 } : {}),\n ...options,\n });\n return toastId;\n };\n}\n\nexport const toast = Object.assign(createToastTypeFunction(\"info\"), {\n info: createToastTypeFunction(\"info\"),\n success: createToastTypeFunction(\"success\"),\n error: createToastTypeFunction(\"error\"),\n warning: createToastTypeFunction(\"warning\"),\n progress: createToastTypeFunction(\"progress\"),\n});\n"],"names":["toastManager","BaseToast","createToastTypeFunction","type","message","options","toast"],"mappings":";;AAIO,MAAMA,IAAeC,EAAU,mBAAA;AAEtC,SAASC,EAAwBC,GAAyB;AACxD,SAAO,CACLC,GACAC,MAKgBL,EAAa,IAAe;AAAA,IAC1C,aAAaI;AAAA,IACb,MAAM;AAAA,MACJ,MAAAD;AAAA,IAAA;AAAA;AAAA,IAGF,GAAIA,MAAS,aAAa,EAAE,SAAS,EAAA,IAAM,CAAA;AAAA,IAC3C,GAAGE;AAAA,EAAA,CACJ;AAGL;AAEO,MAAMC,IAAQ,OAAO,OAAOJ,EAAwB,MAAM,GAAG;AAAA,EAClE,MAAMA,EAAwB,MAAM;AAAA,EACpC,SAASA,EAAwB,SAAS;AAAA,EAC1C,OAAOA,EAAwB,OAAO;AAAA,EACtC,SAASA,EAAwB,SAAS;AAAA,EAC1C,UAAUA,EAAwB,UAAU;AAC9C,CAAC;"}
1
+ {"version":3,"file":"function.js","sources":["../../../src/components/toast/function.ts"],"sourcesContent":["\"use client\";\nimport {\n Toast as BaseToast,\n ToastManagerAddOptions,\n} from \"@base-ui-components/react\";\nimport type { ToastData } from \"./types\";\n\nexport const toastManager = BaseToast.createToastManager();\n\nfunction createToastTypeFunction(type: ToastData[\"type\"]) {\n return (\n message: string,\n options?: Omit<ToastManagerAddOptions<ToastData>, \"data\" | \"description\">\n ) => {\n const toastId = toastManager.add<ToastData>({\n description: message,\n data: {\n type: type,\n },\n // progress and error toasts should not auto close\n ...(type === \"progress\" ? { timeout: 0 } : {}),\n ...options,\n });\n return toastId;\n };\n}\n\nexport const toast = Object.assign(createToastTypeFunction(\"info\"), {\n info: createToastTypeFunction(\"info\"),\n success: createToastTypeFunction(\"success\"),\n error: createToastTypeFunction(\"error\"),\n warning: createToastTypeFunction(\"warning\"),\n progress: createToastTypeFunction(\"progress\"),\n});\n"],"names":["toastManager","BaseToast","createToastTypeFunction","type","message","options","toast"],"mappings":";;AAOO,MAAMA,IAAeC,EAAU,mBAAA;AAEtC,SAASC,EAAwBC,GAAyB;AACxD,SAAO,CACLC,GACAC,MAEgBL,EAAa,IAAe;AAAA,IAC1C,aAAaI;AAAA,IACb,MAAM;AAAA,MACJ,MAAAD;AAAA,IAAA;AAAA;AAAA,IAGF,GAAIA,MAAS,aAAa,EAAE,SAAS,EAAA,IAAM,CAAA;AAAA,IAC3C,GAAGE;AAAA,EAAA,CACJ;AAGL;AAEO,MAAMC,IAAQ,OAAO,OAAOJ,EAAwB,MAAM,GAAG;AAAA,EAClE,MAAMA,EAAwB,MAAM;AAAA,EACpC,SAASA,EAAwB,SAAS;AAAA,EAC1C,OAAOA,EAAwB,OAAO;AAAA,EACtC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CAAC,CAAC,CAAC;KACjE,KACE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;;CAM3C,CAAC"}
@@ -1,69 +1,79 @@
1
1
  "use client";
2
2
  import { jsx as T } from "react/jsx-runtime";
3
- import p from "antd/es/tree";
4
- import { forwardRef as l } from "react";
5
- import { useTreeCommon as u } from "./useTreeCommon.js";
3
+ import m from "antd/es/tree";
4
+ import { forwardRef as u } from "react";
5
+ import { useTreeCommon as k } from "./useTreeCommon.js";
6
6
  import './style.css';/* empty css */
7
- import { clsx as k } from "../utils/cn.js";
8
- const y = (e, r) => {
7
+ import { clsx as y } from "../utils/cn.js";
8
+ const x = (r, n) => {
9
9
  const {
10
- cls: c,
11
- customSwitcherIcon: n,
10
+ cls: e,
11
+ customSwitcherIcon: c,
12
12
  processedTreeData: t,
13
- currentUniqueExpandedKeys: s,
14
- currentUniqueCheckedKeys: o,
13
+ currentUniqueExpandedKeys: o,
14
+ currentUniqueCheckedKeys: s,
15
15
  handleAntTreeExpand: a,
16
16
  handleAntTreeCheck: d,
17
- restProps: h,
18
- className: i,
19
- switcherIcon: m
20
- } = u(e);
17
+ restProps: i,
18
+ className: h,
19
+ switcherIcon: p,
20
+ nodeVerticalAlign: l
21
+ } = k(r);
21
22
  return /* @__PURE__ */ T(
22
- p,
23
+ m,
23
24
  {
24
- ref: r,
25
- className: k(c("tree"), i),
26
- switcherIcon: m || n,
25
+ ref: n,
26
+ className: y(
27
+ e("tree"),
28
+ l === "top" && e("tree-align-top"),
29
+ h
30
+ ),
31
+ switcherIcon: p || c,
27
32
  treeData: t,
28
- expandedKeys: s,
33
+ expandedKeys: o,
29
34
  onExpand: a,
30
- checkedKeys: { checked: o, halfChecked: [] },
35
+ checkedKeys: { checked: s, halfChecked: [] },
31
36
  onCheck: d,
32
- ...h
37
+ ...i
33
38
  }
34
39
  );
35
- }, x = (e, r) => {
40
+ }, f = (r, n) => {
36
41
  const {
37
- cls: c,
38
- customSwitcherIcon: n,
42
+ cls: e,
43
+ customSwitcherIcon: c,
39
44
  processedTreeData: t,
40
- currentUniqueExpandedKeys: s,
41
- currentUniqueCheckedKeys: o,
45
+ currentUniqueExpandedKeys: o,
46
+ currentUniqueCheckedKeys: s,
42
47
  handleAntTreeExpand: a,
43
48
  handleAntTreeCheck: d,
44
- restProps: h,
45
- className: i,
46
- switcherIcon: m
47
- } = u(e);
49
+ restProps: i,
50
+ className: h,
51
+ switcherIcon: p,
52
+ nodeVerticalAlign: l
53
+ } = k(r);
48
54
  return /* @__PURE__ */ T(
49
- p.DirectoryTree,
55
+ m.DirectoryTree,
50
56
  {
51
- ref: r,
52
- className: k(c("directory-tree"), i),
53
- switcherIcon: m || n,
57
+ ref: n,
58
+ className: y(
59
+ e("directory-tree"),
60
+ l === "top" && e("tree-align-top"),
61
+ h
62
+ ),
63
+ switcherIcon: p || c,
54
64
  treeData: t,
55
- expandedKeys: s,
65
+ expandedKeys: o,
56
66
  onExpand: a,
57
- checkedKeys: { checked: o, halfChecked: [] },
67
+ checkedKeys: { checked: s, halfChecked: [] },
58
68
  onCheck: d,
59
- ...h
69
+ ...i
60
70
  }
61
71
  );
62
- }, f = l(y), C = l(x), A = Object.assign(f, {
63
- DirectoryTree: C,
64
- TreeNode: p.TreeNode
72
+ }, C = u(x), I = u(f), g = Object.assign(C, {
73
+ DirectoryTree: I,
74
+ TreeNode: m.TreeNode
65
75
  });
66
76
  export {
67
- A as Tree
77
+ g as Tree
68
78
  };
69
79
  //# 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\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;AACH,QAAM;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;AAEvB,SACE,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,EAAC;AAAA,MAChE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV,GAGMO,IAAqB,CACzBhB,GACAC,MACG;AACH,QAAM;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;AAE9B,SACE,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,EAAC;AAAA,MAChE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV,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 nodeVerticalAlign,\n } = useTreeCommon(props);\n\n return (\n <AntTree\n ref={ref}\n className={clsx(\n cls(\"tree\"),\n nodeVerticalAlign === \"top\" && cls(\"tree-align-top\"),\n className\n )}\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 nodeVerticalAlign,\n } = useTreeCommon(props as any);\n\n return (\n <AntTree.DirectoryTree\n ref={ref}\n className={clsx(\n cls(\"directory-tree\"),\n nodeVerticalAlign === \"top\" && cls(\"tree-align-top\"),\n className\n )}\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","nodeVerticalAlign","useTreeCommon","jsx","AntTree","clsx","DirectoryTreeInner","MainTree","forwardRef","DirectoryTree","Tree"],"mappings":";;;;;;;AAeA,MAAMA,IAAgB,CACpBC,GACAC,MACG;AACH,QAAM;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,IACA,mBAAAC;AAAA,EAAA,IACEC,EAAcb,CAAK;AAEvB,SACE,gBAAAc;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAd;AAAA,MACA,WAAWe;AAAA,QACTd,EAAI,MAAM;AAAA,QACVU,MAAsB,SAASV,EAAI,gBAAgB;AAAA,QACnDQ;AAAA,MAAA;AAAA,MAEF,cAAcC,KAAgBR;AAAA,MAE9B,UAAUC;AAAA,MACV,cAAcC;AAAA,MACd,UAAUE;AAAA,MAEV,aAAa,EAAE,SAASD,GAA0B,aAAa,CAAA,EAAC;AAAA,MAChE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV,GAGMQ,IAAqB,CACzBjB,GACAC,MACG;AACH,QAAM;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,IACA,mBAAAC;AAAA,EAAA,IACEC,EAAcb,CAAY;AAE9B,SACE,gBAAAc;AAAA,IAACC,EAAQ;AAAA,IAAR;AAAA,MACC,KAAAd;AAAA,MACA,WAAWe;AAAA,QACTd,EAAI,gBAAgB;AAAA,QACpBU,MAAsB,SAASV,EAAI,gBAAgB;AAAA,QACnDQ;AAAA,MAAA;AAAA,MAEF,cAAcC,KAAgBR;AAAA,MAE9B,UAAUC;AAAA,MACV,cAAcC;AAAA,MACd,UAAUE;AAAA,MAEV,aAAa,EAAE,SAASD,GAA0B,aAAa,CAAA,EAAC;AAAA,MAChE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV,GAIMS,IAAWC,EAAWpB,CAAa,GASnCqB,IAAgBD,EAAWF,CAAkB,GAStCI,IAAO,OAAO,OAAOH,GAAU;AAAA,EAC1C,eAAAE;AAAA,EACA,UAAUL,EAAQ;AACpB,CAAC;"}
@@ -1 +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))}}
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-align-top .ds-tree-checkbox{align-self:flex-start;margin-top:.25rem}.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:not(.ds-tree-treenode-disabled).ds-tree-treenode-selected .ds-tree-node-content-wrapper:hover{color:var(--ds-tree-node-selected-color)}.ds-directory-tree .ds-tree-treenode-selected .ds-tree-icon__customize{color:var(--ds-tree-directory-node-selected-color)}.ds-directory-tree .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))}}
@@ -35,6 +35,8 @@ export interface TreeProps<T extends AntTreeDataNode = TreeDataNode> extends Omi
35
35
  allowDuplicatedKeys?: boolean;
36
36
  /** Draggable configuration for tree items */
37
37
  draggable?: AntTreeProps<T>["draggable"];
38
+ /** Vertical alignment of tree nodes (default: 'center') */
39
+ nodeVerticalAlign?: "center" | "top";
38
40
  }
39
41
  export interface DirectoryTreeProps<T extends AntTreeDataNode = TreeDataNode> extends Omit<AntDirectoryTreeProps<T>, "treeData" | "expandedKeys" | "defaultExpandedKeys" | "onExpand" | "checkedKeys" | "defaultCheckedKeys" | "onCheck" | "draggable"> {
40
42
  treeData?: T[];
@@ -52,5 +54,7 @@ export interface DirectoryTreeProps<T extends AntTreeDataNode = TreeDataNode> ex
52
54
  allowDuplicatedKeys?: boolean;
53
55
  /** Draggable configuration for directory tree items */
54
56
  draggable?: AntDirectoryTreeProps<T>["draggable"];
57
+ /** Vertical alignment of tree nodes (default: 'center') */
58
+ nodeVerticalAlign?: "center" | "top";
55
59
  }
56
60
  //# sourceMappingURL=types.d.ts.map