@ai-matrx/records-ui 0.115.77 → 0.115.79

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
@@ -4032,46 +4032,63 @@ function AttachmentChip({ id, onRemove, onPreview }) {
4032
4032
  const words = read?.name ?? (read ? FILE_CHIP_UNREAD : "\u2026");
4033
4033
  const href = read?.fileId ? host.hrefForFile?.({ fileId: read.fileId }) : void 0;
4034
4034
  const title = onPreview ? `Preview ${words}` : href ? `Open ${words}` : read?.why ?? FILE_CHIP_NO_PAGE;
4035
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_design_system19.Badge, { variant: "secondary", className: "max-w-[14rem] gap-1 text-[11px]", "data-records-file-chip": id, title, children: [
4036
- onPreview ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4037
- "button",
4038
- {
4039
- type: "button",
4040
- className: "truncate underline-offset-2 hover:underline",
4041
- "data-records-file-preview": id,
4035
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4036
+ import_design_system19.Badge,
4037
+ {
4038
+ variant: "secondary",
4039
+ className: (0, import_design_system19.cn)("max-w-[14rem] gap-1 text-[11px]", onPreview && "cursor-pointer"),
4040
+ "data-records-file-chip": id,
4041
+ title,
4042
+ ...onPreview ? {
4042
4043
  onClick: (event) => {
4043
4044
  event.stopPropagation();
4044
4045
  onPreview();
4045
4046
  },
4046
4047
  onMouseDown: (event) => event.stopPropagation(),
4047
- onDoubleClick: (event) => event.stopPropagation(),
4048
- children: words
4049
- }
4050
- ) : href ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4051
- import_outbound_react4.OutboundLink,
4052
- {
4053
- href,
4054
- className: "truncate underline-offset-2 hover:underline",
4055
- "data-records-file-link": read?.fileId ?? "",
4056
- onClick: (event) => event.stopPropagation(),
4057
- onMouseDown: (event) => event.stopPropagation(),
4058
- children: words
4059
- }
4060
- ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate", children: words }),
4061
- onRemove ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4062
- "button",
4063
- {
4064
- type: "button",
4065
- "aria-label": `Remove ${words}`,
4066
- className: "shrink-0 rounded px-0.5 text-muted-foreground hover:text-foreground",
4067
- onClick: (event) => {
4068
- event.stopPropagation();
4069
- onRemove();
4070
- },
4071
- children: "\xD7"
4072
- }
4073
- ) : null
4074
- ] });
4048
+ onDoubleClick: (event) => event.stopPropagation()
4049
+ } : {},
4050
+ children: [
4051
+ onPreview ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4052
+ "button",
4053
+ {
4054
+ type: "button",
4055
+ className: "truncate underline-offset-2 hover:underline",
4056
+ "data-records-file-preview": id,
4057
+ onClick: (event) => {
4058
+ event.stopPropagation();
4059
+ onPreview();
4060
+ },
4061
+ onMouseDown: (event) => event.stopPropagation(),
4062
+ onDoubleClick: (event) => event.stopPropagation(),
4063
+ children: words
4064
+ }
4065
+ ) : href ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4066
+ import_outbound_react4.OutboundLink,
4067
+ {
4068
+ href,
4069
+ className: "truncate underline-offset-2 hover:underline",
4070
+ "data-records-file-link": read?.fileId ?? "",
4071
+ onClick: (event) => event.stopPropagation(),
4072
+ onMouseDown: (event) => event.stopPropagation(),
4073
+ children: words
4074
+ }
4075
+ ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate", children: words }),
4076
+ onRemove ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4077
+ "button",
4078
+ {
4079
+ type: "button",
4080
+ "aria-label": `Remove ${words}`,
4081
+ className: "shrink-0 rounded px-0.5 text-muted-foreground hover:text-foreground",
4082
+ onClick: (event) => {
4083
+ event.stopPropagation();
4084
+ onRemove();
4085
+ },
4086
+ children: "\xD7"
4087
+ }
4088
+ ) : null
4089
+ ]
4090
+ }
4091
+ );
4075
4092
  }
4076
4093
  function AttachmentChips({ value, onRemove }) {
4077
4094
  const host = useRecordsUi();
@@ -4112,6 +4129,18 @@ function AttachmentViewer({
4112
4129
  {
4113
4130
  className: "sm:max-w-3xl",
4114
4131
  "data-records-attachment-viewer": id,
4132
+ tabIndex: -1,
4133
+ onOpenAutoFocus: (event) => {
4134
+ event.preventDefault();
4135
+ event.currentTarget.focus();
4136
+ },
4137
+ onCloseAutoFocus: (event) => {
4138
+ const chip = document.querySelector(`[data-records-file-preview="${ids[index]}"]`);
4139
+ if (chip) {
4140
+ event.preventDefault();
4141
+ chip.focus();
4142
+ }
4143
+ },
4115
4144
  onKeyDown: (event) => {
4116
4145
  if (event.key === "ArrowLeft") {
4117
4146
  event.preventDefault();