@ai-matrx/records-ui 0.116.15 → 0.116.16
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 +25 -1
- package/dist/{chunk-E5HKO5LT.js → chunk-QVTYE4XU.js} +26 -15
- package/dist/chunk-QVTYE4XU.js.map +1 -0
- package/dist/{chunk-6WDNTT2G.js → chunk-WETGQ7P3.js} +66 -10
- package/dist/chunk-WETGQ7P3.js.map +1 -0
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +1 -1
- package/dist/helpers.d.ts +1 -1
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +2824 -2683
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -9
- package/dist/index.d.ts +31 -9
- package/dist/index.js +2521 -2420
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +21 -11
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/dist/skeleton.cjs +64 -8
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.d.cts +48 -1
- package/dist/skeleton.d.ts +48 -1
- package/dist/skeleton.js +25 -1
- package/package.json +4 -4
- package/dist/chunk-6WDNTT2G.js.map +0 -1
- package/dist/chunk-E5HKO5LT.js.map +0 -1
package/dist/pickers.cjs
CHANGED
|
@@ -6722,8 +6722,15 @@ function numberOf(value) {
|
|
|
6722
6722
|
function Swatch({ color, className }) {
|
|
6723
6723
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": true, className: (0, import_design_system15.cn)("inline-block h-4 w-4 shrink-0 rounded border border-border", className), style: { backgroundColor: color } });
|
|
6724
6724
|
}
|
|
6725
|
-
function
|
|
6726
|
-
const
|
|
6725
|
+
function colorPairGround(format, context) {
|
|
6726
|
+
const fixed = format.options?.contrastWith;
|
|
6727
|
+
if (fixed?.readsOnField) return context?.ground ?? null;
|
|
6728
|
+
if (context?.ground) return context.ground;
|
|
6729
|
+
if (!fixed || !fixed.light && !fixed.dark) return null;
|
|
6730
|
+
return { ...fixed.light ? { light: fixed.light } : {}, ...fixed.dark ? { dark: fixed.dark } : {}, label: fixed.label ?? "its background" };
|
|
6731
|
+
}
|
|
6732
|
+
function colorPairContrast(pair, format, context) {
|
|
6733
|
+
const ground = colorPairGround(format, context);
|
|
6727
6734
|
if (!ground) return {};
|
|
6728
6735
|
const out = {};
|
|
6729
6736
|
if (ground.light) {
|
|
@@ -6858,11 +6865,11 @@ function ColorPairPreview({ value }) {
|
|
|
6858
6865
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex items-end p-2", style: { backgroundColor: pair.dark ?? pair.light }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rounded bg-background px-1.5 py-0.5 text-xs text-foreground", children: "Dark" }) })
|
|
6859
6866
|
] });
|
|
6860
6867
|
}
|
|
6861
|
-
function colorPairChecks(value, format) {
|
|
6868
|
+
function colorPairChecks(value, format, context) {
|
|
6862
6869
|
const pair = (0, import_field_formats3.readColorPair)(value);
|
|
6863
6870
|
if (!pair) return [];
|
|
6864
|
-
const contrast = colorPairContrast(pair, format);
|
|
6865
|
-
const ground = format
|
|
6871
|
+
const contrast = colorPairContrast(pair, format, context);
|
|
6872
|
+
const ground = colorPairGround(format, context)?.label ?? "its background";
|
|
6866
6873
|
const out = [];
|
|
6867
6874
|
for (const part of ["light", "dark"]) {
|
|
6868
6875
|
const ratio = contrast[part];
|
|
@@ -7713,10 +7720,7 @@ function LinkPreviewCard({ url, children }) {
|
|
|
7713
7720
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: shown2.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
|
|
7714
7721
|
) : null,
|
|
7715
7722
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
7716
|
-
shown2.faviconUrl
|
|
7717
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
7718
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: shown2.faviconUrl, alt: "", className: "h-3.5 w-3.5 shrink-0", referrerPolicy: "no-referrer" })
|
|
7719
|
-
) : null,
|
|
7723
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system20.SiteIcon, { site: url, iconUrl: shown2.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
7720
7724
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
|
|
7721
7725
|
] }),
|
|
7722
7726
|
shown2.title ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
|
|
@@ -12374,7 +12378,7 @@ function waitingRunsOf(pressed) {
|
|
|
12374
12378
|
return out;
|
|
12375
12379
|
}
|
|
12376
12380
|
var stop2 = (event) => event.stopPropagation();
|
|
12377
|
-
function ButtonValue({ field, recordId, inCell }) {
|
|
12381
|
+
function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
12378
12382
|
const client = (0, import_react67.useOptionalRecordsClient)();
|
|
12379
12383
|
const b = (0, import_records26.buttonOf)(field);
|
|
12380
12384
|
const [busy, setBusy] = (0, import_react66.useState)(false);
|
|
@@ -12388,6 +12392,12 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
12388
12392
|
(0, import_react66.useEffect)(() => () => void (waitingOn.current += 1), []);
|
|
12389
12393
|
if (!b) return null;
|
|
12390
12394
|
const color = (0, import_data_table6.isStyleColor)(b.color) ? import_data_table6.CHOICE_CHIP_CLASS[b.color] : import_data_table6.NEUTRAL_CHIP_CLASS;
|
|
12395
|
+
if (beforeSave) {
|
|
12396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-2", "data-records-button-before-save": field.key, children: [
|
|
12397
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system39.Button, { type: "button", size: "xs", variant: "outline", disabled: true, "aria-describedby": `${field.key}-before-save`, "data-records-button": field.key, className: (0, import_design_system39.cn)("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "truncate", children: b.label }) }),
|
|
12398
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { id: `${field.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
|
|
12399
|
+
] });
|
|
12400
|
+
}
|
|
12391
12401
|
const needs = (0, import_records26.buttonNeeds)(b);
|
|
12392
12402
|
const tableId = field.entity_definition_id;
|
|
12393
12403
|
const press = async () => {
|
|
@@ -13137,7 +13147,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
13137
13147
|
const ownDetails = (0, import_react72.useOptionalRecordsClient)() === null;
|
|
13138
13148
|
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
13139
13149
|
if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
13140
|
-
if ((0, import_records28.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ButtonValue, { field });
|
|
13150
|
+
if ((0, import_records28.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ButtonValue, { field, recordId: recordId ?? null, beforeSave: !recordId });
|
|
13141
13151
|
const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
|
|
13142
13152
|
if (newerControl !== void 0) return newerControl;
|
|
13143
13153
|
const format = formatForField(field);
|