@powerhousedao/design-system 5.1.0 → 5.2.0-staging.2

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.
Files changed (103) hide show
  1. package/dist/src/connect/components/db-explorer/components/index.d.ts +3 -0
  2. package/dist/src/connect/components/db-explorer/components/index.d.ts.map +1 -0
  3. package/dist/src/connect/components/db-explorer/components/index.js +3 -0
  4. package/dist/src/connect/components/db-explorer/components/index.js.map +1 -0
  5. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.d.ts +15 -0
  6. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.d.ts.map +1 -0
  7. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.js +47 -0
  8. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.js.map +1 -0
  9. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.d.ts +12 -0
  10. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.d.ts.map +1 -0
  11. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.js +119 -0
  12. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.js.map +1 -0
  13. package/dist/src/connect/components/db-explorer/components/table-view.d.ts +26 -0
  14. package/dist/src/connect/components/db-explorer/components/table-view.d.ts.map +1 -0
  15. package/dist/src/connect/components/db-explorer/components/table-view.js +67 -0
  16. package/dist/src/connect/components/db-explorer/components/table-view.js.map +1 -0
  17. package/dist/src/connect/components/db-explorer/components/table-view.stories.d.ts +14 -0
  18. package/dist/src/connect/components/db-explorer/components/table-view.stories.d.ts.map +1 -0
  19. package/dist/src/connect/components/db-explorer/components/table-view.stories.js +203 -0
  20. package/dist/src/connect/components/db-explorer/components/table-view.stories.js.map +1 -0
  21. package/dist/src/connect/components/db-explorer/db-explorer.d.ts +32 -0
  22. package/dist/src/connect/components/db-explorer/db-explorer.d.ts.map +1 -0
  23. package/dist/src/connect/components/db-explorer/db-explorer.js +119 -0
  24. package/dist/src/connect/components/db-explorer/db-explorer.js.map +1 -0
  25. package/dist/src/connect/components/db-explorer/db-explorer.stories.d.ts +11 -0
  26. package/dist/src/connect/components/db-explorer/db-explorer.stories.d.ts.map +1 -0
  27. package/dist/src/connect/components/db-explorer/db-explorer.stories.js +182 -0
  28. package/dist/src/connect/components/db-explorer/db-explorer.stories.js.map +1 -0
  29. package/dist/src/connect/components/db-explorer/index.d.ts +2 -0
  30. package/dist/src/connect/components/db-explorer/index.d.ts.map +1 -0
  31. package/dist/src/connect/components/db-explorer/index.js +2 -0
  32. package/dist/src/connect/components/db-explorer/index.js.map +1 -0
  33. package/dist/src/connect/components/home-screen/home-screen.js +1 -1
  34. package/dist/src/connect/components/home-screen/home-screen.js.map +1 -1
  35. package/dist/src/connect/components/index.d.ts +2 -0
  36. package/dist/src/connect/components/index.d.ts.map +1 -1
  37. package/dist/src/connect/components/index.js +2 -0
  38. package/dist/src/connect/components/index.js.map +1 -1
  39. package/dist/src/connect/components/modal/index.d.ts +1 -0
  40. package/dist/src/connect/components/modal/index.d.ts.map +1 -1
  41. package/dist/src/connect/components/modal/index.js +1 -0
  42. package/dist/src/connect/components/modal/index.js.map +1 -1
  43. package/dist/src/connect/components/modal/inspector-modal/index.d.ts +2 -0
  44. package/dist/src/connect/components/modal/inspector-modal/index.d.ts.map +1 -0
  45. package/dist/src/connect/components/modal/inspector-modal/index.js +2 -0
  46. package/dist/src/connect/components/modal/inspector-modal/index.js.map +1 -0
  47. package/dist/src/connect/components/modal/inspector-modal/inspector-modal.d.ts +18 -0
  48. package/dist/src/connect/components/modal/inspector-modal/inspector-modal.d.ts.map +1 -0
  49. package/dist/src/connect/components/modal/inspector-modal/inspector-modal.js +13 -0
  50. package/dist/src/connect/components/modal/inspector-modal/inspector-modal.js.map +1 -0
  51. package/dist/src/connect/components/modal/inspector-modal/inspector-modal.stories.d.ts +10 -0
  52. package/dist/src/connect/components/modal/inspector-modal/inspector-modal.stories.d.ts.map +1 -0
  53. package/dist/src/connect/components/modal/inspector-modal/inspector-modal.stories.js +226 -0
  54. package/dist/src/connect/components/modal/inspector-modal/inspector-modal.stories.js.map +1 -0
  55. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.d.ts +9 -0
  56. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.d.ts.map +1 -0
  57. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.js +38 -0
  58. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.js.map +1 -0
  59. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.d.ts +12 -0
  60. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.d.ts.map +1 -0
  61. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.js +113 -0
  62. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.js.map +1 -0
  63. package/dist/src/connect/components/remotes-inspector/components/mailbox-table.d.ts +14 -0
  64. package/dist/src/connect/components/remotes-inspector/components/mailbox-table.d.ts.map +1 -0
  65. package/dist/src/connect/components/remotes-inspector/components/mailbox-table.js +97 -0
  66. package/dist/src/connect/components/remotes-inspector/components/mailbox-table.js.map +1 -0
  67. package/dist/src/connect/components/remotes-inspector/components/sort-icon.d.ts +7 -0
  68. package/dist/src/connect/components/remotes-inspector/components/sort-icon.d.ts.map +1 -0
  69. package/dist/src/connect/components/remotes-inspector/components/sort-icon.js +10 -0
  70. package/dist/src/connect/components/remotes-inspector/components/sort-icon.js.map +1 -0
  71. package/dist/src/connect/components/remotes-inspector/index.d.ts +3 -0
  72. package/dist/src/connect/components/remotes-inspector/index.d.ts.map +1 -0
  73. package/dist/src/connect/components/remotes-inspector/index.js +3 -0
  74. package/dist/src/connect/components/remotes-inspector/index.js.map +1 -0
  75. package/dist/src/connect/components/remotes-inspector/remotes-inspector.d.ts +6 -0
  76. package/dist/src/connect/components/remotes-inspector/remotes-inspector.d.ts.map +1 -0
  77. package/dist/src/connect/components/remotes-inspector/remotes-inspector.js +104 -0
  78. package/dist/src/connect/components/remotes-inspector/remotes-inspector.js.map +1 -0
  79. package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.d.ts +10 -0
  80. package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.d.ts.map +1 -0
  81. package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.js +128 -0
  82. package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.js.map +1 -0
  83. package/dist/src/connect/components/remotes-inspector/utils.d.ts +12 -0
  84. package/dist/src/connect/components/remotes-inspector/utils.d.ts.map +1 -0
  85. package/dist/src/connect/components/remotes-inspector/utils.js +6 -0
  86. package/dist/src/connect/components/remotes-inspector/utils.js.map +1 -0
  87. package/dist/src/connect/components/sidebar/sidebar-footer.d.ts +1 -0
  88. package/dist/src/connect/components/sidebar/sidebar-footer.d.ts.map +1 -1
  89. package/dist/src/connect/components/sidebar/sidebar-footer.js +2 -2
  90. package/dist/src/connect/components/sidebar/sidebar-footer.js.map +1 -1
  91. package/dist/src/connect/components/sidebar/sidebar.d.ts.map +1 -1
  92. package/dist/src/connect/components/sidebar/sidebar.js +2 -2
  93. package/dist/src/connect/components/sidebar/sidebar.js.map +1 -1
  94. package/dist/src/connect/hooks/use-drop.d.ts.map +1 -1
  95. package/dist/src/connect/hooks/use-drop.js +3 -0
  96. package/dist/src/connect/hooks/use-drop.js.map +1 -1
  97. package/dist/src/ui/components/index.d.ts +1 -0
  98. package/dist/src/ui/components/index.d.ts.map +1 -1
  99. package/dist/src/ui/components/index.js +1 -0
  100. package/dist/src/ui/components/index.js.map +1 -1
  101. package/dist/style.css +90 -0
  102. package/dist/tsconfig.tsbuildinfo +1 -1
  103. package/package.json +6 -5
@@ -0,0 +1,3 @@
1
+ export * from "./schema-tree-sidebar.js";
2
+ export * from "./table-view.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/connect/components/db-explorer/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./schema-tree-sidebar.js";
2
+ export * from "./table-view.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/connect/components/db-explorer/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { ColumnInfo } from "./table-view.js";
2
+ export type TableInfo = {
3
+ readonly name: string;
4
+ readonly columns: ColumnInfo[];
5
+ };
6
+ export type SchemaTreeSidebarProps = {
7
+ readonly schema: string;
8
+ readonly tables: TableInfo[];
9
+ readonly selectedTable?: string;
10
+ readonly onSelectTable: (table: string) => void;
11
+ readonly onRefresh?: () => void | Promise<void>;
12
+ readonly loading?: boolean;
13
+ };
14
+ export declare function SchemaTreeSidebar({ schema, tables, selectedTable, onSelectTable, onRefresh, loading, }: SchemaTreeSidebarProps): import("react/jsx-runtime").JSX.Element;
15
+ //# sourceMappingURL=schema-tree-sidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-tree-sidebar.d.ts","sourceRoot":"","sources":["../../../../../../src/connect/components/db-explorer/components/schema-tree-sidebar.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;CAChC,CAAC;AAIF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AA+FF,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,MAAM,EACN,aAAa,EACb,aAAa,EACb,SAAS,EACT,OAAO,GACR,EAAE,sBAAsB,2CAsFxB"}
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Icon } from "@powerhousedao/design-system";
3
+ import { useState } from "react";
4
+ import { twMerge } from "tailwind-merge";
5
+ const INDENT_PX = 16;
6
+ function TreeItem({ label, depth, expanded, selected, hasChildren, icon, onToggle, onClick, children, }) {
7
+ const handleChevronClick = (e) => {
8
+ e.stopPropagation();
9
+ onToggle?.();
10
+ };
11
+ return (_jsxs("div", { children: [_jsxs("div", { className: twMerge("flex cursor-pointer items-center gap-1 py-1 pr-2 text-sm hover:bg-gray-100", selected && "bg-blue-50"), style: { paddingLeft: depth * INDENT_PX + 4 }, onClick: onClick, children: [hasChildren ? (_jsx("button", { className: "flex h-4 w-4 shrink-0 items-center justify-center text-gray-500 hover:text-gray-700", onClick: handleChevronClick, type: "button", children: _jsx(Icon, { className: twMerge("transition-transform", expanded && "rotate-90"), name: "CaretRight", size: 12 }) })) : (_jsx("span", { className: "w-4 shrink-0" })), icon && _jsx("span", { className: "shrink-0 text-gray-500", children: icon }), _jsx("span", { className: "min-w-0 flex-1 truncate text-gray-700", children: label }), selected && (_jsx("span", { className: "ml-auto h-2 w-2 shrink-0 rounded-full bg-blue-500" }))] }), expanded && children] }));
12
+ }
13
+ function ColumnItem({ column, depth, }) {
14
+ const typeLabel = column.dataType.length > 10
15
+ ? column.dataType.slice(0, 10) + "…"
16
+ : column.dataType;
17
+ return (_jsxs("div", { className: "flex items-center gap-1 py-0.5 pr-2 text-xs text-gray-500", style: { paddingLeft: depth * INDENT_PX + 4 }, children: [_jsx("span", { className: "w-4 shrink-0" }), _jsx("span", { className: "truncate", children: column.name }), _jsxs("span", { className: "ml-auto shrink-0 text-gray-400", children: ["(", typeLabel, ")"] })] }));
18
+ }
19
+ export function SchemaTreeSidebar({ schema, tables, selectedTable, onSelectTable, onRefresh, loading, }) {
20
+ const [expandedNodes, setExpandedNodes] = useState({
21
+ [schema]: true,
22
+ });
23
+ const toggleNode = (nodeId) => {
24
+ setExpandedNodes((prev) => ({
25
+ ...prev,
26
+ [nodeId]: !prev[nodeId],
27
+ }));
28
+ };
29
+ const handleTableClick = (tableName) => {
30
+ onSelectTable(tableName);
31
+ setExpandedNodes((prev) => ({
32
+ ...prev,
33
+ [tableName]: !prev[tableName],
34
+ }));
35
+ };
36
+ const isSchemaExpanded = expandedNodes[schema] ?? false;
37
+ const handleRefreshClick = (e) => {
38
+ e.stopPropagation();
39
+ void onRefresh?.();
40
+ };
41
+ return (_jsx("div", { className: "flex flex-col overflow-auto pt-4 text-sm", children: _jsx(TreeItem, { depth: 0, expanded: isSchemaExpanded, hasChildren: tables.length > 0, icon: _jsx(Icon, { name: isSchemaExpanded ? "FolderOpen" : "FolderClose", size: 16 }), label: _jsxs("div", { className: "flex flex-1 items-center", children: [_jsx("span", { className: "truncate", children: schema }), onRefresh && (_jsx("button", { className: "ml-auto p-0.5 text-gray-400 hover:text-gray-600", onClick: handleRefreshClick, type: "button", disabled: loading, children: _jsx(Icon, { name: "Reload", size: 14, className: loading ? "animate-spin" : undefined }) }))] }), onClick: () => toggleNode(schema), onToggle: () => toggleNode(schema), children: tables.map((table) => {
42
+ const isTableExpanded = expandedNodes[table.name] ?? false;
43
+ const isSelected = selectedTable === table.name;
44
+ return (_jsx(TreeItem, { depth: 1, expanded: isTableExpanded, hasChildren: table.columns.length > 0, icon: _jsx(Icon, { name: "TreeViewSlash", size: 16 }), label: table.name, selected: isSelected, onClick: () => handleTableClick(table.name), onToggle: () => toggleNode(table.name), children: table.columns.map((col) => (_jsx(ColumnItem, { column: col, depth: 2 }, col.name))) }, table.name));
45
+ }) }) }));
46
+ }
47
+ //# sourceMappingURL=schema-tree-sidebar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-tree-sidebar.js","sourceRoot":"","sources":["../../../../../../src/connect/components/db-explorer/components/schema-tree-sidebar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AA+BzC,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,SAAS,QAAQ,CAAC,EAChB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,GACM;IACd,MAAM,kBAAkB,GAAG,CAAC,CAAmB,EAAE,EAAE;QACjD,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,QAAQ,EAAE,EAAE,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,CACL,0BACE,eACE,SAAS,EAAE,OAAO,CAChB,4EAA4E,EAC5E,QAAQ,IAAI,YAAY,CACzB,EACD,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,GAAG,SAAS,GAAG,CAAC,EAAE,EAC7C,OAAO,EAAE,OAAO,aAEf,WAAW,CAAC,CAAC,CAAC,CACb,iBACE,SAAS,EAAC,qFAAqF,EAC/F,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAC,QAAQ,YAEb,KAAC,IAAI,IACH,SAAS,EAAE,OAAO,CAChB,sBAAsB,EACtB,QAAQ,IAAI,WAAW,CACxB,EACD,IAAI,EAAC,YAAY,EACjB,IAAI,EAAE,EAAE,GACR,GACK,CACV,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,cA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AAQ,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,YAEjC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACpB,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;gBAC3D,MAAM,UAAU,GAAG,aAAa,KAAK,KAAK,CAAC,IAAI,CAAC;gBAEhD,OAAO,CACL,KAAC,QAAQ,IAEP,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EACrC,IAAI,EAAE,KAAC,IAAI,IAAC,IAAI,EAAC,eAAe,EAAC,IAAI,EAAE,EAAE,GAAI,EAC7C,KAAK,EAAE,KAAK,CAAC,IAAI,EACjB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,EAC3C,QAAQ,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,YAErC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAC1B,KAAC,UAAU,IAAgB,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,IAA/B,GAAG,CAAC,IAAI,CAA2B,CACrD,CAAC,IAZG,KAAK,CAAC,IAAI,CAaN,CACZ,CAAC;YACJ,CAAC,CAAC,GACO,GACP,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { SchemaTreeSidebar } from "./schema-tree-sidebar.js";
3
+ declare const meta: Meta<typeof SchemaTreeSidebar>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof SchemaTreeSidebar>;
6
+ export declare const Default: Story;
7
+ export declare const WithSelectedTable: Story;
8
+ export declare const EmptySchema: Story;
9
+ export declare const ManyTables: Story;
10
+ export declare const Interactive: Story;
11
+ export declare const Loading: Story;
12
+ //# sourceMappingURL=schema-tree-sidebar.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-tree-sidebar.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/connect/components/db-explorer/components/schema-tree-sidebar.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EACL,iBAAiB,EAGlB,MAAM,0BAA0B,CAAC;AAElC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAaxC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAwChD,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAO/B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAMzB,CAAC;AAaF,eAAO,MAAM,UAAU,EAAE,KAMxB,CAAC;AAmBF,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC"}
@@ -0,0 +1,119 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { fn } from "@storybook/test";
3
+ import { useState } from "react";
4
+ import { SchemaTreeSidebar, } from "./schema-tree-sidebar.js";
5
+ const meta = {
6
+ title: "Connect/Components/DBExplorer/SchemaTreeSidebar",
7
+ component: SchemaTreeSidebar,
8
+ parameters: {
9
+ layout: "padded",
10
+ },
11
+ decorators: [
12
+ (Story) => (_jsx("div", { className: "w-64 border border-gray-200 bg-white", children: _jsx(Story, {}) })),
13
+ ],
14
+ };
15
+ export default meta;
16
+ const mockTables = [
17
+ {
18
+ name: "users",
19
+ columns: [
20
+ { name: "id", dataType: "int4", isNullable: false },
21
+ { name: "name", dataType: "varchar", isNullable: false },
22
+ { name: "email", dataType: "varchar", isNullable: false },
23
+ { name: "created_at", dataType: "timestamp", isNullable: true },
24
+ ],
25
+ },
26
+ {
27
+ name: "posts",
28
+ columns: [
29
+ { name: "id", dataType: "int4", isNullable: false },
30
+ { name: "title", dataType: "varchar", isNullable: false },
31
+ { name: "content", dataType: "text", isNullable: true },
32
+ { name: "author_id", dataType: "int4", isNullable: false },
33
+ { name: "published_at", dataType: "timestamp", isNullable: true },
34
+ ],
35
+ },
36
+ {
37
+ name: "comments",
38
+ columns: [
39
+ { name: "id", dataType: "int4", isNullable: false },
40
+ { name: "post_id", dataType: "int4", isNullable: false },
41
+ { name: "user_id", dataType: "int4", isNullable: false },
42
+ { name: "body", dataType: "text", isNullable: false },
43
+ ],
44
+ },
45
+ {
46
+ name: "tags",
47
+ columns: [
48
+ { name: "id", dataType: "int4", isNullable: false },
49
+ { name: "name", dataType: "varchar", isNullable: false },
50
+ ],
51
+ },
52
+ ];
53
+ export const Default = {
54
+ args: {
55
+ schema: "public",
56
+ tables: mockTables,
57
+ onSelectTable: fn(),
58
+ onRefresh: fn(),
59
+ },
60
+ };
61
+ export const WithSelectedTable = {
62
+ args: {
63
+ schema: "public",
64
+ tables: mockTables,
65
+ selectedTable: "users",
66
+ onSelectTable: fn(),
67
+ },
68
+ };
69
+ export const EmptySchema = {
70
+ args: {
71
+ schema: "public",
72
+ tables: [],
73
+ onSelectTable: fn(),
74
+ },
75
+ };
76
+ const manyTables = mockTables.concat([
77
+ { name: "categories", columns: [] },
78
+ { name: "products", columns: [] },
79
+ { name: "orders", columns: [] },
80
+ { name: "order_items", columns: [] },
81
+ { name: "payments", columns: [] },
82
+ { name: "reviews", columns: [] },
83
+ { name: "sessions", columns: [] },
84
+ { name: "logs", columns: [] },
85
+ ]);
86
+ export const ManyTables = {
87
+ args: {
88
+ schema: "public",
89
+ tables: manyTables,
90
+ onSelectTable: fn(),
91
+ },
92
+ };
93
+ function InteractiveWrapper(args) {
94
+ const [selectedTable, setSelectedTable] = useState();
95
+ const handleSelectTable = (table) => {
96
+ setSelectedTable(table);
97
+ args.onSelectTable(table);
98
+ };
99
+ return (_jsx(SchemaTreeSidebar, { ...args, selectedTable: selectedTable, onSelectTable: handleSelectTable }));
100
+ }
101
+ export const Interactive = {
102
+ render: InteractiveWrapper,
103
+ args: {
104
+ schema: "public",
105
+ tables: mockTables,
106
+ onSelectTable: fn(),
107
+ onRefresh: fn(),
108
+ },
109
+ };
110
+ export const Loading = {
111
+ args: {
112
+ schema: "public",
113
+ tables: mockTables,
114
+ onSelectTable: fn(),
115
+ onRefresh: fn(),
116
+ loading: true,
117
+ },
118
+ };
119
+ //# sourceMappingURL=schema-tree-sidebar.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-tree-sidebar.stories.js","sourceRoot":"","sources":["../../../../../../src/connect/components/db-explorer/components/schema-tree-sidebar.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EACL,iBAAiB,GAGlB,MAAM,0BAA0B,CAAC;AAElC,MAAM,IAAI,GAAmC;IAC3C,KAAK,EAAE,iDAAiD;IACxD,SAAS,EAAE,iBAAiB;IAC5B,UAAU,EAAE;QACV,MAAM,EAAE,QAAQ;KACjB;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,cAAK,SAAS,EAAC,sCAAsC,YACnD,KAAC,KAAK,KAAG,GACL,CACP;KACF;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,UAAU,GAAgB;IAC9B;QACE,IAAI,EAAE,OAAO;QACb,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE;YACnD,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK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UAAU;QAClB,aAAa,EAAE,EAAE,EAAE;KACpB;CACF,CAAC;AAEF,SAAS,kBAAkB,CAAC,IAA4B;IACtD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,EAAsB,CAAC;IAEzE,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,EAAE;QAC1C,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,iBAAiB,OACZ,IAAI,EACR,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,iBAAiB,GAChC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE;QACJ,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,UAAU;QAClB,aAAa,EAAE,EAAE,EAAE;QACnB,SAAS,EAAE,EAAE,EAAE;KAChB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,UAAU;QAClB,aAAa,EAAE,EAAE,EAAE;QACnB,SAAS,EAAE,EAAE,EAAE;QACf,OAAO,EAAE,IAAI;KACd;CACF,CAAC"}
@@ -0,0 +1,26 @@
1
+ export type ColumnInfo = {
2
+ readonly name: string;
3
+ readonly dataType: string;
4
+ readonly isNullable: boolean;
5
+ };
6
+ export type SortDirection = "asc" | "desc";
7
+ export type SortOptions = {
8
+ readonly column: string;
9
+ readonly direction: SortDirection;
10
+ };
11
+ export type PaginationState = {
12
+ readonly offset: number;
13
+ readonly limit: number;
14
+ readonly total: number | null;
15
+ };
16
+ export type TableViewProps = {
17
+ readonly columns: ColumnInfo[];
18
+ readonly rows: Record<string, unknown>[];
19
+ readonly pagination: PaginationState;
20
+ readonly onPageChange: (offset: number) => void;
21
+ readonly onSort?: (sort: SortOptions) => void;
22
+ readonly currentSort?: SortOptions;
23
+ readonly loading?: boolean;
24
+ };
25
+ export declare function TableView({ columns, rows, pagination, onPageChange, onSort, currentSort, loading, }: TableViewProps): import("react/jsx-runtime").JSX.Element;
26
+ //# sourceMappingURL=table-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-view.d.ts","sourceRoot":"","sources":["../../../../../../src/connect/components/db-explorer/components/table-view.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAqCF,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,MAAM,EACN,WAAW,EACX,OAAe,GAChB,EAAE,cAAc,2CA2MhB"}
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Icon } from "@powerhousedao/design-system";
3
+ import { twMerge } from "tailwind-merge";
4
+ function formatCellValue(value) {
5
+ if (value === null)
6
+ return "NULL";
7
+ if (value === undefined)
8
+ return "";
9
+ if (typeof value === "object")
10
+ return JSON.stringify(value);
11
+ if (typeof value === "function")
12
+ return "[function]";
13
+ if (typeof value === "symbol")
14
+ return value.toString();
15
+ return String(value);
16
+ }
17
+ function SortIcon({ direction, active, }) {
18
+ if (!active) {
19
+ return (_jsx(Icon, { className: "opacity-0 group-hover:opacity-50", name: "CaretSort", size: 12 }));
20
+ }
21
+ return (_jsx(Icon, { className: direction === "asc" ? "rotate-180" : undefined, name: "TriangleDown", size: 12 }));
22
+ }
23
+ export function TableView({ columns, rows, pagination, onPageChange, onSort, currentSort, loading = false, }) {
24
+ const { offset, limit, total } = pagination;
25
+ const currentPage = Math.floor(offset / limit);
26
+ const totalPages = total !== null ? Math.ceil(total / limit) : 0;
27
+ const startItem = total === 0 ? 0 : offset + 1;
28
+ const endItem = total !== null ? Math.min(offset + limit, total) : offset + rows.length;
29
+ const goToPage = (page) => {
30
+ onPageChange(page * limit);
31
+ };
32
+ const handleSort = (columnName) => {
33
+ if (!onSort)
34
+ return;
35
+ const newDirection = currentSort?.column === columnName && currentSort.direction === "asc"
36
+ ? "desc"
37
+ : "asc";
38
+ onSort({ column: columnName, direction: newDirection });
39
+ };
40
+ const getVisiblePages = () => {
41
+ const maxVisible = 3;
42
+ if (totalPages <= maxVisible) {
43
+ return Array.from({ length: totalPages }, (_, i) => i);
44
+ }
45
+ const start = Math.max(0, Math.min(currentPage - 1, totalPages - maxVisible));
46
+ const end = Math.min(totalPages - 1, start + maxVisible - 1);
47
+ const pages = [];
48
+ for (let i = start; i <= end; i++) {
49
+ pages.push(i);
50
+ }
51
+ return pages;
52
+ };
53
+ const visiblePages = getVisiblePages();
54
+ return (_jsxs("div", { className: "flex h-full flex-col gap-2", children: [_jsxs("div", { className: "flex shrink-0 items-center justify-between text-sm", children: [_jsx("span", { className: "text-gray-600", children: loading
55
+ ? "Loading..."
56
+ : total !== null
57
+ ? `Showing ${startItem.toLocaleString()}-${endItem.toLocaleString()} of ${total.toLocaleString()}`
58
+ : `Showing ${rows.length.toLocaleString()} rows` }), total !== null && total > limit && (_jsxs("div", { className: "flex gap-1", children: [_jsx("button", { className: "rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50", disabled: currentPage === 0, onClick: () => goToPage(0), type: "button", children: "First" }), _jsx("button", { className: "rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50", disabled: currentPage === 0, onClick: () => goToPage(currentPage - 1), type: "button", children: _jsx(Icon, { className: "rotate-90", name: "ChevronDown", size: 14 }) }), visiblePages[0] > 0 && (_jsx("span", { className: "flex items-center px-1 text-xs text-gray-500", children: "..." })), visiblePages.map((page) => (_jsx("button", { className: twMerge("min-w-8 rounded border px-2 py-1 text-xs", page === currentPage
59
+ ? "border-blue-500 bg-blue-50 text-blue-700"
60
+ : "border-gray-300 bg-white text-gray-700 hover:bg-gray-100"), onClick: () => goToPage(page), type: "button", children: page + 1 }, page))), visiblePages[visiblePages.length - 1] < totalPages - 1 && (_jsx("span", { className: "flex items-center px-1 text-xs text-gray-500", children: "..." })), _jsx("button", { className: "rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50", disabled: currentPage >= totalPages - 1, onClick: () => goToPage(currentPage + 1), type: "button", children: _jsx(Icon, { className: "-rotate-90", name: "ChevronDown", size: 14 }) }), _jsx("button", { className: "rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50", disabled: currentPage >= totalPages - 1, onClick: () => goToPage(totalPages - 1), type: "button", children: "Last" })] }))] }), _jsx("div", { className: twMerge("max-h-full overflow-auto rounded-lg border border-gray-300 transition-opacity", loading && "pointer-events-none opacity-50"), children: _jsxs("table", { className: "w-full border-collapse", children: [_jsx("thead", { className: "sticky top-0 bg-gray-100", children: _jsx("tr", { children: columns.map((column, index) => {
61
+ const isActive = currentSort?.column === column.name;
62
+ const sortDirection = isActive ? currentSort.direction : "asc";
63
+ return (_jsx("th", { className: twMerge("group px-3 py-2 text-left text-xs font-medium text-gray-600", index > 0 && "border-l border-gray-300", onSort &&
64
+ "cursor-pointer hover:bg-gray-200 hover:text-gray-900"), onClick: () => onSort && handleSort(column.name), children: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { className: "truncate", children: column.name }), onSort && (_jsx(SortIcon, { active: isActive, direction: sortDirection }))] }) }, column.name));
65
+ }) }) }), _jsx("tbody", { children: rows.length === 0 ? (_jsx("tr", { children: _jsx("td", { className: "px-3 py-8 text-center text-sm text-gray-500", colSpan: columns.length, children: "No data" }) })) : (rows.map((row, rowIndex) => (_jsx("tr", { className: "odd:bg-white even:bg-gray-50 hover:bg-blue-50", children: columns.map((column, colIndex) => (_jsx("td", { className: twMerge("px-3 py-2 text-xs text-gray-900", colIndex > 0 && "border-l border-gray-300"), children: _jsx("span", { className: twMerge("block truncate", row[column.name] === null && "italic text-gray-400"), title: formatCellValue(row[column.name]), children: formatCellValue(row[column.name]) }) }, column.name))) }, rowIndex)))) })] }) })] }));
66
+ }
67
+ //# sourceMappingURL=table-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-view.js","sourceRoot":"","sources":["../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0B,CAC3C,YAED,eACE,SAAS,EAAE,OAAO,CAChB,gBAAgB,EAChB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,sBAAsB,CACpD,EACD,KAAK,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,YAEvC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAC7B,IAdF,MAAM,CAAC,IAAI,CAeb,CACN,CAAC,IArBG,QAAQ,CAsBV,CACN,CAAC,CACH,GACK,IACF,GACJ,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { TableView } from "./table-view.js";
3
+ declare const meta: Meta<typeof TableView>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TableView>;
6
+ export declare const Default: Story;
7
+ export declare const WithSorting: Story;
8
+ export declare const WithPagination: Story;
9
+ export declare const MiddlePage: Story;
10
+ export declare const EmptyTable: Story;
11
+ export declare const NullValues: Story;
12
+ export declare const ManyColumns: Story;
13
+ export declare const Interactive: Story;
14
+ //# sourceMappingURL=table-view.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-view.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/connect/components/db-explorer/components/table-view.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EACL,SAAS,EAKV,MAAM,iBAAiB,CAAC;AAEzB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAahC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;AAgDxC,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KASzB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAW5B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAWxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAWxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAWxB,CAAC;AA0CF,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAC;AA+BF,eAAO,MAAM,WAAW,EAAE,KAazB,CAAC"}
@@ -0,0 +1,203 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { fn } from "@storybook/test";
3
+ import { useState } from "react";
4
+ import { TableView, } from "./table-view.js";
5
+ const meta = {
6
+ title: "Connect/Components/DBExplorer/TableView",
7
+ component: TableView,
8
+ parameters: {
9
+ layout: "padded",
10
+ },
11
+ decorators: [
12
+ (Story) => (_jsx("div", { className: "w-full max-w-4xl", children: _jsx(Story, {}) })),
13
+ ],
14
+ };
15
+ export default meta;
16
+ const mockColumns = [
17
+ { name: "id", dataType: "int4", isNullable: false },
18
+ { name: "name", dataType: "varchar", isNullable: false },
19
+ { name: "email", dataType: "varchar", isNullable: false },
20
+ { name: "created_at", dataType: "timestamp", isNullable: true },
21
+ ];
22
+ const mockRows = [
23
+ {
24
+ id: 1,
25
+ name: "Alice Johnson",
26
+ email: "alice@example.com",
27
+ created_at: "2024-01-15T10:30:00Z",
28
+ },
29
+ {
30
+ id: 2,
31
+ name: "Bob Smith",
32
+ email: "bob@example.com",
33
+ created_at: "2024-01-16T14:20:00Z",
34
+ },
35
+ {
36
+ id: 3,
37
+ name: "Charlie Brown",
38
+ email: "charlie@test.com",
39
+ created_at: null,
40
+ },
41
+ {
42
+ id: 4,
43
+ name: "Diana Prince",
44
+ email: "diana@example.com",
45
+ created_at: "2024-01-18T09:00:00Z",
46
+ },
47
+ {
48
+ id: 5,
49
+ name: "Eve Wilson",
50
+ email: "eve@test.com",
51
+ created_at: "2024-01-19T16:45:00Z",
52
+ },
53
+ ];
54
+ const defaultPagination = {
55
+ offset: 0,
56
+ limit: 50,
57
+ total: 5,
58
+ };
59
+ export const Default = {
60
+ args: {
61
+ columns: mockColumns,
62
+ rows: mockRows,
63
+ pagination: defaultPagination,
64
+ onPageChange: fn(),
65
+ },
66
+ };
67
+ export const WithSorting = {
68
+ args: {
69
+ columns: mockColumns,
70
+ rows: mockRows,
71
+ pagination: defaultPagination,
72
+ onPageChange: fn(),
73
+ onSort: fn(),
74
+ currentSort: { column: "name", direction: "asc" },
75
+ },
76
+ };
77
+ export const WithPagination = {
78
+ args: {
79
+ columns: mockColumns,
80
+ rows: mockRows,
81
+ pagination: {
82
+ offset: 0,
83
+ limit: 50,
84
+ total: 1234,
85
+ },
86
+ onPageChange: fn(),
87
+ },
88
+ };
89
+ export const MiddlePage = {
90
+ args: {
91
+ columns: mockColumns,
92
+ rows: mockRows,
93
+ pagination: {
94
+ offset: 250,
95
+ limit: 50,
96
+ total: 1234,
97
+ },
98
+ onPageChange: fn(),
99
+ },
100
+ };
101
+ export const EmptyTable = {
102
+ args: {
103
+ columns: mockColumns,
104
+ rows: [],
105
+ pagination: {
106
+ offset: 0,
107
+ limit: 50,
108
+ total: 0,
109
+ },
110
+ onPageChange: fn(),
111
+ },
112
+ };
113
+ export const NullValues = {
114
+ args: {
115
+ columns: mockColumns,
116
+ rows: [
117
+ { id: 1, name: "Alice", email: null, created_at: null },
118
+ { id: 2, name: null, email: "bob@test.com", created_at: null },
119
+ { id: 3, name: "Charlie", email: "charlie@test.com", created_at: null },
120
+ ],
121
+ pagination: defaultPagination,
122
+ onPageChange: fn(),
123
+ },
124
+ };
125
+ const manyColumns = [
126
+ { name: "id", dataType: "int4", isNullable: false },
127
+ { name: "first_name", dataType: "varchar", isNullable: false },
128
+ { name: "last_name", dataType: "varchar", isNullable: false },
129
+ { name: "email", dataType: "varchar", isNullable: false },
130
+ { name: "phone", dataType: "varchar", isNullable: true },
131
+ { name: "address", dataType: "text", isNullable: true },
132
+ { name: "city", dataType: "varchar", isNullable: true },
133
+ { name: "country", dataType: "varchar", isNullable: true },
134
+ { name: "created_at", dataType: "timestamp", isNullable: true },
135
+ { name: "updated_at", dataType: "timestamp", isNullable: true },
136
+ ];
137
+ const manyColumnsRows = [
138
+ {
139
+ id: 1,
140
+ first_name: "Alice",
141
+ last_name: "Johnson",
142
+ email: "alice@example.com",
143
+ phone: "+1-555-0101",
144
+ address: "123 Main Street",
145
+ city: "New York",
146
+ country: "USA",
147
+ created_at: "2024-01-15",
148
+ updated_at: "2024-01-20",
149
+ },
150
+ {
151
+ id: 2,
152
+ first_name: "Bob",
153
+ last_name: "Smith",
154
+ email: "bob@example.com",
155
+ phone: null,
156
+ address: null,
157
+ city: "Los Angeles",
158
+ country: "USA",
159
+ created_at: "2024-01-16",
160
+ updated_at: null,
161
+ },
162
+ ];
163
+ export const ManyColumns = {
164
+ args: {
165
+ columns: manyColumns,
166
+ rows: manyColumnsRows,
167
+ pagination: defaultPagination,
168
+ onPageChange: fn(),
169
+ onSort: fn(),
170
+ },
171
+ };
172
+ function InteractiveWrapper(args) {
173
+ const [pagination, setPagination] = useState({
174
+ offset: 0,
175
+ limit: 50,
176
+ total: 1234,
177
+ });
178
+ const [currentSort, setCurrentSort] = useState();
179
+ const handlePageChange = (offset) => {
180
+ setPagination((prev) => ({ ...prev, offset }));
181
+ args.onPageChange(offset);
182
+ };
183
+ const handleSort = (sort) => {
184
+ setCurrentSort(sort);
185
+ args.onSort?.(sort);
186
+ };
187
+ return (_jsx(TableView, { ...args, currentSort: currentSort, pagination: pagination, onPageChange: handlePageChange, onSort: handleSort }));
188
+ }
189
+ export const Interactive = {
190
+ render: InteractiveWrapper,
191
+ args: {
192
+ columns: mockColumns,
193
+ rows: mockRows,
194
+ pagination: {
195
+ offset: 0,
196
+ limit: 50,
197
+ total: 1234,
198
+ },
199
+ onPageChange: fn(),
200
+ onSort: fn(),
201
+ },
202
+ };
203
+ //# sourceMappingURL=table-view.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-view.stories.js","sourceRoot":"","sources":["../../../../../../src/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EAAE,aAAa,CAAC,GAAG,QAAQ,CAAkB;QAC5D,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IACH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,EAA2B,CAAC;IAE1E,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAE,EAAE;QAC1C,aAAa,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,IAAiB,EAAE,EAAE;QACvC,cAAc,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,OACJ,IAAI,EACR,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,gBAAgB,EAC9B,MAAM,EAAE,UAAU,GAClB,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE;QACJ,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,IAAI;SACZ;QACD,YAAY,EAAE,EAAE,EAAE;QAClB,MAAM,EAAE,EAAE,EAAE;KACb;CACF,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { type TableInfo } from "./components/schema-tree-sidebar.js";
2
+ import { type ColumnInfo, type SortOptions } from "./components/table-view.js";
3
+ export type { TableInfo } from "./components/schema-tree-sidebar.js";
4
+ export type { ColumnInfo, SortOptions } from "./components/table-view.js";
5
+ export type GetTableRowsOptions = {
6
+ readonly schema?: string;
7
+ readonly limit: number;
8
+ readonly offset: number;
9
+ readonly sort?: SortOptions;
10
+ };
11
+ export type TablePage = {
12
+ readonly columns: string[];
13
+ readonly rows: Record<string, unknown>[];
14
+ readonly total: number | null;
15
+ };
16
+ export interface DbClient {
17
+ readonly kind: string;
18
+ listTables(schema?: string): Promise<string[]>;
19
+ getTableSchema(table: string, schema?: string): Promise<ColumnInfo[]>;
20
+ getTableRows(table: string, options: GetTableRowsOptions): Promise<TablePage>;
21
+ }
22
+ /** Props for the main DBExplorer component */
23
+ export type DBExplorerProps = {
24
+ readonly schema: string;
25
+ readonly getTables: () => Promise<TableInfo[]>;
26
+ readonly getTableRows: (table: string, options: GetTableRowsOptions) => Promise<TablePage>;
27
+ readonly pageSize?: number;
28
+ readonly onImportDb?: (sqlContent: string) => void | Promise<void>;
29
+ readonly onExportDb?: () => void | Promise<void>;
30
+ };
31
+ export declare function DBExplorer({ schema, getTables, getTableRows, pageSize, onImportDb, onExportDb, }: DBExplorerProps): import("react/jsx-runtime").JSX.Element;
32
+ //# sourceMappingURL=db-explorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-explorer.d.ts","sourceRoot":"","sources":["../../../../../src/connect/components/db-explorer/db-explorer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEL,KAAK,UAAU,EAEf,KAAK,WAAW,EACjB,MAAM,4BAA4B,CAAC;AAGpC,YAAY,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE1E,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAC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