@ai-matrx/records-ui 0.93.140 → 0.93.142

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/pickers.cjs CHANGED
@@ -407,21 +407,35 @@ function BarcodeControl({ value, onChange, disabled, id }) {
407
407
 
408
408
  // src/parity.ts
409
409
  var import_records2 = require("@ai-matrx/records");
410
+ var import_text_case = require("@ai-matrx/kit/text-case");
411
+
412
+ // src/docs.ts
413
+ function isSignatureField(field) {
414
+ return field.type === "text" && (field.format ?? "").toLowerCase() === "signature";
415
+ }
416
+
417
+ // src/parity.ts
418
+ var kernelId = (name) => import_records2.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
419
+ var KERNEL_FILE_TABLE = kernelId("File");
420
+ var KERNEL_PERSON_TABLE = kernelId("Person");
421
+ var PARITY_MADE_OF = Object.fromEntries(
422
+ import_records2.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
423
+ );
424
+ var KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
425
+ function editorKindFor(field) {
426
+ return (0, import_records2.fieldKindFor)(field, KERNEL);
427
+ }
410
428
 
411
429
  // src/names.ts
412
430
  var import_uuid = require("@ai-matrx/kit/uuid");
413
- function humanize(token) {
414
- const words = token.replace(/[_\-.]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim();
415
- if (words === "") return token;
416
- return words.charAt(0).toUpperCase() + words.slice(1);
417
- }
431
+ var import_text_case2 = require("@ai-matrx/kit/text-case");
418
432
  function fieldName(field) {
419
433
  const label = (field.label ?? "").trim();
420
- if (label !== "" && label === field.key && /^[a-z0-9]+(?:[_.-][a-z0-9]+)+$/.test(label)) return humanize(label);
434
+ if (label !== "" && label === field.key && /^[a-z0-9]+(?:[_.-][a-z0-9]+)+$/.test(label)) return (0, import_text_case2.humanizeIdentifier)(label);
421
435
  if (label !== "") return label;
422
436
  const name = (field.name ?? "").trim();
423
437
  if (name !== "") return name;
424
- return humanize(field.key);
438
+ return (0, import_text_case2.humanizeIdentifier)(field.key);
425
439
  }
426
440
  function recordName(document2, titleKey, fallback = "Untitled") {
427
441
  const data = document2 ?? {};
@@ -445,23 +459,6 @@ function rowNameIn(table, row, fallback = "Untitled") {
445
459
  }
446
460
  var WITHHELD_RECORD_LABEL = "A record you have not been given access to";
447
461
 
448
- // src/docs.ts
449
- function isSignatureField(field) {
450
- return field.type === "text" && (field.format ?? "").toLowerCase() === "signature";
451
- }
452
-
453
- // src/parity.ts
454
- var kernelId = (name) => import_records2.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
455
- var KERNEL_FILE_TABLE = kernelId("File");
456
- var KERNEL_PERSON_TABLE = kernelId("Person");
457
- var PARITY_MADE_OF = Object.fromEntries(
458
- import_records2.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
459
- );
460
- var KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
461
- function editorKindFor(field) {
462
- return (0, import_records2.fieldKindFor)(field, KERNEL);
463
- }
464
-
465
462
  // src/RelationPicker.tsx
466
463
  var import_react3 = require("react");
467
464
  var import_records3 = require("@ai-matrx/records");
@@ -4190,6 +4187,7 @@ var import_design_system18 = require("@ai-matrx/design-system");
4190
4187
 
4191
4188
  // src/kindValues.ts
4192
4189
  var import_directives = require("@ai-matrx/content-ir/directives");
4190
+ var import_text_case3 = require("@ai-matrx/kit/text-case");
4193
4191
  var KIND_KEY = "__kind";
4194
4192
  var WHOLE_FENCE = /^\s*```(?:matrx|json)?[ \t]*\r?\n?([\s\S]*?)\r?\n?[ \t]*```\s*$/;
4195
4193
  function asObject(value) {
@@ -4235,8 +4233,7 @@ function kindValueWords(kv) {
4235
4233
  return kindLabel(kv.kind);
4236
4234
  }
4237
4235
  function kindLabel(kind) {
4238
- const words = kind.replace(/^directive_v\d+_/, "").replace(/_v\d+$/, "").replace(/_/g, " ").trim();
4239
- return words ? words.charAt(0).toUpperCase() + words.slice(1) : "Structured value";
4236
+ return (0, import_text_case3.humanizeIdentifier)(kind.replace(/^directive_v\d+_/, "").replace(/_v\d+$/, "")) || "Structured value";
4240
4237
  }
4241
4238
 
4242
4239
  // src/ReferenceChips.tsx