@updog/data-editor 0.1.95 → 0.1.97

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/index.d.ts CHANGED
@@ -418,6 +418,7 @@ declare var export_default = {
418
418
  invalidEmail: "Invalid email address",
419
419
  invalidFormat: "Invalid format",
420
420
  invalidNumber: "Invalid number",
421
+ invalidPhone: "Invalid phone number",
421
422
  invalidOption: "Invalid option",
422
423
  invalidTime: "Invalid time",
423
424
  invalidUrl: "Invalid URL",
@@ -567,11 +568,15 @@ declare var export_default = {
567
568
  },
568
569
  },
569
570
  chat: {
570
- emptyTitle: "What would you like to fix?",
571
- header: "Chat with AI",
571
+ cancelRequest: "Cancel request",
572
572
  inputLabel: "Ask AI about your data",
573
573
  placeholder: "Ask AI...",
574
+ requestCancelled: "Cancelled",
575
+ requestDone: "Applied",
576
+ requestFailed: "Failed",
574
577
  send: "Send",
578
+ toggle: "AI",
579
+ toggleLabel: "Toggle AI assistant",
575
580
  },
576
581
  common: {
577
582
  cancel: "Cancel",
@@ -782,6 +787,22 @@ type EmailEditorCell = {
782
787
  type UrlEditorCell = {
783
788
  type: "url";
784
789
  };
790
+ /**
791
+ * Phone cell. A plain text input; the column is checked against
792
+ * `{ type: "phone" }` even when it declares no validator. On the way in a
793
+ * number is read with libphonenumber and stored in E.164 (`+4915112345678`);
794
+ * the screen shows it spaced (`+49 1511 2345678`). What does not read as
795
+ * one possible number stays as it came, trimmed, and is flagged.
796
+ */
797
+ type PhoneEditorCell = {
798
+ type: "phone";
799
+ /**
800
+ * ISO 3166-1 alpha-2 region a number without a country code belongs to,
801
+ * `"DE"`. Omitted: only numbers carrying `+` (or digits that read as
802
+ * `+digits`) are recognised.
803
+ */
804
+ defaultRegion?: string;
805
+ };
785
806
  /** Date picker cell. Bounds come from the column's `{ type: "date" }` validator. */
786
807
  type DateEditorCell = {
787
808
  type: "date";
@@ -882,6 +903,7 @@ type NumberEditorCell = {
882
903
  * - `"text"` — plain text input (default).
883
904
  * - `"email"` — plain text input; the column is checked against `{ type: "email" }`, spaces cut and the domain lower-cased on the way in.
884
905
  * - `"url"` — plain text input; the column is checked against `{ type: "url" }`, a bare host such as `acme.com` becomes `https://acme.com` on the way in.
906
+ * - `"phone"` — plain text input; the column is checked against `{ type: "phone" }`, a number is stored in E.164 and shown spaced.
885
907
  * - `"date"` — date picker; the calendar honours the column's date validator bounds.
886
908
  * - `"time"` — plain text input for a time of day; the column is checked against `{ type: "time" }`.
887
909
  * - `"select"` — dropdown with a fixed list of options.
@@ -891,7 +913,7 @@ type NumberEditorCell = {
891
913
  * - `"number"` — number input with locale-aware formatting.
892
914
  * - `"boolean"` — stores a real `true`/`false`; reads yes/no, 1/0, on/off and Excel's localized TRUE/FALSE.
893
915
  */
894
- type CellEditor = TextEditorCell | EmailEditorCell | UrlEditorCell | DateEditorCell | TimeEditorCell | SelectEditorCell | MultiSelectEditorCell | CountryEditorCell | CurrencyEditorCell | NumberEditorCell | BooleanEditorCell;
916
+ type CellEditor = TextEditorCell | EmailEditorCell | UrlEditorCell | PhoneEditorCell | DateEditorCell | TimeEditorCell | SelectEditorCell | MultiSelectEditorCell | CountryEditorCell | CurrencyEditorCell | NumberEditorCell | BooleanEditorCell;
895
917
  /** Dropdown filter shown in the sidebar Filters panel. */
896
918
  type SelectColumnFilter = {
897
919
  type: "select";
@@ -1059,6 +1081,11 @@ type BuiltInValidator = {
1059
1081
  | {
1060
1082
  type: "url";
1061
1083
  message?: string;
1084
+ }
1085
+ /** The cell holds one possible phone number in E.164. Implicit on every phone column. */
1086
+ | {
1087
+ type: "phone";
1088
+ message?: string;
1062
1089
  } | {
1063
1090
  type: "date";
1064
1091
  min?: string;
@@ -1235,10 +1262,17 @@ type ChatErrorSummary = {
1235
1262
  examples: string[];
1236
1263
  };
1237
1264
  /**
1238
- * Context about the current dataset, passed to `loadSuggestions` and extended
1239
- * into `ChatContext` for `onMessage`.
1265
+ * The full context passed to `DataEditorChat.onMessage` when the user sends
1266
+ * a prompt. Includes the prompt itself and all dataset context.
1240
1267
  */
1241
- type ChatDataContext<TRow extends DataEditorRow = DataEditorRow> = {
1268
+ type ChatContext<TRow extends DataEditorRow = DataEditorRow> = {
1269
+ /** The user's chat prompt. */
1270
+ message: string;
1271
+ /**
1272
+ * Aborted when the user cancels the request. Pass it to `fetch` so the
1273
+ * in-flight call stops; the SDK stops reading the stream on its own.
1274
+ */
1275
+ signal: AbortSignal;
1242
1276
  /** Full column definitions. */
1243
1277
  columns: DataEditorColumn[];
1244
1278
  /** Row identifier field, or the list of fields that identify a row together. */
@@ -1254,19 +1288,11 @@ type ChatDataContext<TRow extends DataEditorRow = DataEditorRow> = {
1254
1288
  /** Access all rows. Use for full-dataset operations. */
1255
1289
  getRows: () => ChatRow<TRow>[];
1256
1290
  };
1257
- /**
1258
- * The full context passed to `DataEditorChat.onMessage` when the user sends
1259
- * a prompt. Includes the prompt itself and all dataset context.
1260
- */
1261
- type ChatContext<TRow extends DataEditorRow = DataEditorRow> = ChatDataContext<TRow> & {
1262
- /** The user's chat prompt. */
1263
- message: string;
1264
- };
1265
1291
  /**
1266
1292
  * Bring-your-own-AI chat configuration. When provided via the `chat` prop,
1267
- * the editor shows a chat panel alongside the grid. You own the AI
1268
- * integration; the SDK hands you dataset context and renders the streamed
1269
- * response.
1293
+ * the editor footer gains an AI button that opens the assistant over the grid.
1294
+ * You own the AI integration; the SDK hands you dataset context, applies the
1295
+ * streamed row changes and shows each request with its status.
1270
1296
  *
1271
1297
  * @example
1272
1298
  * ```ts
@@ -1296,19 +1322,16 @@ type DataEditorChat<TRow extends DataEditorRow = DataEditorRow> = {
1296
1322
  * representative slice including rows with errors. When omitted, the SDK decides.
1297
1323
  */
1298
1324
  sampleSize?: number;
1299
- /** Title shown above the suggestion list when the chat is empty. */
1300
- emptyTitle?: string;
1301
- /** How many suggestions to request from `loadSuggestions`. */
1302
- suggestionsCount?: number;
1303
- /** Optional prompt generator for the empty-state suggestion chips. */
1304
- loadSuggestions?: (context: ChatDataContext<TRow>) => Promise<string[]>;
1305
1325
  /**
1306
1326
  * Called when the user sends a message. Receives full dataset context.
1307
1327
  * Returns an async iterable of response chunks — the SDK streams them
1308
1328
  * into the UI.
1309
1329
  */
1310
1330
  onMessage: (context: ChatContext<TRow>) => AsyncIterable<ChatResponseChunk<TRow>>;
1311
- /** Called when the user cancels a pending request. Use to abort your API call. */
1331
+ /**
1332
+ * Called when the user cancels a pending request, after `context.signal`
1333
+ * is aborted. Use for cleanup the signal cannot reach.
1334
+ */
1312
1335
  onCancel?: () => void;
1313
1336
  };
1314
1337