@ai-matrx/records-ui 0.116.16 → 0.116.17

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
@@ -6928,17 +6928,50 @@ function NumberBox({
6928
6928
  function unitOf(format) {
6929
6929
  return format.options?.unit ?? "px";
6930
6930
  }
6931
+ function MeasureMini({ px, kind }) {
6932
+ if (kind === "spacing") {
6933
+ const gap = Math.max(1, Math.min(px, 48));
6934
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "aria-hidden": true, "data-records-measure-mini": "spacing", className: "inline-flex h-4 shrink-0 items-center", children: [
6935
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "h-4 w-2.5 rounded-sm border border-border bg-muted" }),
6936
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { width: gap } }),
6937
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "h-4 w-2.5 rounded-sm border border-border bg-muted" })
6938
+ ] });
6939
+ }
6940
+ if (kind === "radius") {
6941
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6942
+ "span",
6943
+ {
6944
+ "aria-hidden": true,
6945
+ "data-records-measure-mini": "radius",
6946
+ className: "inline-block h-5 w-5 shrink-0 border-2 border-foreground bg-card",
6947
+ style: { borderRadius: Math.min(px, 10) }
6948
+ }
6949
+ );
6950
+ }
6951
+ return null;
6952
+ }
6931
6953
  function MeasureView({ value, format }) {
6932
6954
  const n = numberOf(value);
6933
6955
  if (n === null) return null;
6934
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "data-records-look": "measure", className: "tabular-nums", children: [
6935
- n,
6936
- " ",
6937
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: unitOf(format) })
6956
+ const px = pixels(n, unitOf(format));
6957
+ const kind = format.options?.measurePreview ?? "none";
6958
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "data-records-look": "measure", className: "inline-flex items-center gap-2 tabular-nums", children: [
6959
+ px !== null && (kind === "spacing" || kind === "radius") ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MeasureMini, { px, kind }) : null,
6960
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
6961
+ n,
6962
+ " ",
6963
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: unitOf(format) })
6964
+ ] })
6938
6965
  ] });
6939
6966
  }
6940
6967
  function MeasureEditor({ value, format, onChange, disabled, id, label }) {
6941
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NumberBox, { id, label, value: numberOf(value), unit: unitOf(format), disabled, className: "w-full max-w-40", onChange });
6968
+ const n = numberOf(value);
6969
+ const px = n === null ? null : pixels(n, unitOf(format));
6970
+ const kind = format.options?.measurePreview ?? "none";
6971
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex items-center gap-2", children: [
6972
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NumberBox, { id, label, value: n, unit: unitOf(format), disabled, className: "w-full max-w-40", onChange }),
6973
+ px !== null && (kind === "spacing" || kind === "radius") ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MeasureMini, { px, kind }) : null
6974
+ ] });
6942
6975
  }
6943
6976
  function pixels(n, unit) {
6944
6977
  if (unit === "px" || unit === "pt") return n;
@@ -11148,6 +11181,25 @@ function FieldEditor(props) {
11148
11181
  const watchStart = (0, import_react64.useMemo)(() => watchedFieldsOf(start), [start]);
11149
11182
  const [watchFields, setWatchFields] = (0, import_react64.useState)(watchStart);
11150
11183
  const [dependency, setDependency] = (0, import_react64.useState)(dependencyStart);
11184
+ const [notifyStart, setNotifyStart] = (0, import_react64.useState)(field ? null : false);
11185
+ const [notify, setNotify] = (0, import_react64.useState)(false);
11186
+ const [notifyReadError, setNotifyReadError] = (0, import_react64.useState)(null);
11187
+ const personColumn = !onEntity && type === "member";
11188
+ (0, import_react64.useEffect)(() => {
11189
+ if (!field || onEntity || type !== "member") return;
11190
+ let live = true;
11191
+ void client.fieldNotifyOnAssign({ field_id: field.id, on: null }).then((got) => {
11192
+ if (!live) return;
11193
+ if (got.ok) {
11194
+ setNotifyStart(got.data.notify_on_assign === true);
11195
+ setNotify(got.data.notify_on_assign === true);
11196
+ setNotifyReadError(null);
11197
+ } else setNotifyReadError(got.error);
11198
+ });
11199
+ return () => {
11200
+ live = false;
11201
+ };
11202
+ }, [client, field, onEntity, type]);
11151
11203
  (0, import_react64.useEffect)(() => {
11152
11204
  if (!field || type !== "status") return;
11153
11205
  let live = true;
@@ -11360,7 +11412,16 @@ function FieldEditor(props) {
11360
11412
  return;
11361
11413
  }
11362
11414
  const written2 = await tableMutation.update({ field_id: field.id, patch });
11363
- if (written2 !== null) onSaved?.();
11415
+ if (written2 === null) return;
11416
+ if (personColumn && notifyStart !== null && notify !== notifyStart) {
11417
+ const told = await client.fieldNotifyOnAssign({ field_id: field.id, on: notify });
11418
+ if (!told.ok) {
11419
+ setBackfillError(told.error);
11420
+ return;
11421
+ }
11422
+ setNotifyStart(notify);
11423
+ }
11424
+ onSaved?.();
11364
11425
  return;
11365
11426
  }
11366
11427
  const spec = {
@@ -11440,6 +11501,13 @@ function FieldEditor(props) {
11440
11501
  return;
11441
11502
  }
11442
11503
  }
11504
+ if (personColumn && notify) {
11505
+ const told = await client.fieldNotifyOnAssign({ field_id: written, on: true });
11506
+ if (!told.ok) {
11507
+ setBackfillError(told.error);
11508
+ return;
11509
+ }
11510
+ }
11443
11511
  setBackfillError(null);
11444
11512
  if (type === "relation" && relationTarget === tableId && dependency && !onEntity) {
11445
11513
  const marked = await client.fieldUpdate({ field_id: written, patch: { dependency: true } });
@@ -11635,6 +11703,20 @@ function FieldEditor(props) {
11635
11703
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system38.Checkbox, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
11636
11704
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Waits on the linked records" })
11637
11705
  ] }) : null,
11706
+ personColumn ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "Each person added to this column gets a notice", children: [
11707
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11708
+ import_design_system38.Checkbox,
11709
+ {
11710
+ checked: notify,
11711
+ disabled: notifyStart === null,
11712
+ "aria-label": "Notify people when they're added",
11713
+ "data-records-notify-on-assign": "",
11714
+ onCheckedChange: (v) => setNotify(v === true)
11715
+ }
11716
+ ),
11717
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Notify people when they're added" })
11718
+ ] }) : null,
11719
+ notifyReadError ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RefusalNotice, { error: notifyReadError }) : null,
11638
11720
  type === "rollup" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11639
11721
  RollupFilterQuestion,
11640
11722
  {