@sqlrooms/schema-tree 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"TableTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAOzB,eAAO,MAAM,+BAA+B,GAC1C,YAAY,eAAe,4CAqC5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,eAAe,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,KAAK,CAAC,SAAS,CAAC;CACpE,CAeA,CAAC"}
1
+ {"version":3,"file":"TableTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAOzB,eAAO,MAAM,+BAA+B,GAC1C,YAAY,eAAe,4CAmC5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,eAAe,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,KAAK,CAAC,SAAS,CAAC;CACpE,CAeA,CAAC"}
@@ -4,13 +4,11 @@ import { BaseTreeNode } from './BaseTreeNode';
4
4
  import { TreeNodeActionsMenu, TreeNodeActionsMenuItem, } from './TreeNodeActionsMenu';
5
5
  export const defaultRenderTableNodeMenuItems = (nodeObject) => {
6
6
  const { database, schema, name } = nodeObject;
7
- return (_jsxs(_Fragment, { children: [_jsxs(TreeNodeActionsMenuItem, { onClick: (evt) => {
8
- evt.stopPropagation();
7
+ return (_jsxs(_Fragment, { children: [_jsxs(TreeNodeActionsMenuItem, { onClick: () => {
9
8
  navigator.clipboard.writeText(nodeObject.schema == 'main'
10
9
  ? nodeObject.name
11
10
  : `${nodeObject.schema}.${nodeObject.name}`);
12
- }, children: [_jsx(CopyIcon, { width: "15px" }), "Copy table name"] }), _jsxs(TreeNodeActionsMenuItem, { onClick: (evt) => {
13
- evt.stopPropagation();
11
+ }, children: [_jsx(CopyIcon, { width: "15px" }), "Copy table name"] }), _jsxs(TreeNodeActionsMenuItem, { onClick: () => {
14
12
  navigator.clipboard.writeText([
15
13
  `SELECT * FROM `,
16
14
  database === 'memory' ? '' : `${database}.`,
@@ -1 +1 @@
1
- {"version":3,"file":"TableTreeNode.js","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAErE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,UAA2B,EAC3B,EAAE;IACF,MAAM,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,UAAU,CAAC;IAC5C,OAAO,CACL,8BACE,MAAC,uBAAuB,IACtB,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;oBACf,GAAG,CAAC,eAAe,EAAE,CAAC;oBACtB,SAAS,CAAC,SAAS,CAAC,SAAS,CAC3B,UAAU,CAAC,MAAM,IAAI,MAAM;wBACzB,CAAC,CAAC,UAAU,CAAC,IAAI;wBACjB,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,CAC9C,CAAC;gBACJ,CAAC,aAED,KAAC,QAAQ,IAAC,KAAK,EAAC,MAAM,GAAG,uBAED,EAE1B,MAAC,uBAAuB,IACtB,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;oBACf,GAAG,CAAC,eAAe,EAAE,CAAC;oBACtB,SAAS,CAAC,SAAS,CAAC,SAAS,CAC3B;wBACE,gBAAgB;wBAChB,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG;wBAC3C,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG;wBACrC,IAAI;qBACL,CAAC,IAAI,CAAC,EAAE,CAAC,CACX,CAAC;gBACJ,CAAC,aAED,KAAC,kBAAkB,IAAC,KAAK,EAAC,MAAM,GAAG,yBAEX,IACzB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAIrB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EACJ,SAAS,EACT,UAAU,EACV,eAAe,GAAG,+BAA+B,GAClD,GAAG,KAAK,CAAC;IACV,OAAO,CACL,MAAC,YAAY,IAAC,OAAO,QAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,aAChE,eAAK,SAAS,EAAC,oCAAoC,aACjD,KAAC,SAAS,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,wBAAwB,GAAG,EAC5D,eAAM,SAAS,EAAC,SAAS,YAAE,UAAU,CAAC,IAAI,GAAQ,IAC9C,EACN,KAAC,mBAAmB,cAAE,eAAe,CAAC,UAAU,CAAC,GAAuB,IAC3D,CAChB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.\n\nimport {TableNodeObject} from '@sqlrooms/duckdb';\nimport {CopyIcon, SquareTerminalIcon, TableIcon} from 'lucide-react';\nimport {FC} from 'react';\nimport {BaseTreeNode} from './BaseTreeNode';\nimport {\n TreeNodeActionsMenu,\n TreeNodeActionsMenuItem,\n} from './TreeNodeActionsMenu';\n\nexport const defaultRenderTableNodeMenuItems = (\n nodeObject: TableNodeObject,\n) => {\n const {database, schema, name} = nodeObject;\n return (\n <>\n <TreeNodeActionsMenuItem\n onClick={(evt) => {\n evt.stopPropagation();\n navigator.clipboard.writeText(\n nodeObject.schema == 'main'\n ? nodeObject.name\n : `${nodeObject.schema}.${nodeObject.name}`,\n );\n }}\n >\n <CopyIcon width=\"15px\" />\n Copy table name\n </TreeNodeActionsMenuItem>\n\n <TreeNodeActionsMenuItem\n onClick={(evt) => {\n evt.stopPropagation();\n navigator.clipboard.writeText(\n [\n `SELECT * FROM `,\n database === 'memory' ? '' : `${database}.`,\n schema === 'main' ? '' : `${schema}.`,\n name,\n ].join(''),\n );\n }}\n >\n <SquareTerminalIcon width=\"15px\" />\n Copy SELECT query\n </TreeNodeActionsMenuItem>\n </>\n );\n};\n\nexport const TableTreeNode: FC<{\n className?: string;\n nodeObject: TableNodeObject;\n renderMenuItems?: (nodeObject: TableNodeObject) => React.ReactNode;\n}> = (props) => {\n const {\n className,\n nodeObject,\n renderMenuItems = defaultRenderTableNodeMenuItems,\n } = props;\n return (\n <BaseTreeNode asChild className={className} nodeObject={nodeObject}>\n <div className=\"flex w-full items-center space-x-2\">\n <TableIcon size=\"16px\" className=\"shrink-0 text-blue-500\" />\n <span className=\"text-sm\">{nodeObject.name}</span>\n </div>\n <TreeNodeActionsMenu>{renderMenuItems(nodeObject)}</TreeNodeActionsMenu>\n </BaseTreeNode>\n );\n};\n"]}
1
+ {"version":3,"file":"TableTreeNode.js","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAErE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,UAA2B,EAC3B,EAAE;IACF,MAAM,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,UAAU,CAAC;IAC5C,OAAO,CACL,8BACE,MAAC,uBAAuB,IACtB,OAAO,EAAE,GAAG,EAAE;oBACZ,SAAS,CAAC,SAAS,CAAC,SAAS,CAC3B,UAAU,CAAC,MAAM,IAAI,MAAM;wBACzB,CAAC,CAAC,UAAU,CAAC,IAAI;wBACjB,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,CAC9C,CAAC;gBACJ,CAAC,aAED,KAAC,QAAQ,IAAC,KAAK,EAAC,MAAM,GAAG,uBAED,EAE1B,MAAC,uBAAuB,IACtB,OAAO,EAAE,GAAG,EAAE;oBACZ,SAAS,CAAC,SAAS,CAAC,SAAS,CAC3B;wBACE,gBAAgB;wBAChB,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG;wBAC3C,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG;wBACrC,IAAI;qBACL,CAAC,IAAI,CAAC,EAAE,CAAC,CACX,CAAC;gBACJ,CAAC,aAED,KAAC,kBAAkB,IAAC,KAAK,EAAC,MAAM,GAAG,yBAEX,IACzB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAIrB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EACJ,SAAS,EACT,UAAU,EACV,eAAe,GAAG,+BAA+B,GAClD,GAAG,KAAK,CAAC;IACV,OAAO,CACL,MAAC,YAAY,IAAC,OAAO,QAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,aAChE,eAAK,SAAS,EAAC,oCAAoC,aACjD,KAAC,SAAS,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,wBAAwB,GAAG,EAC5D,eAAM,SAAS,EAAC,SAAS,YAAE,UAAU,CAAC,IAAI,GAAQ,IAC9C,EACN,KAAC,mBAAmB,cAAE,eAAe,CAAC,UAAU,CAAC,GAAuB,IAC3D,CAChB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.\n\nimport {TableNodeObject} from '@sqlrooms/duckdb';\nimport {CopyIcon, SquareTerminalIcon, TableIcon} from 'lucide-react';\nimport {FC} from 'react';\nimport {BaseTreeNode} from './BaseTreeNode';\nimport {\n TreeNodeActionsMenu,\n TreeNodeActionsMenuItem,\n} from './TreeNodeActionsMenu';\n\nexport const defaultRenderTableNodeMenuItems = (\n nodeObject: TableNodeObject,\n) => {\n const {database, schema, name} = nodeObject;\n return (\n <>\n <TreeNodeActionsMenuItem\n onClick={() => {\n navigator.clipboard.writeText(\n nodeObject.schema == 'main'\n ? nodeObject.name\n : `${nodeObject.schema}.${nodeObject.name}`,\n );\n }}\n >\n <CopyIcon width=\"15px\" />\n Copy table name\n </TreeNodeActionsMenuItem>\n\n <TreeNodeActionsMenuItem\n onClick={() => {\n navigator.clipboard.writeText(\n [\n `SELECT * FROM `,\n database === 'memory' ? '' : `${database}.`,\n schema === 'main' ? '' : `${schema}.`,\n name,\n ].join(''),\n );\n }}\n >\n <SquareTerminalIcon width=\"15px\" />\n Copy SELECT query\n </TreeNodeActionsMenuItem>\n </>\n );\n};\n\nexport const TableTreeNode: FC<{\n className?: string;\n nodeObject: TableNodeObject;\n renderMenuItems?: (nodeObject: TableNodeObject) => React.ReactNode;\n}> = (props) => {\n const {\n className,\n nodeObject,\n renderMenuItems = defaultRenderTableNodeMenuItems,\n } = props;\n return (\n <BaseTreeNode asChild className={className} nodeObject={nodeObject}>\n <div className=\"flex w-full items-center space-x-2\">\n <TableIcon size=\"16px\" className=\"shrink-0 text-blue-500\" />\n <span className=\"text-sm\">{nodeObject.name}</span>\n </div>\n <TreeNodeActionsMenu>{renderMenuItems(nodeObject)}</TreeNodeActionsMenu>\n </BaseTreeNode>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeActionsMenu.d.ts","sourceRoot":"","sources":["../../src/nodes/TreeNodeActionsMenu.tsx"],"names":[],"mappings":"AASA,OAAO,EAGL,EAAE,EAEF,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAgB5D,CAAC;AAEF,eAAO,MAAM,uBAAuB;;0GASlC,CAAC"}
1
+ {"version":3,"file":"TreeNodeActionsMenu.d.ts","sourceRoot":"","sources":["../../src/nodes/TreeNodeActionsMenu.tsx"],"names":[],"mappings":"AASA,OAAO,EAGL,EAAE,EAEF,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAgB5D,CAAC;AAEF,eAAO,MAAM,uBAAuB;;0GAoBlC,CAAC"}
@@ -17,6 +17,14 @@ export const TreeNodeActionsMenu = (props) => {
17
17
  const { children } = props;
18
18
  return (_jsx("div", { className: "absolute right-0 top-[1px] opacity-0 outline-none group-hover:opacity-100", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("div", { className: "hover:bg-foreground/10 flex h-5 w-7 items-center justify-center p-0 outline-none transition-colors", children: _jsx(EllipsisVerticalIcon, { size: "16px" }) }) }), _jsx(DropdownMenuContent, { align: "start", side: "bottom", children: children })] }) }));
19
19
  };
20
- export const TreeNodeActionsMenuItem = forwardRef(({ className, ...props }, ref) => (_jsx(DropdownMenuItem, { ref: ref, className: cn('gap-2 text-xs', className), ...props })));
20
+ export const TreeNodeActionsMenuItem = forwardRef(({ className, ...props }, ref) => {
21
+ const { onClick } = props;
22
+ return (_jsx(DropdownMenuItem, { ref: ref, className: cn('gap-2 text-xs', className), ...props, onClick: onClick
23
+ ? (evt) => {
24
+ evt.stopPropagation(); // prevent the tree node from closing
25
+ onClick(evt);
26
+ }
27
+ : undefined }));
28
+ });
21
29
  TreeNodeActionsMenuItem.displayName = 'TreeNodeActionsMenuItem';
22
30
  //# sourceMappingURL=TreeNodeActionsMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeActionsMenu.js","sourceRoot":"","sources":["../../src/nodes/TreeNodeActionsMenu.tsx"],"names":[],"mappings":";AAAA,4DAA4D;AAE5D,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,EAAE,GACH,MAAM,cAAc,CAAC;AACtB,OAAO,EAIL,UAAU,GAEX,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAMlD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAiC,CAAC,KAAK,EAAE,EAAE;IACzE,MAAM,EAAC,QAAQ,EAAC,GAAG,KAAK,CAAC;IACzB,OAAO,CACL,cAAK,SAAS,EAAC,2EAA2E,YACxF,MAAC,YAAY,eACX,KAAC,mBAAmB,IAAC,OAAO,kBAC1B,cAAK,SAAS,EAAC,oGAAoG,YACjH,KAAC,oBAAoB,IAAC,IAAI,EAAC,MAAM,GAAG,GAChC,GACc,EACtB,KAAC,mBAAmB,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,YAC7C,QAAQ,GACW,IACT,GACX,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAG/C,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,KAAC,gBAAgB,IACf,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,KACrC,KAAK,GACT,CACH,CAAC,CAAC;AACH,uBAAuB,CAAC,WAAW,GAAG,yBAAyB,CAAC","sourcesContent":["// Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.\n\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n cn,\n} from '@sqlrooms/ui';\nimport {\n ComponentPropsWithoutRef,\n ElementRef,\n FC,\n forwardRef,\n PropsWithChildren,\n} from 'react';\nimport {EllipsisVerticalIcon} from 'lucide-react';\n\nexport type TreeNodeActionsMenuProps = PropsWithChildren<{\n className?: string;\n}>;\n\n/**\n * Component that renders a tree node \"more actions\" menu.\n * The menu items are passed as children.\n *\n * The menu is hidden by default and is shown when the user hovers over the node.\n * For this to work the parent element must have the `group` class.\n * It should also have classes `relative overflow-hidden`.\n *\n * @param children - The menu items.\n */\nexport const TreeNodeActionsMenu: FC<TreeNodeActionsMenuProps> = (props) => {\n const {children} = props;\n return (\n <div className=\"absolute right-0 top-[1px] opacity-0 outline-none group-hover:opacity-100\">\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <div className=\"hover:bg-foreground/10 flex h-5 w-7 items-center justify-center p-0 outline-none transition-colors\">\n <EllipsisVerticalIcon size=\"16px\" />\n </div>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" side=\"bottom\">\n {children}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n};\n\nexport const TreeNodeActionsMenuItem = forwardRef<\n ElementRef<typeof DropdownMenuItem>,\n ComponentPropsWithoutRef<typeof DropdownMenuItem>\n>(({className, ...props}, ref) => (\n <DropdownMenuItem\n ref={ref}\n className={cn('gap-2 text-xs', className)}\n {...props}\n />\n));\nTreeNodeActionsMenuItem.displayName = 'TreeNodeActionsMenuItem';\n"]}
1
+ {"version":3,"file":"TreeNodeActionsMenu.js","sourceRoot":"","sources":["../../src/nodes/TreeNodeActionsMenu.tsx"],"names":[],"mappings":";AAAA,4DAA4D;AAE5D,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,EAAE,GACH,MAAM,cAAc,CAAC;AACtB,OAAO,EAIL,UAAU,GAEX,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAMlD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAiC,CAAC,KAAK,EAAE,EAAE;IACzE,MAAM,EAAC,QAAQ,EAAC,GAAG,KAAK,CAAC;IACzB,OAAO,CACL,cAAK,SAAS,EAAC,2EAA2E,YACxF,MAAC,YAAY,eACX,KAAC,mBAAmB,IAAC,OAAO,kBAC1B,cAAK,SAAS,EAAC,oGAAoG,YACjH,KAAC,oBAAoB,IAAC,IAAI,EAAC,MAAM,GAAG,GAChC,GACc,EACtB,KAAC,mBAAmB,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,YAC7C,QAAQ,GACW,IACT,GACX,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAG/C,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,GAAG,EAAE,EAAE;IAC/B,MAAM,EAAC,OAAO,EAAC,GAAG,KAAK,CAAC;IACxB,OAAO,CACL,KAAC,gBAAgB,IACf,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,KACrC,KAAK,EACT,OAAO,EACL,OAAO;YACL,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE;gBACN,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,qCAAqC;gBAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;YACH,CAAC,CAAC,SAAS,GAEf,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,uBAAuB,CAAC,WAAW,GAAG,yBAAyB,CAAC","sourcesContent":["// Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.\n\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n cn,\n} from '@sqlrooms/ui';\nimport {\n ComponentPropsWithoutRef,\n ElementRef,\n FC,\n forwardRef,\n PropsWithChildren,\n} from 'react';\nimport {EllipsisVerticalIcon} from 'lucide-react';\n\nexport type TreeNodeActionsMenuProps = PropsWithChildren<{\n className?: string;\n}>;\n\n/**\n * Component that renders a tree node \"more actions\" menu.\n * The menu items are passed as children.\n *\n * The menu is hidden by default and is shown when the user hovers over the node.\n * For this to work the parent element must have the `group` class.\n * It should also have classes `relative overflow-hidden`.\n *\n * @param children - The menu items.\n */\nexport const TreeNodeActionsMenu: FC<TreeNodeActionsMenuProps> = (props) => {\n const {children} = props;\n return (\n <div className=\"absolute right-0 top-[1px] opacity-0 outline-none group-hover:opacity-100\">\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <div className=\"hover:bg-foreground/10 flex h-5 w-7 items-center justify-center p-0 outline-none transition-colors\">\n <EllipsisVerticalIcon size=\"16px\" />\n </div>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" side=\"bottom\">\n {children}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n};\n\nexport const TreeNodeActionsMenuItem = forwardRef<\n ElementRef<typeof DropdownMenuItem>,\n ComponentPropsWithoutRef<typeof DropdownMenuItem>\n>(({className, ...props}, ref) => {\n const {onClick} = props;\n return (\n <DropdownMenuItem\n ref={ref}\n className={cn('gap-2 text-xs', className)}\n {...props}\n onClick={\n onClick\n ? (evt) => {\n evt.stopPropagation(); // prevent the tree node from closing\n onClick(evt);\n }\n : undefined\n }\n />\n );\n});\nTreeNodeActionsMenuItem.displayName = 'TreeNodeActionsMenuItem';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sqlrooms/schema-tree",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "author": "Ilya Boyandin <ilya@boyandin.me>",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -24,9 +24,9 @@
24
24
  "typedoc": "typedoc"
25
25
  },
26
26
  "dependencies": {
27
- "@sqlrooms/data-table": "0.18.0",
28
- "@sqlrooms/duckdb": "0.18.0",
29
- "@sqlrooms/ui": "0.18.0",
27
+ "@sqlrooms/data-table": "0.19.0",
28
+ "@sqlrooms/duckdb": "0.19.0",
29
+ "@sqlrooms/ui": "0.19.0",
30
30
  "lucide-react": "^0.474.0"
31
31
  },
32
32
  "peerDependencies": {
@@ -37,5 +37,5 @@
37
37
  "@types/react": "^19.1.7",
38
38
  "@types/react-dom": "^19.1.6"
39
39
  },
40
- "gitHead": "c1c06c9549ca74b9d4f515f6667b77d3196652df"
40
+ "gitHead": "ba6000f1e06d3ab01e309d805b5d187b32c9ff06"
41
41
  }