@instantdb/components 0.22.89-experimental.sync-table-fixes.20282627123.1 → 0.22.89-experimental.uuidfix.20282483875.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@instantdb/components",
3
3
  "private": false,
4
- "version": "0.22.89-experimental.sync-table-fixes.20282627123.1",
4
+ "version": "0.22.89-experimental.uuidfix.20282483875.1",
5
5
  "type": "module",
6
6
  "description": "Instant's UI components",
7
7
  "homepage": "https://github.com/instantdb/instant/tree/main/client/packages/components",
@@ -54,8 +54,8 @@
54
54
  "vitest": "^1.6.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "react": "^18.3.1 || ^19.0.0",
58
- "react-dom": "^18.3.1 || ^19.0.0"
57
+ "react": "^18.3.1",
58
+ "react-dom": "^18.3.1"
59
59
  },
60
60
  "dependencies": {
61
61
  "@babel/parser": "^8.0.0-beta.0",
@@ -74,7 +74,6 @@
74
74
  "@radix-ui/react-switch": "^1.2.6",
75
75
  "@radix-ui/react-toggle-group": "^1.0.4",
76
76
  "@radix-ui/react-tooltip": "^1.1.7",
77
- "@radix-ui/react-visually-hidden": "^1.2.4",
78
77
  "@tanstack/react-table": "^8.21.3",
79
78
  "clsx": "^2.1.0",
80
79
  "copy-to-clipboard": "^3.3.3",
@@ -93,11 +92,11 @@
93
92
  "swr": "^2.2.4",
94
93
  "tailwind-merge": "^2.2.1",
95
94
  "uuid": "^11.1.0",
96
- "@instantdb/admin": "0.22.89-experimental.sync-table-fixes.20282627123.1",
97
- "@instantdb/platform": "0.22.89-experimental.sync-table-fixes.20282627123.1",
98
- "@instantdb/react": "0.22.89-experimental.sync-table-fixes.20282627123.1",
99
- "@instantdb/core": "0.22.89-experimental.sync-table-fixes.20282627123.1",
100
- "@instantdb/version": "0.22.89-experimental.sync-table-fixes.20282627123.1"
95
+ "@instantdb/admin": "0.22.89-experimental.uuidfix.20282483875.1",
96
+ "@instantdb/version": "0.22.89-experimental.uuidfix.20282483875.1",
97
+ "@instantdb/platform": "0.22.89-experimental.uuidfix.20282483875.1",
98
+ "@instantdb/core": "0.22.89-experimental.uuidfix.20282483875.1",
99
+ "@instantdb/react": "0.22.89-experimental.uuidfix.20282483875.1"
101
100
  },
102
101
  "scripts": {
103
102
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -55,10 +55,10 @@ export const ExplorerLayout = ({
55
55
  props.className,
56
56
  )}
57
57
  >
58
- <Dialog title="Recently Deleted Namespaces" {...recentlyDeletedNsDialog}>
58
+ <Dialog {...recentlyDeletedNsDialog}>
59
59
  <RecentlyDeletedNamespaces appId={props.appId} db={db} />
60
60
  </Dialog>
61
- <Dialog title="New Namespace" {...newNsDialog}>
61
+ <Dialog {...newNsDialog}>
62
62
  <NewNamespaceDialog
63
63
  db={db}
64
64
  onClose={(p) => {
@@ -120,20 +120,12 @@ export const Explorer = (_props: WithOptional<ExplorerProps>) => {
120
120
  const [_explorerState, _setExplorerState] = useState<ExplorerNav | null>(
121
121
  null,
122
122
  );
123
-
124
123
  const props: WithDefaults<ExplorerProps> = fillPropsWithDefaults(
125
124
  _props,
126
125
  _explorerState,
127
126
  _setExplorerState,
128
127
  );
129
128
 
130
- if (!props.adminToken) {
131
- throw new Error('adminToken is required for explorer');
132
- }
133
- if (!props.appId) {
134
- throw new Error('appId is required for explorer');
135
- }
136
-
137
129
  // inside the component avoid setting explorer state directly
138
130
  // if change could be useful for history
139
131
  const { explorerState, setExplorerState } = props;
@@ -8,10 +8,6 @@ import {
8
8
  useSensor,
9
9
  useSensors,
10
10
  } from '@dnd-kit/core';
11
- import { markdownTable } from 'markdown-table';
12
-
13
- import { mkConfig, generateCsv, download } from 'export-to-csv';
14
-
15
11
  import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';
16
12
  import {
17
13
  arrayMove,
@@ -81,7 +77,6 @@ import { ViewSettings } from './view-settings';
81
77
  import { isObject } from 'lodash';
82
78
  import { EditNamespaceDialog } from './edit-namespace-dialog';
83
79
  import { EditRowDialog } from './edit-row-dialog';
84
- import copy from 'copy-to-clipboard';
85
80
 
86
81
  const fallbackItems: any[] = [];
87
82
 
@@ -93,147 +88,6 @@ export type TableColMeta = {
93
88
  copyable?: boolean;
94
89
  };
95
90
 
96
- function exportToCSV(
97
- rows: any[],
98
- columns: ColumnDef<any>[],
99
- namespace: string,
100
- downloadFile: boolean = false,
101
- ) {
102
- if (rows.length === 0) return;
103
-
104
- const visibleColumns = columns.filter(
105
- (col) =>
106
- col.id !== 'select-col' &&
107
- col.header !== undefined &&
108
- !(col.meta as TableColMeta | undefined)?.isLink,
109
- );
110
-
111
- const data = rows.map((row) => {
112
- const rowData: Record<string, any> = {};
113
- visibleColumns.forEach((col: any) => {
114
- const value = row[col.header];
115
- // Handle different data types
116
- if (value === null || value === undefined) {
117
- rowData[col.header] = '';
118
- } else if (typeof value === 'object') {
119
- rowData[col.header] = JSON.stringify(value);
120
- } else {
121
- rowData[col.header] = value;
122
- }
123
- });
124
- return rowData;
125
- });
126
-
127
- const csvConfig = mkConfig({
128
- fieldSeparator: ',',
129
- filename: `${namespace}_export`,
130
- decimalSeparator: '.',
131
- useKeysAsHeaders: true,
132
- });
133
-
134
- const csv = generateCsv(csvConfig)(data);
135
-
136
- if (downloadFile) {
137
- download(csvConfig)(csv);
138
- successToast('CSV file downloaded');
139
- } else {
140
- copy(csv.toString());
141
- successToast('CSV copied to clipboard');
142
- }
143
- }
144
-
145
- function exportToMarkdown(
146
- rows: any[],
147
- columns: any[],
148
- namespace: string,
149
- downloadFile: boolean = false,
150
- ) {
151
- if (rows.length === 0) return;
152
-
153
- const visibleColumns = columns.filter(
154
- (col) =>
155
- col.id !== 'select-col' &&
156
- col.header !== undefined &&
157
- !(col.meta as TableColMeta | undefined)?.isLink,
158
- );
159
-
160
- const headers = visibleColumns.map((col: any) => col.header as string);
161
-
162
- const data = rows.map((row) => {
163
- return visibleColumns.map((col: any) => {
164
- const value = row[col.header];
165
- if (value === null || value === undefined) {
166
- return ' ';
167
- } else if (typeof value === 'object') {
168
- return JSON.stringify(value);
169
- } else {
170
- return String(value);
171
- }
172
- });
173
- });
174
-
175
- const markdown = markdownTable([headers, ...data]);
176
-
177
- if (downloadFile) {
178
- const blob = new Blob([markdown], { type: 'text/markdown' });
179
- const url = URL.createObjectURL(blob);
180
- const a = document.createElement('a');
181
- a.href = url;
182
- a.download = `${namespace}_export.md`;
183
- document.body.appendChild(a);
184
- a.click();
185
- document.body.removeChild(a);
186
- URL.revokeObjectURL(url);
187
- successToast('Markdown file downloaded');
188
- } else {
189
- copy(markdown);
190
- successToast('Markdown copied to clipboard');
191
- }
192
- }
193
-
194
- function exportToJSON(
195
- rows: any[],
196
- columns: any[],
197
- namespace: string,
198
- downloadFile: boolean = false,
199
- ) {
200
- if (rows.length === 0) return;
201
-
202
- const visibleColumns = columns.filter(
203
- (col) =>
204
- col.id !== 'select-col' &&
205
- col.header !== undefined &&
206
- !(col.meta as TableColMeta | undefined)?.isLink,
207
- );
208
-
209
- const data = rows.map((row) => {
210
- const rowData: Record<string, any> = {};
211
- visibleColumns.forEach((col: any) => {
212
- const value = row[col.header];
213
- rowData[col.header] = value;
214
- });
215
- return rowData;
216
- });
217
-
218
- const json = JSON.stringify(data, null, 2);
219
-
220
- if (downloadFile) {
221
- const blob = new Blob([json], { type: 'application/json' });
222
- const url = URL.createObjectURL(blob);
223
- const a = document.createElement('a');
224
- a.href = url;
225
- a.download = `${namespace}_export.json`;
226
- document.body.appendChild(a);
227
- a.click();
228
- document.body.removeChild(a);
229
- URL.revokeObjectURL(url);
230
- successToast('JSON file downloaded');
231
- } else {
232
- copy(json);
233
- successToast('JSON copied to clipboard');
234
- }
235
- }
236
-
237
91
  export const InnerExplorer: React.FC<{
238
92
  db: InstantReactAbstractDatabase<any, any>;
239
93
  namespaces: SchemaNamespace[];
@@ -830,7 +684,6 @@ export const InnerExplorer: React.FC<{
830
684
  return (
831
685
  <>
832
686
  <Dialog
833
- title="Delete Rows"
834
687
  open={deleteDataConfirmationOpen}
835
688
  onClose={() => setDeleteDataConfirmationOpen(false)}
836
689
  >
@@ -901,7 +754,6 @@ export const InnerExplorer: React.FC<{
901
754
  ) : null}
902
755
  </Dialog>
903
756
  <Dialog
904
- title="Edit Row"
905
757
  open={addItemDialogOpen}
906
758
  onClose={() => setAddItemDialogOpen(false)}
907
759
  >
@@ -915,7 +767,6 @@ export const InnerExplorer: React.FC<{
915
767
  ) : null}
916
768
  </Dialog>
917
769
  <Dialog
918
- title="Edit Row"
919
770
  open={!!selectedEditableItem}
920
771
  onClose={() => setEditableRowId(null)}
921
772
  >
@@ -929,7 +780,6 @@ export const InnerExplorer: React.FC<{
929
780
  ) : null}
930
781
  </Dialog>
931
782
  <Dialog
932
- title="Edit Namespace"
933
783
  stopFocusPropagation={true}
934
784
  open={Boolean(editNs)}
935
785
  onClose={() => setEditNs(null)}
@@ -1236,12 +1086,12 @@ export const InnerExplorer: React.FC<{
1236
1086
  allItems,
1237
1087
  checkedIds,
1238
1088
  );
1239
- exportToCSV(
1240
- selectedRows,
1241
- columns,
1242
- selectedNamespace.name,
1243
- isShiftPressed,
1244
- );
1089
+ // exportToCSV(
1090
+ // selectedRows,
1091
+ // columns,
1092
+ // selectedNamespace.name,
1093
+ // isShiftPressed,
1094
+ // );
1245
1095
  setDropdownOpen(false);
1246
1096
  }}
1247
1097
  className="flex items-center gap-2"
@@ -1256,12 +1106,12 @@ export const InnerExplorer: React.FC<{
1256
1106
  allItems,
1257
1107
  checkedIds,
1258
1108
  );
1259
- exportToMarkdown(
1260
- selectedRows,
1261
- columns,
1262
- selectedNamespace.name,
1263
- isShiftPressed,
1264
- );
1109
+ // exportToMarkdown(
1110
+ // selectedRows,
1111
+ // columns,
1112
+ // selectedNamespace.name,
1113
+ // isShiftPressed,
1114
+ // );
1265
1115
  setDropdownOpen(false);
1266
1116
  }}
1267
1117
  className="flex items-center gap-2"
@@ -1278,12 +1128,12 @@ export const InnerExplorer: React.FC<{
1278
1128
  allItems,
1279
1129
  checkedIds,
1280
1130
  );
1281
- exportToJSON(
1282
- selectedRows,
1283
- columns,
1284
- selectedNamespace.name,
1285
- isShiftPressed,
1286
- );
1131
+ // exportToJSON(
1132
+ // selectedRows,
1133
+ // columns,
1134
+ // selectedNamespace.name,
1135
+ // isShiftPressed,
1136
+ // );
1287
1137
  setDropdownOpen(false);
1288
1138
  }}
1289
1139
  className="flex items-center gap-2"
@@ -25,7 +25,6 @@ export const ViewSettings = ({
25
25
  onClick={() => setDialogOpen(true)}
26
26
  />
27
27
  <Dialog
28
- title="Explorer View Settings"
29
28
  hideCloseButton={true}
30
29
  onClose={() => setDialogOpen(false)}
31
30
  open={dialogOpen}
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
  import { Toaster, toast } from 'sonner';
3
- import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
4
3
  import { Editor, Monaco, OnMount } from '@monaco-editor/react';
5
4
  import type { ClassValue } from 'clsx';
6
5
  import clsx from 'clsx';
@@ -636,7 +635,6 @@ function DialogContent({
636
635
  className,
637
636
  children,
638
637
  showCloseButton = false,
639
- title,
640
638
  ...props
641
639
  }: React.ComponentProps<typeof DialogPrimitive.Content> & {
642
640
  showCloseButton?: boolean;
@@ -656,9 +654,6 @@ function DialogContent({
656
654
  )}
657
655
  {...props}
658
656
  >
659
- <VisuallyHidden>
660
- <DialogTitle>{title}</DialogTitle>
661
- </VisuallyHidden>
662
657
  {children}
663
658
  {showCloseButton && (
664
659
  <DialogPrimitive.Close
@@ -682,13 +677,11 @@ export function Dialog({
682
677
  children,
683
678
  onClose,
684
679
  className,
685
- title,
686
680
  stopFocusPropagation = false,
687
681
  hideCloseButton = false,
688
682
  }: {
689
683
  open: boolean;
690
684
  children: React.ReactNode;
691
- title: string;
692
685
  onClose: () => void;
693
686
  className?: string;
694
687
  stopFocusPropagation?: boolean;
@@ -704,7 +697,6 @@ export function Dialog({
704
697
  open={open}
705
698
  >
706
699
  <DialogContent
707
- title={title}
708
700
  onFocusCapture={(e) => {
709
701
  if (stopFocusPropagation) {
710
702
  e.stopPropagation();
@@ -1541,7 +1533,6 @@ export function Fence({
1541
1533
  import * as SwitchPrimitive from '@radix-ui/react-switch';
1542
1534
  import { rosePineDawnTheme } from './rosePineDawnTheme';
1543
1535
  import { useShadowRoot, useShadowDarkMode } from './StyleMe';
1544
- import { DialogTitle } from '@radix-ui/react-dialog';
1545
1536
  function Switch({
1546
1537
  className,
1547
1538
  ...props