@pipelex/mthds-form 0.17.0 → 0.17.1

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.
@@ -112,6 +112,7 @@ var Switch = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
112
112
  {
113
113
  className: cn(
114
114
  "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
115
+ "max-sm:relative max-sm:after:absolute max-sm:after:-inset-x-0.5 max-sm:after:-inset-y-3 max-sm:after:content-['']",
115
116
  className
116
117
  ),
117
118
  ...props,
@@ -736,7 +737,7 @@ function FileField({
736
737
  type: "button",
737
738
  disabled: busy,
738
739
  onClick: () => setShowUrl(true),
739
- className: "flex w-fit items-center gap-1 font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",
740
+ className: "flex w-fit items-center gap-1 font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50 max-sm:min-h-11",
740
741
  children: [
741
742
  /* @__PURE__ */ jsx(Link2, { className: "h-3 w-3" }),
742
743
  s.pasteUrlInstead
@@ -803,25 +804,27 @@ function FileChip({
803
804
  () => fileChipSubtitle(url, filename, formats, presentation, s),
804
805
  [url, filename, formats, presentation, s]
805
806
  );
806
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 rounded-md border border-border bg-input px-3 py-2.5", children: [
807
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md border border-border bg-input px-3 py-2.5", children: [
807
808
  /* @__PURE__ */ jsx("span", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted", children: /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4 text-muted-foreground" }) }),
808
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
809
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 basis-32 [contain:inline-size]", children: [
809
810
  /* @__PURE__ */ jsx("p", { className: "truncate text-[13px] font-medium text-foreground", children: value?.filename ?? s.uploadedFile }),
810
811
  subtitle && /* @__PURE__ */ jsx("p", { className: "truncate font-mono text-[10.5px] text-muted-foreground", children: subtitle })
811
812
  ] }),
812
- canPreview && /* @__PURE__ */ jsxs(
813
- "button",
814
- {
815
- type: "button",
816
- onClick: onTogglePreview,
817
- className: "inline-flex h-7 shrink-0 items-center gap-1 rounded-md border border-border px-2 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
818
- children: [
819
- previewOpen ? /* @__PURE__ */ jsx(EyeOff, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Eye, { className: "h-3.5 w-3.5" }),
820
- s.preview
821
- ]
822
- }
823
- ),
824
- /* @__PURE__ */ jsx(ClearButton, { disabled, onClick: onClear })
813
+ /* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-3", children: [
814
+ canPreview && /* @__PURE__ */ jsxs(
815
+ "button",
816
+ {
817
+ type: "button",
818
+ onClick: onTogglePreview,
819
+ className: "inline-flex h-7 shrink-0 items-center gap-1 rounded-md border border-border px-2 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground max-sm:h-11 max-sm:px-3",
820
+ children: [
821
+ previewOpen ? /* @__PURE__ */ jsx(EyeOff, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Eye, { className: "h-3.5 w-3.5" }),
822
+ s.preview
823
+ ]
824
+ }
825
+ ),
826
+ /* @__PURE__ */ jsx(ClearButton, { disabled, onClick: onClear })
827
+ ] })
825
828
  ] });
826
829
  }
827
830
  function ClearButton({ disabled, onClick }) {
@@ -833,7 +836,7 @@ function ClearButton({ disabled, onClick }) {
833
836
  onClick,
834
837
  disabled,
835
838
  "aria-label": s.removeFileAria,
836
- className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50",
839
+ className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50 max-sm:size-11",
837
840
  children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
838
841
  }
839
842
  );
@@ -1209,7 +1212,7 @@ function OptionalToggle({ count, expanded, onToggle, noun = "field" }) {
1209
1212
  type: "button",
1210
1213
  onClick: onToggle,
1211
1214
  "aria-expanded": expanded,
1212
- className: "flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",
1215
+ className: "flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground max-sm:min-h-11",
1213
1216
  children: [
1214
1217
  expanded ? /* @__PURE__ */ jsx(Minus, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(Plus, { className: "h-3 w-3" }),
1215
1218
  expanded ? noun === "field" ? s.hideOptionalFields : s.hideOptionalInputs : noun === "field" ? s.optionalFieldsCount(count) : s.optionalInputsCount(count)
@@ -1381,7 +1384,7 @@ function ListField({ field, value, onChange, id, error, env }) {
1381
1384
  onClick: () => removeItem(index),
1382
1385
  disabled: env?.disabled || busy,
1383
1386
  "aria-label": s.removeItemAria(index + 1),
1384
- className: "mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-destructive disabled:opacity-50",
1387
+ className: "mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-destructive disabled:opacity-50 max-sm:mt-0 max-sm:size-11",
1385
1388
  children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
1386
1389
  }
1387
1390
  )
@@ -1396,7 +1399,7 @@ function ListField({ field, value, onChange, id, error, env }) {
1396
1399
  onClick: addItem,
1397
1400
  disabled: env?.disabled || isFull,
1398
1401
  className: cn(
1399
- "inline-flex h-9 w-full items-center justify-center gap-1.5 rounded-md border border-dashed border-border text-[13px] text-muted-foreground transition-colors",
1402
+ "inline-flex h-9 w-full items-center justify-center gap-1.5 rounded-md border border-dashed border-border text-[13px] text-muted-foreground transition-colors max-sm:h-11",
1400
1403
  "hover:border-primary/40 hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"
1401
1404
  ),
1402
1405
  children: [
@@ -3613,6 +3616,7 @@ function pathLabel(url) {
3613
3616
  const segment = path.split("/").filter(Boolean).pop();
3614
3617
  return segment && segment.length > 0 ? segment : url;
3615
3618
  }
3619
+ var FILE_BUTTON_ON_A_PHONE = "max-sm:grid max-sm:size-11 max-sm:place-items-center";
3616
3620
  function CopyButton({
3617
3621
  value,
3618
3622
  provide,
@@ -3649,7 +3653,10 @@ function CopyButton({
3649
3653
  },
3650
3654
  ...title ? { title } : {},
3651
3655
  "aria-label": label,
3652
- className: "shrink-0 rounded p-0.5 text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",
3656
+ className: cn(
3657
+ "shrink-0 rounded p-0.5 text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",
3658
+ FILE_BUTTON_ON_A_PHONE
3659
+ ),
3653
3660
  children: copied ? /* @__PURE__ */ jsx(Check, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { "aria-hidden": true, className: "size-3.5" })
3654
3661
  }
3655
3662
  );
@@ -3687,7 +3694,7 @@ function FileRef({
3687
3694
  target: "_blank",
3688
3695
  rel: "noreferrer",
3689
3696
  title,
3690
- className: "min-w-0 truncate font-mono text-[12px] text-foreground underline underline-offset-2",
3697
+ className: "min-w-0 truncate font-mono text-[12px] text-foreground underline underline-offset-2 max-sm:min-w-11 max-sm:leading-11",
3691
3698
  children: label
3692
3699
  }
3693
3700
  ) : /* @__PURE__ */ jsx(
@@ -3769,6 +3776,7 @@ ${planned.url ?? planned.text}`;
3769
3776
  ...failed ? { "aria-describedby": statusId } : {},
3770
3777
  className: cn(
3771
3778
  "shrink-0 rounded p-0.5 hover:bg-card focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 disabled:opacity-60",
3779
+ FILE_BUTTON_ON_A_PHONE,
3772
3780
  failed ? "text-destructive" : "text-muted-foreground hover:text-foreground"
3773
3781
  ),
3774
3782
  children: state === "saving" ? /* @__PURE__ */ jsx(Loader2, { "aria-hidden": true, className: "size-3.5 animate-spin" }) : state === "saved" ? /* @__PURE__ */ jsx(Check, { "aria-hidden": true, className: "size-3.5" }) : failed ? /* @__PURE__ */ jsx(TriangleAlert, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx(Download, { "aria-hidden": true, className: "size-3.5" })
@@ -3845,7 +3853,7 @@ function DocumentValue({ value }) {
3845
3853
  type: "button",
3846
3854
  onClick: () => setOpen((current) => !current),
3847
3855
  "aria-expanded": open,
3848
- className: "flex shrink-0 items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[12px] text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",
3856
+ className: "flex shrink-0 items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[12px] text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 max-sm:min-h-11 max-sm:px-3",
3849
3857
  children: [
3850
3858
  open ? /* @__PURE__ */ jsx(EyeOff, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx(Eye, { "aria-hidden": true, className: "size-3.5" }),
3851
3859
  s.preview
@@ -4064,7 +4072,9 @@ function isInlineColumn(field) {
4064
4072
  return TABULAR_KINDS.has(field.kind);
4065
4073
  }
4066
4074
  var CELL_LENGTH_LIMIT = 80;
4067
- var EXPAND_COLUMN = "2rem";
4075
+ var EXPAND_COLUMN = "var(--expand-column,2rem)";
4076
+ var EXPAND_COLUMN_WIDTH = "[--expand-column:2rem] max-sm:[--expand-column:3.25rem]";
4077
+ var TOGGLE = "mt-0.5 flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 max-sm:mt-0 max-sm:size-11";
4068
4078
  var STACK_NEVER_UP_TO = 3;
4069
4079
  var STACK_ALWAYS_BEYOND = 6;
4070
4080
  function stackingFor(columns) {
@@ -4077,9 +4087,9 @@ var STACKED = {
4077
4087
  head: "@max-[640px]:hidden",
4078
4088
  body: "@max-[640px]:block",
4079
4089
  row: "@max-[640px]:relative @max-[640px]:block @max-[640px]:px-3 @max-[640px]:py-2",
4080
- rowWithToggle: "@max-[640px]:pl-8",
4081
- toggle: "@max-[640px]:absolute @max-[640px]:top-2 @max-[640px]:left-1 @max-[640px]:p-0",
4082
- cell: "@max-[640px]:grid @max-[640px]:grid-cols-[minmax(0,min(40%,10rem))_minmax(0,1fr)] @max-[640px]:items-baseline @max-[640px]:gap-x-3 @max-[640px]:px-0 @max-[640px]:py-0.5",
4090
+ rowWithToggle: "@max-[640px]:pl-8 max-sm:@max-[640px]:pl-12",
4091
+ toggle: "@max-[640px]:absolute @max-[640px]:top-2 @max-[640px]:left-1 @max-[640px]:p-0 max-sm:@max-[640px]:top-0 max-sm:@max-[640px]:left-0",
4092
+ cell: "@max-[640px]:grid @max-[640px]:grid-cols-[minmax(0,min(40%,10rem))_minmax(0,1fr)] @max-[640px]:items-baseline @max-[640px]:gap-x-3 @max-[640px]:px-0 @max-[640px]:py-0.5 @max-[640px]:after:hidden",
4083
4093
  label: "@max-[640px]:block",
4084
4094
  detail: "@max-[640px]:block",
4085
4095
  detailInner: "@max-[640px]:px-0 @max-[640px]:py-1"
@@ -4089,9 +4099,9 @@ var STACKED = {
4089
4099
  head: "hidden",
4090
4100
  body: "block",
4091
4101
  row: "relative block px-3 py-2",
4092
- rowWithToggle: "pl-8",
4093
- toggle: "absolute top-2 left-1 p-0",
4094
- cell: "grid grid-cols-[minmax(0,min(40%,10rem))_minmax(0,1fr)] items-baseline gap-x-3 px-0 py-0.5",
4102
+ rowWithToggle: "pl-8 max-sm:pl-12",
4103
+ toggle: "absolute top-2 left-1 p-0 max-sm:top-0 max-sm:left-0",
4104
+ cell: "grid grid-cols-[minmax(0,min(40%,10rem))_minmax(0,1fr)] items-baseline gap-x-3 px-0 py-0.5 after:hidden",
4095
4105
  label: "block",
4096
4106
  detail: "block",
4097
4107
  detailInner: "px-0 py-1"
@@ -4099,6 +4109,25 @@ var STACKED = {
4099
4109
  };
4100
4110
  var FIT_CELL = "min-w-[min(8ch,14cqw)] wrap-anywhere [&>span]:whitespace-normal";
4101
4111
  var FIT_NAME = "min-w-[min(16ch,28cqw)] wrap-anywhere [&>span]:whitespace-normal";
4112
+ var WORD_FLOOR = "after:block after:h-0 after:max-w-[var(--fit-share,0px)] after:overflow-hidden after:invisible after:wrap-normal after:content-[attr(data-fit)]";
4113
+ var FIT_SHARE_BESIDE_NAME = {
4114
+ 2: "[--fit-share:calc(72cqw_-_3rem_-_var(--expand-column,2rem))]",
4115
+ 3: "[--fit-share:calc((72cqw_-_4.5rem_-_var(--expand-column,2rem))/2)]",
4116
+ 4: "[--fit-share:calc((72cqw_-_6rem_-_var(--expand-column,2rem))/3)]",
4117
+ 5: "[--fit-share:calc((72cqw_-_7.5rem_-_var(--expand-column,2rem))/4)]",
4118
+ 6: "[--fit-share:calc((72cqw_-_9rem_-_var(--expand-column,2rem))/5)]"
4119
+ };
4120
+ var FIT_SHARE_WITHOUT_NAME = {
4121
+ 1: "[--fit-share:calc(100cqw_-_1.5rem_-_var(--expand-column,2rem))]",
4122
+ 2: "[--fit-share:calc((100cqw_-_3rem_-_var(--expand-column,2rem))/2)]",
4123
+ 3: "[--fit-share:calc((100cqw_-_4.5rem_-_var(--expand-column,2rem))/3)]",
4124
+ 4: "[--fit-share:calc((100cqw_-_6rem_-_var(--expand-column,2rem))/4)]",
4125
+ 5: "[--fit-share:calc((100cqw_-_7.5rem_-_var(--expand-column,2rem))/5)]",
4126
+ 6: "[--fit-share:calc((100cqw_-_9rem_-_var(--expand-column,2rem))/6)]"
4127
+ };
4128
+ function cellWords(column, cell, presentation) {
4129
+ return typeof cell === "string" || typeof cell === "number" ? cellTitle(column, cell, presentation) : void 0;
4130
+ }
4102
4131
  function clampsInStack(column, name) {
4103
4132
  if (column === name || fitsACellWhole(column)) return false;
4104
4133
  return column.kind !== "list" && column.kind !== "document" && column.kind !== "image";
@@ -4138,6 +4167,9 @@ function ObjectTable({
4138
4167
  const fits = layout === "stack";
4139
4168
  const stacking = fits ? stackingFor(shown.length) : "never";
4140
4169
  const stacked = stacking === "never" ? void 0 : STACKED[stacking];
4170
+ const nameShown = name !== void 0 && shown.includes(name);
4171
+ const fitShare = fits ? (nameShown ? FIT_SHARE_BESIDE_NAME : FIT_SHARE_WITHOUT_NAME)[shown.length] : void 0;
4172
+ const floorsWords = (column) => fitShare !== void 0 && column !== name;
4141
4173
  useEffect(() => {
4142
4174
  const scroller = scrollerRef.current;
4143
4175
  if (!scroller || fits) return;
@@ -4184,107 +4216,125 @@ function ObjectTable({
4184
4216
  role: "group",
4185
4217
  "aria-label": label,
4186
4218
  ...fits ? {} : { tabIndex: 0 },
4187
- className: cn("overflow-x-auto rounded-lg border border-border", fits && "@container"),
4188
- children: /* @__PURE__ */ jsxs("table", { className: cn("w-full min-w-full border-collapse text-[13px]", stacked?.table), children: [
4189
- /* @__PURE__ */ jsx("thead", { className: stacked?.head, children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-border bg-muted text-left", children: [
4190
- canExpand && /* @__PURE__ */ jsx("th", { scope: "col", style: { width: EXPAND_COLUMN }, className: "px-1", children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: s.rowDetailsColumn }) }),
4191
- shown.map((column) => /* @__PURE__ */ jsx(
4192
- "th",
4193
- {
4194
- scope: "col",
4195
- className: cn(
4196
- // One line, or wrapped anywhere so a header is never what
4197
- // widens a table that has to fit its box. See `FIT_CELL`.
4198
- fits ? "wrap-anywhere" : "whitespace-nowrap",
4199
- "px-3 py-2 text-[12px] font-semibold text-foreground",
4200
- presentation === "app" ? void 0 : "font-mono"
4201
- ),
4202
- children: /* @__PURE__ */ jsx(Described, { description: column.description, children: fieldLabel(column.title, column.name, presentation) })
4203
- },
4204
- column.name
4205
- ))
4206
- ] }) }),
4207
- /* @__PURE__ */ jsx("tbody", { className: stacked?.body, children: items.map((item, index) => {
4208
- const isOpen = canExpand && expanded.has(index);
4209
- return /* @__PURE__ */ jsx(ResultAt, { segment: String(index), children: /* @__PURE__ */ jsxs(
4210
- "tr",
4211
- {
4212
- className: cn(
4213
- "border-b border-border/60 last:border-b-0",
4214
- stacked?.row,
4215
- canExpand && stacked?.rowWithToggle
4216
- ),
4217
- children: [
4218
- canExpand && /* @__PURE__ */ jsx("td", { className: cn("px-1 pt-px align-top", stacked?.toggle), children: /* @__PURE__ */ jsx(
4219
- "button",
4220
- {
4221
- type: "button",
4222
- onClick: () => toggle(index),
4223
- "aria-expanded": isOpen,
4224
- "aria-label": s.toggleRowDetails(index + 1),
4225
- className: "mt-0.5 flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",
4226
- children: isOpen ? /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5" })
4227
- }
4228
- ) }),
4229
- isOpen ? /* @__PURE__ */ jsx("td", { colSpan: shown.length, className: cn("bg-card/40 p-0", stacked?.detail), children: /* @__PURE__ */ jsx(
4230
- "div",
4231
- {
4232
- className: cn(
4233
- !fits && "sticky left-0",
4234
- "px-3.5 py-3",
4235
- stacked?.detailInner
4236
- ),
4237
- ...viewportWidth && !fits ? {
4238
- style: {
4239
- // Minus the chevron column: this cell starts
4240
- // after it, so pinning it to the FULL visible
4241
- // width pushes its right edge that far past the
4242
- // scroller. See `EXPAND_COLUMN`.
4243
- width: canExpand ? `calc(${viewportWidth}px - ${EXPAND_COLUMN})` : viewportWidth
4219
+ className: cn(
4220
+ "overflow-x-auto rounded-lg border border-border",
4221
+ EXPAND_COLUMN_WIDTH,
4222
+ fits && "@container"
4223
+ ),
4224
+ children: /* @__PURE__ */ jsxs(
4225
+ "table",
4226
+ {
4227
+ className: cn("w-full min-w-full border-collapse text-[13px]", stacked?.table, fitShare),
4228
+ children: [
4229
+ /* @__PURE__ */ jsx("thead", { className: stacked?.head, children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-border bg-muted text-left", children: [
4230
+ canExpand && /* @__PURE__ */ jsx("th", { scope: "col", style: { width: EXPAND_COLUMN }, className: "px-1", children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: s.rowDetailsColumn }) }),
4231
+ shown.map((column) => /* @__PURE__ */ jsx(
4232
+ "th",
4233
+ {
4234
+ scope: "col",
4235
+ ...floorsWords(column) ? { "data-fit": fieldLabel(column.title, column.name, presentation) } : {},
4236
+ className: cn(
4237
+ // One line, or wrapped anywhere so a header is never what
4238
+ // widens a table that has to fit its box. See `FIT_CELL`.
4239
+ fits ? "wrap-anywhere" : "whitespace-nowrap",
4240
+ "px-3 py-2 text-[12px] font-semibold text-foreground",
4241
+ presentation === "app" ? void 0 : "font-mono",
4242
+ floorsWords(column) && WORD_FLOOR
4243
+ ),
4244
+ children: /* @__PURE__ */ jsx(Described, { description: column.description, children: fieldLabel(column.title, column.name, presentation) })
4245
+ },
4246
+ column.name
4247
+ ))
4248
+ ] }) }),
4249
+ /* @__PURE__ */ jsx("tbody", { className: stacked?.body, children: items.map((item, index) => {
4250
+ const isOpen = canExpand && expanded.has(index);
4251
+ return /* @__PURE__ */ jsx(ResultAt, { segment: String(index), children: /* @__PURE__ */ jsxs(
4252
+ "tr",
4253
+ {
4254
+ className: cn(
4255
+ "border-b border-border/60 last:border-b-0",
4256
+ stacked?.row,
4257
+ canExpand && stacked?.rowWithToggle
4258
+ ),
4259
+ children: [
4260
+ canExpand && /* @__PURE__ */ jsx("td", { className: cn("px-1 pt-px align-top", stacked?.toggle), children: /* @__PURE__ */ jsx(
4261
+ "button",
4262
+ {
4263
+ type: "button",
4264
+ onClick: () => toggle(index),
4265
+ "aria-expanded": isOpen,
4266
+ "aria-label": s.toggleRowDetails(index + 1),
4267
+ className: TOGGLE,
4268
+ children: isOpen ? /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5" })
4244
4269
  }
4245
- } : {},
4246
- children: /* @__PURE__ */ jsx(ResultField, { field: element, value: item, hideLabel: true })
4247
- }
4248
- ) }) : shown.map((column) => {
4249
- const cell = typeof item === "object" && item !== null ? ownProp(item, column.name) : void 0;
4250
- const columnLabel = fieldLabel(column.title, column.name, presentation);
4251
- return /* @__PURE__ */ jsxs(
4252
- "td",
4253
- {
4254
- className: cn("px-3 py-1.5 align-top", stacked?.cell),
4255
- children: [
4256
- stacked && /* @__PURE__ */ jsx(
4257
- "span",
4258
- {
4259
- className: cn(
4260
- "hidden text-[12px] text-muted-foreground wrap-anywhere",
4261
- presentation === "app" ? void 0 : "font-mono",
4262
- stacked.label
4263
- ),
4264
- children: canExpand ? columnLabel : /* @__PURE__ */ jsx(Described, { description: column.description, children: columnLabel })
4265
- }
4270
+ ) }),
4271
+ isOpen ? /* @__PURE__ */ jsx("td", { colSpan: shown.length, className: cn("bg-card/40 p-0", stacked?.detail), children: /* @__PURE__ */ jsx(
4272
+ "div",
4273
+ {
4274
+ className: cn(
4275
+ !fits && "sticky left-0",
4276
+ "px-3.5 py-3",
4277
+ stacked?.detailInner
4266
4278
  ),
4267
- /* @__PURE__ */ jsx(
4268
- "div",
4269
- {
4270
- className: fits ? column === name ? FIT_NAME : cn(FIT_CELL, clampsInStack(column, name) && "line-clamp-3") : cn(
4271
- "max-w-[44ch]",
4272
- column === name ? "max-w-none min-w-[16ch] wrap-anywhere [&>span]:whitespace-normal" : column.kind === "list" && isInlineColumn(column) ? "min-w-[16ch]" : "truncate"
4273
- ),
4274
- ...typeof cell === "string" || typeof cell === "number" ? { title: cellTitle(column, cell, presentation) } : {},
4275
- children: /* @__PURE__ */ jsx(ResultAt, { segment: column.name, children: /* @__PURE__ */ jsx(LeafValue, { field: column, value: cell, compact: true }) })
4279
+ ...viewportWidth && !fits ? {
4280
+ style: {
4281
+ // Minus the chevron column: this cell starts
4282
+ // after it, so pinning it to the FULL visible
4283
+ // width pushes its right edge that far past the
4284
+ // scroller. See `EXPAND_COLUMN`.
4285
+ width: canExpand ? `calc(${viewportWidth}px - ${EXPAND_COLUMN})` : viewportWidth
4276
4286
  }
4277
- )
4278
- ]
4279
- },
4280
- column.name
4281
- );
4282
- })
4283
- ]
4284
- }
4285
- ) }, index);
4286
- }) })
4287
- ] })
4287
+ } : {},
4288
+ children: /* @__PURE__ */ jsx(ResultField, { field: element, value: item, hideLabel: true })
4289
+ }
4290
+ ) }) : shown.map((column) => {
4291
+ const cell = typeof item === "object" && item !== null ? ownProp(item, column.name) : void 0;
4292
+ const columnLabel = fieldLabel(column.title, column.name, presentation);
4293
+ const words = floorsWords(column) ? cellWords(column, cell, presentation) : void 0;
4294
+ return /* @__PURE__ */ jsxs(
4295
+ "td",
4296
+ {
4297
+ ...words === void 0 ? {} : { "data-fit": words },
4298
+ className: cn(
4299
+ "px-3 py-1.5 align-top",
4300
+ floorsWords(column) && WORD_FLOOR,
4301
+ stacked?.cell
4302
+ ),
4303
+ children: [
4304
+ stacked && /* @__PURE__ */ jsx(
4305
+ "span",
4306
+ {
4307
+ className: cn(
4308
+ "hidden text-[12px] text-muted-foreground wrap-anywhere",
4309
+ presentation === "app" ? void 0 : "font-mono",
4310
+ stacked.label
4311
+ ),
4312
+ children: canExpand ? columnLabel : /* @__PURE__ */ jsx(Described, { description: column.description, children: columnLabel })
4313
+ }
4314
+ ),
4315
+ /* @__PURE__ */ jsx(
4316
+ "div",
4317
+ {
4318
+ className: fits ? column === name ? FIT_NAME : cn(FIT_CELL, clampsInStack(column, name) && "line-clamp-3") : cn(
4319
+ "max-w-[44ch]",
4320
+ column === name ? "max-w-none min-w-[16ch] wrap-anywhere [&>span]:whitespace-normal" : column.kind === "list" && isInlineColumn(column) ? "min-w-[16ch]" : "truncate"
4321
+ ),
4322
+ ...typeof cell === "string" || typeof cell === "number" ? { title: cellTitle(column, cell, presentation) } : {},
4323
+ children: /* @__PURE__ */ jsx(ResultAt, { segment: column.name, children: /* @__PURE__ */ jsx(LeafValue, { field: column, value: cell, compact: true }) })
4324
+ }
4325
+ )
4326
+ ]
4327
+ },
4328
+ column.name
4329
+ );
4330
+ })
4331
+ ]
4332
+ }
4333
+ ) }, index);
4334
+ }) })
4335
+ ]
4336
+ }
4337
+ )
4288
4338
  }
4289
4339
  )
4290
4340
  );
@@ -4785,5 +4835,5 @@ function pdfFileName(field, value, baseName) {
4785
4835
  }
4786
4836
 
4787
4837
  export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EN_FIELD_STRINGS, EnumField, FIELD_STRINGS_BY_LOCALE, FR_FIELD_STRINGS, FieldDomIdProvider, FieldPresentationProvider, FieldRenderer, FieldShell, FieldStringsProvider, HtmlPreview, ImageField, JsonView, ListField, Markdown, MethodForm, NumberField, ObjectField, OptionalToggle, PdfDownloadButton, ProseField, ResultEnvProvider, ResultField, ResultRoot, SUPPORTED_LOCALES, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, StuffViewer, Switch, TextField, ToggleGroup, ToggleGroupItem, UnknownField, cn, fieldControlClass, fieldStringsFor, humanizeFieldName, renderHtmlPdf, resolveHtmlStorageUrls, saveInBrowser, useFieldDomId, useFieldPresentation, useFieldStrings, useMethodForm, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl };
4788
- //# sourceMappingURL=chunk-LXYSQWZG.js.map
4789
- //# sourceMappingURL=chunk-LXYSQWZG.js.map
4838
+ //# sourceMappingURL=chunk-Y4MTDG2R.js.map
4839
+ //# sourceMappingURL=chunk-Y4MTDG2R.js.map