@ai-matrx/records-ui 0.102.16 → 0.102.19
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/CHANGELOG.md +16 -0
- package/dist/index.cjs +2218 -2161
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -24
- package/dist/index.d.ts +3 -24
- package/dist/index.js +117 -60
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +26 -5
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +27 -6
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/dist/pickers.cjs
CHANGED
|
@@ -3036,7 +3036,13 @@ function ClockGlyph() {
|
|
|
3036
3036
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M12 6v6l4 2" })
|
|
3037
3037
|
] });
|
|
3038
3038
|
}
|
|
3039
|
-
function TypedDateHelper({
|
|
3039
|
+
function TypedDateHelper({
|
|
3040
|
+
kind,
|
|
3041
|
+
text,
|
|
3042
|
+
onText,
|
|
3043
|
+
label,
|
|
3044
|
+
onPicked
|
|
3045
|
+
}) {
|
|
3040
3046
|
const [open, setOpen] = (0, import_react21.useState)(false);
|
|
3041
3047
|
const held = readBox(text, kind);
|
|
3042
3048
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -3051,12 +3057,16 @@ function TypedDateHelper({ kind, text, onText, label }) {
|
|
|
3051
3057
|
const pickDay = (d) => {
|
|
3052
3058
|
const day = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
|
|
3053
3059
|
onText(wordsFor(kind, day, held.time));
|
|
3054
|
-
if (kind === "date")
|
|
3060
|
+
if (kind === "date") {
|
|
3061
|
+
setOpen(false);
|
|
3062
|
+
onPicked?.();
|
|
3063
|
+
}
|
|
3055
3064
|
};
|
|
3056
3065
|
const pickTime = (t) => {
|
|
3057
3066
|
const day = kind === "datetime" ? held.day ?? todayKey : null;
|
|
3058
3067
|
onText(wordsFor(kind, day, t));
|
|
3059
3068
|
setOpen(false);
|
|
3069
|
+
onPicked?.();
|
|
3060
3070
|
};
|
|
3061
3071
|
const turn = (by) => {
|
|
3062
3072
|
const at = new Date(shown2.y, shown2.m + by, 1);
|
|
@@ -3309,6 +3319,17 @@ function openingText(field, value) {
|
|
|
3309
3319
|
const format = formatForField(field);
|
|
3310
3320
|
return format ? typedText(format, value) : String(value);
|
|
3311
3321
|
}
|
|
3322
|
+
function ReadsAsNote({ typed, always, children }) {
|
|
3323
|
+
const note = (0, import_react24.useRef)(null);
|
|
3324
|
+
const [repeats, setRepeats] = (0, import_react24.useState)(false);
|
|
3325
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
3326
|
+
if (always) return;
|
|
3327
|
+
const words = (t) => (t ?? "").replace(/^Reads as/, "").replace(/\s+/g, "").toLowerCase();
|
|
3328
|
+
setRepeats(words(note.current?.textContent) === words(typed));
|
|
3329
|
+
}, [typed, always]);
|
|
3330
|
+
if (repeats) return null;
|
|
3331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
|
|
3332
|
+
}
|
|
3312
3333
|
function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCancel }) {
|
|
3313
3334
|
const client = (0, import_react25.useOptionalRecordsClient)();
|
|
3314
3335
|
const kind = String(editorKindFor(field));
|
|
@@ -3352,7 +3373,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
3352
3373
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
|
|
3353
3374
|
helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
3354
3375
|
box,
|
|
3355
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field) })
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field), onPicked: onCommit })
|
|
3356
3377
|
] }) : box,
|
|
3357
3378
|
judged === null ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
|
|
3358
3379
|
"Reading ",
|
|
@@ -3386,7 +3407,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
3386
3407
|
}
|
|
3387
3408
|
),
|
|
3388
3409
|
judged.cancelOnly && onCancel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-records-choice-ask": "", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
|
|
3389
|
-
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3410
|
+
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
|
|
3390
3411
|
isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field)}. ` : null,
|
|
3391
3412
|
"Reads as",
|
|
3392
3413
|
" ",
|
|
@@ -3399,7 +3420,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
3399
3420
|
const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field, judged.value) ? "datetime" : "date" } : void 0);
|
|
3400
3421
|
return shown2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
|
|
3401
3422
|
})()
|
|
3402
|
-
] })
|
|
3423
|
+
] }, value.text)
|
|
3403
3424
|
] });
|
|
3404
3425
|
}
|
|
3405
3426
|
function isPersonsName(field) {
|