@ai-matrx/records-ui 0.101.30 → 0.101.31

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
@@ -4394,13 +4394,31 @@ function BindingDetails({
4394
4394
  }
4395
4395
 
4396
4396
  // src/PickedSummaries.tsx
4397
- var import_react35 = require("@ai-matrx/records/react");
4397
+ var import_react36 = require("@ai-matrx/records/react");
4398
4398
 
4399
4399
  // src/values.tsx
4400
4400
  var import_data_table4 = require("@ai-matrx/design-system/data-table");
4401
4401
  var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
4402
4402
  var import_design_system20 = require("@ai-matrx/design-system");
4403
4403
 
4404
+ // src/embeddedLook.tsx
4405
+ var import_react34 = require("react");
4406
+ var EmbeddedLookContext = (0, import_react34.createContext)(null);
4407
+ var EmbeddedLookProvider = EmbeddedLookContext.Provider;
4408
+ function useEmbeddedLook() {
4409
+ return (0, import_react34.useContext)(EmbeddedLookContext);
4410
+ }
4411
+ var EMBEDDED_TABLE_CLASS = [
4412
+ "[&_tbody_td]:h-10",
4413
+ "[&_tbody_td]:align-middle!",
4414
+ "[&_tbody_td]:border-r",
4415
+ "[&_tbody_td]:border-border",
4416
+ "[&_tbody_td:last-child]:border-r-0",
4417
+ "[&_thead_th]:border-r",
4418
+ "[&_thead_th]:border-border",
4419
+ "[&_thead_th:last-child]:border-r-0"
4420
+ ].join(" ");
4421
+
4404
4422
  // src/enumLabels.ts
4405
4423
  function exhaustiveValuesOf() {
4406
4424
  return function(values) {
@@ -4436,7 +4454,7 @@ var ABSENCE_WORD_LABEL = {
4436
4454
  var import_core2 = require("@ai-matrx/records/core");
4437
4455
 
4438
4456
  // src/WholeValue.tsx
4439
- var import_react34 = require("react");
4457
+ var import_react35 = require("react");
4440
4458
  var import_core = require("@ai-matrx/records/core");
4441
4459
  var import_design_system18 = require("@ai-matrx/design-system");
4442
4460
  var import_jsx_runtime21 = require("react/jsx-runtime");
@@ -4533,10 +4551,39 @@ function referencesOf(field, value, kind, labels) {
4533
4551
  }
4534
4552
  var ARCHIVED_REFERENCE_WORD = "Archived";
4535
4553
  var ARCHIVED_REFERENCE_TIP = "In the Archived view; restore it to use it again";
4554
+ function PageGlyph() {
4555
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "data-records-page-glyph": "", children: [
4556
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4557
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
4558
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M10 13H8" }),
4559
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 17H8" })
4560
+ ] });
4561
+ }
4536
4562
  function ReferenceChip({ reference, waiting }) {
4537
4563
  const host = useRecordsUi();
4538
4564
  const words = reference.label ?? (reference.token === "record" ? waiting ?? "Loading\u2026" : WITHHELD_ENTITY_LABEL);
4539
4565
  const drawn = host.renderReference ? host.renderReference({ ...reference, label: reference.label ?? words }) : null;
4566
+ const look = useEmbeddedLook();
4567
+ if (look?.plainRelation) {
4568
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4569
+ "span",
4570
+ {
4571
+ className: (0, import_design_system19.cn)(
4572
+ "inline-flex max-w-full min-w-0 items-center gap-1.5 text-sm text-foreground hover:underline [&_a]:text-inherit [&_a]:no-underline [&_a:hover]:underline",
4573
+ reference.archived && "opacity-70"
4574
+ ),
4575
+ "data-records-reference-chip": reference.token,
4576
+ "data-records-reference-plain": "",
4577
+ "data-records-reference-archived": reference.archived ? "" : void 0,
4578
+ title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
4579
+ children: [
4580
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: reference.icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PageGlyph, {}) }),
4581
+ drawn ?? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate", children: words }),
4582
+ reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4583
+ ]
4584
+ }
4585
+ );
4586
+ }
4540
4587
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4541
4588
  import_design_system19.Badge,
4542
4589
  {
@@ -4690,7 +4737,7 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4690
4737
  "data-records-choice-chip": "",
4691
4738
  ...chip.tinted ? { "data-records-choice-tint": "" } : {},
4692
4739
  children: [
4693
- look?.choiceDot ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": "true", "data-records-choice-dot": "", className: (0, import_design_system20.cn)("mr-1.5 inline-block size-1.5 shrink-0 rounded-full", chip.dot) }) : null,
4740
+ look?.choiceDot ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": "true", "data-matrx-pill-ink": "", "data-records-choice-dot": "", className: (0, import_design_system20.cn)("mr-1.5 inline-block size-1.5 shrink-0 rounded-full", chip.dot) }) : null,
4694
4741
  statusMark(field, item, Array.isArray(value) ? void 0 : document2),
4695
4742
  scalarText(field, item, labels, Array.isArray(value) ? void 0 : stillWaitingFor)
4696
4743
  ]
@@ -4811,7 +4858,7 @@ function ColumnValuesText({
4811
4858
  );
4812
4859
  }
4813
4860
  function ColumnValuesWords({ tableId, value }) {
4814
- const fields = (0, import_react35.useFields)(tableId);
4861
+ const fields = (0, import_react36.useFields)(tableId);
4815
4862
  const labels = useRecordLabels(fields.data ?? void 0);
4816
4863
  if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2026" });
4817
4864
  if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "Couldn't load this table's columns" });
@@ -4850,8 +4897,8 @@ function RecordNameText({
4850
4897
  );
4851
4898
  }
4852
4899
  function RecordNameWords({ tableId, recordId }) {
4853
- const table = (0, import_react35.useTable)(tableId);
4854
- const record = (0, import_react35.useRecord)(recordId);
4900
+ const table = (0, import_react36.useTable)(tableId);
4901
+ const record = (0, import_react36.useRecord)(recordId);
4855
4902
  if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2026" });
4856
4903
  if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "Couldn't load this record" });
4857
4904
  if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "A record you cannot open" });
@@ -4859,19 +4906,19 @@ function RecordNameWords({ tableId, recordId }) {
4859
4906
  }
4860
4907
 
4861
4908
  // src/HeldChangeDecision.tsx
4862
- var import_react36 = require("react");
4863
- var import_react37 = require("@ai-matrx/records/react");
4909
+ var import_react37 = require("react");
4910
+ var import_react38 = require("@ai-matrx/records/react");
4864
4911
  var import_design_system21 = require("@ai-matrx/design-system");
4865
4912
  var import_jsx_runtime25 = require("react/jsx-runtime");
4866
4913
  function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided }) {
4867
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react37.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Decision, { approvalId, onDecided }) });
4914
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react38.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Decision, { approvalId, onDecided }) });
4868
4915
  }
4869
4916
  function Decision({ approvalId, onDecided }) {
4870
- const client = (0, import_react37.useRecordsClient)();
4871
- const [may, setMay] = (0, import_react36.useState)(null);
4872
- const [busy, setBusy] = (0, import_react36.useState)(null);
4873
- const [error, setError] = (0, import_react36.useState)(null);
4874
- (0, import_react36.useEffect)(() => {
4917
+ const client = (0, import_react38.useRecordsClient)();
4918
+ const [may, setMay] = (0, import_react37.useState)(null);
4919
+ const [busy, setBusy] = (0, import_react37.useState)(null);
4920
+ const [error, setError] = (0, import_react37.useState)(null);
4921
+ (0, import_react37.useEffect)(() => {
4875
4922
  let live = true;
4876
4923
  void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
4877
4924
  if (!live) return;