eai-frontend-components 2.0.83 → 2.0.84

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.
package/dist/index.js CHANGED
@@ -10184,19 +10184,26 @@ function NodeCard({ node, onNodeClick, isExpanded, hasChildren, onToggle }) {
10184
10184
  onToggle();
10185
10185
  }, children: isExpanded ? jsxRuntime.jsx(lucideReact.ChevronUp, { className: 'h-3 w-3' }) : jsxRuntime.jsx(lucideReact.ChevronDown, { className: 'h-3 w-3' }) }) }))] }) }));
10186
10186
  }
10187
- function OrgChartTreeNode({ node, onNodeClick, defaultExpanded }) {
10187
+ function OrgChartTreeNode({ node, onNodeClick, defaultExpanded, renderNode }) {
10188
10188
  const [isExpanded, setIsExpanded] = React$1.useState(defaultExpanded);
10189
10189
  const children = node.children ?? [];
10190
10190
  const hasChildren = children.length > 0;
10191
- return (jsxRuntime.jsxs("div", { className: 'flex flex-col items-center', children: [jsxRuntime.jsx(NodeCard, { node: node, onNodeClick: onNodeClick, isExpanded: isExpanded, hasChildren: hasChildren, onToggle: () => setIsExpanded((prev) => !prev) }), hasChildren && isExpanded && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'h-4 w-px bg-border' }), jsxRuntime.jsx("div", { className: 'flex items-start', children: children.map((child, i) => {
10191
+ const cardProps = {
10192
+ node,
10193
+ onNodeClick,
10194
+ isExpanded,
10195
+ hasChildren,
10196
+ onToggle: () => setIsExpanded((prev) => !prev),
10197
+ };
10198
+ return (jsxRuntime.jsxs("div", { className: 'flex flex-col items-center', children: [renderNode ? renderNode(cardProps) : jsxRuntime.jsx(NodeCard, { ...cardProps }), hasChildren && isExpanded && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'h-4 w-px bg-border' }), jsxRuntime.jsx("div", { className: 'flex items-start', children: children.map((child, i) => {
10192
10199
  const isOnly = children.length === 1;
10193
10200
  const isFirst = i === 0;
10194
10201
  const isLast = i === children.length - 1;
10195
- return (jsxRuntime.jsxs("div", { className: cn('relative flex flex-col items-center px-4', !isOnly && "after:absolute after:top-0 after:h-px after:bg-border after:content-['']", !isOnly && isFirst && 'after:-right-4 after:left-1/2', !isOnly && isLast && 'after:-left-4 after:right-1/2', !isOnly && !isFirst && !isLast && 'after:-left-4 after:-right-4'), children: [jsxRuntime.jsx("div", { className: 'h-4 w-px bg-border' }), jsxRuntime.jsx(OrgChartTreeNode, { node: child, onNodeClick: onNodeClick, defaultExpanded: defaultExpanded })] }, child.id));
10202
+ return (jsxRuntime.jsxs("div", { className: cn('relative flex flex-col items-center px-4', !isOnly && "after:absolute after:top-0 after:h-px after:bg-border after:content-['']", !isOnly && isFirst && 'after:-right-4 after:left-1/2', !isOnly && isLast && 'after:-left-4 after:right-1/2', !isOnly && !isFirst && !isLast && 'after:-left-4 after:-right-4'), children: [jsxRuntime.jsx("div", { className: 'h-4 w-px bg-border' }), jsxRuntime.jsx(OrgChartTreeNode, { node: child, onNodeClick: onNodeClick, defaultExpanded: defaultExpanded, renderNode: renderNode })] }, child.id));
10196
10203
  }) })] }))] }));
10197
10204
  }
10198
- function OrgChart({ data, onNodeClick, defaultExpanded = true, className }) {
10199
- return (jsxRuntime.jsx("div", { className: cn('w-full overflow-x-auto', className), children: jsxRuntime.jsx("div", { className: 'flex justify-center px-4 py-6', children: jsxRuntime.jsx(OrgChartTreeNode, { node: data, onNodeClick: onNodeClick, defaultExpanded: defaultExpanded }) }) }));
10205
+ function OrgChart({ data, onNodeClick, defaultExpanded = true, className, renderNode }) {
10206
+ return (jsxRuntime.jsx("div", { className: cn('w-full overflow-x-auto', className), children: jsxRuntime.jsx("div", { className: 'flex justify-center px-4 py-6', children: jsxRuntime.jsx(OrgChartTreeNode, { node: data, onNodeClick: onNodeClick, defaultExpanded: defaultExpanded, renderNode: renderNode }) }) }));
10200
10207
  }
10201
10208
 
10202
10209
  function useMediaQuery(queryInput) {