@sckyzo/cosmos-react 0.4.0 → 0.4.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.
package/dist/index.cjs CHANGED
@@ -3224,7 +3224,7 @@ var ProfileHeader = ({
3224
3224
  ) }),
3225
3225
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 basis-60 sm:pt-3", children: [
3226
3226
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
3227
- /* @__PURE__ */ jsxRuntime.jsx(Heading2, { className: "text-xl font-bold break-words text-[var(--color-text-primary)]", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: name }) }),
3227
+ /* @__PURE__ */ jsxRuntime.jsx(Heading2, { className: "min-w-0 text-xl font-bold break-words text-[var(--color-text-primary)]", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: name }) }),
3228
3228
  badges
3229
3229
  ] }),
3230
3230
  headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm break-words text-[var(--color-text-secondary)]", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: headline }) }),
@@ -3463,7 +3463,9 @@ var Button = ({
3463
3463
  type,
3464
3464
  disabled: disabled || loading,
3465
3465
  className: clsx.clsx(
3466
- "focus-visible:focus-indicator inline-flex items-center justify-center font-medium transition-colors",
3466
+ // A label on one line in a button of fixed height: a row too narrow for it wraps or
3467
+ // scrolls the buttons, not the text.
3468
+ "focus-visible:focus-indicator inline-flex items-center justify-center font-medium whitespace-nowrap transition-colors",
3467
3469
  VARIANT_CLASS[variant][intent],
3468
3470
  TEXT_CLASS[size],
3469
3471
  variant === "link" ? LINK_CLASS : [
@@ -3475,19 +3477,19 @@ var Button = ({
3475
3477
  ),
3476
3478
  ...rest,
3477
3479
  children: [
3478
- Icon2 && iconPosition === "start" && !loading && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: ICON_SIZE[size] }),
3480
+ Icon2 && iconPosition === "start" && !loading && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: clsx.clsx("shrink-0", ICON_SIZE[size]) }),
3479
3481
  loading && /* @__PURE__ */ jsxRuntime.jsx(
3480
3482
  "span",
3481
3483
  {
3482
3484
  "aria-hidden": true,
3483
3485
  className: clsx.clsx(
3484
- "animate-spin rounded-full border-2 border-current border-t-transparent",
3486
+ "shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent",
3485
3487
  ICON_SIZE[size]
3486
3488
  )
3487
3489
  }
3488
3490
  ),
3489
3491
  children,
3490
- Icon2 && iconPosition === "end" && !loading && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: ICON_SIZE[size] })
3492
+ Icon2 && iconPosition === "end" && !loading && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: clsx.clsx("shrink-0", ICON_SIZE[size]) })
3491
3493
  ]
3492
3494
  }
3493
3495
  );
@@ -4526,7 +4528,7 @@ var CheckName = ({ check, open, onToggle, outputId }) => check.output === void 0
4526
4528
  }
4527
4529
  );
4528
4530
  var Output = ({ check, open, outputId }) => check.output === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { id: outputId, hidden: !open, className: "min-w-0", children: open && /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: check.output }) });
4529
- var Dash = () => /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-[var(--color-text-muted)] max-sm:hidden", children: "\u2014" });
4531
+ var Dash = () => /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-[var(--color-text-muted)] @max-[48rem]:hidden", children: "\u2014" });
4530
4532
  var CheckRow = ({ check, open, onToggle, outputId, now }) => /* @__PURE__ */ jsxRuntime.jsxs(
4531
4533
  "li",
4532
4534
  {
@@ -4535,15 +4537,15 @@ var CheckRow = ({ check, open, onToggle, outputId, now }) => /* @__PURE__ */ jsx
4535
4537
  (check.status === "WARN" || check.status === "CRIT") && "bg-gray-50/60 dark:bg-white/[0.02]"
4536
4538
  ),
4537
4539
  children: [
4538
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5 sm:grid sm:grid-cols-[6.5rem_minmax(0,10rem)_minmax(0,12rem)_minmax(0,1fr)_5rem_6rem] sm:items-center sm:gap-3", children: [
4540
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5 @min-[48rem]:grid @min-[48rem]:grid-cols-[6.5rem_minmax(6rem,10rem)_minmax(0,12rem)_minmax(12rem,1fr)_5rem_7rem] @min-[48rem]:items-center @min-[48rem]:gap-3", children: [
4539
4541
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: check.status, label: STATUS_NAME[check.status] }) }),
4540
4542
  /* @__PURE__ */ jsxRuntime.jsx(CheckName, { check, open, onToggle, outputId }),
4541
- check.target ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-xs break-all text-[var(--color-text-secondary)] sm:truncate", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: check.target }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {}),
4543
+ check.target ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-xs break-all text-[var(--color-text-secondary)] @min-[48rem]:truncate", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: check.target }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {}),
4542
4544
  check.message ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 break-words", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: check.message }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {}),
4543
- check.latency !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums sm:text-end", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: formatLatency(check.latency) }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {}),
4544
- check.checkedAt !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[var(--color-text-secondary)] tabular-nums sm:text-end", children: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { value: check.checkedAt, now }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {})
4545
+ check.latency !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums @min-[48rem]:text-end", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: formatLatency(check.latency) }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {}),
4546
+ check.checkedAt !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[var(--color-text-secondary)] tabular-nums @min-[48rem]:text-end", children: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { value: check.checkedAt, now }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {})
4545
4547
  ] }),
4546
- check.output !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx.clsx(open && "mt-3 sm:ms-[7.25rem]"), children: /* @__PURE__ */ jsxRuntime.jsx(Output, { check, open, outputId }) })
4548
+ check.output !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx.clsx(open && "mt-3 @min-[48rem]:ms-[7.25rem]"), children: /* @__PURE__ */ jsxRuntime.jsx(Output, { check, open, outputId }) })
4547
4549
  ]
4548
4550
  }
4549
4551
  );
@@ -4671,7 +4673,9 @@ var HealthCheckList = ({
4671
4673
  role: ariaLabel ? "group" : void 0,
4672
4674
  "aria-label": ariaLabel,
4673
4675
  className: clsx.clsx(
4674
- variant === "list" && "overflow-hidden rounded-2xl border border-[var(--color-border)] bg-[var(--color-bg-panel)]",
4676
+ // The rows lay their columns out from the list's own width, not the screen's: in a card the
4677
+ // list is narrower than the screen, and a grid of fixed columns left the message nothing.
4678
+ variant === "list" && "@container overflow-hidden rounded-2xl border border-[var(--color-border)] bg-[var(--color-bg-panel)]",
4675
4679
  variant === "grid" && "flex flex-col gap-4",
4676
4680
  className
4677
4681
  ),
@@ -5764,9 +5768,9 @@ function StackedListItem({
5764
5768
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-x-0 -top-px bottom-0", "aria-hidden": true }),
5765
5769
  /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: title })
5766
5770
  ] }) }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm/6 font-semibold text-gray-900 dark:text-white", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: title }) });
5767
- const titleRow = badge ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-x-3", children: [
5771
+ const titleRow = badge ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-start gap-x-3 gap-y-1", children: [
5768
5772
  titleEl,
5769
- badge
5773
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-none", children: badge })
5770
5774
  ] }) : titleEl;
5771
5775
  return /* @__PURE__ */ jsxRuntime.jsxs(
5772
5776
  "li",
@@ -7832,7 +7836,9 @@ var AvatarGroup = ({
7832
7836
  "span",
7833
7837
  {
7834
7838
  className: clsx.clsx(
7835
- "relative inline-flex shrink-0 ring-2 ring-[var(--color-bg-panel)] has-focus-visible:z-10",
7839
+ // The surface behind each avatar: a tinted fill lets the one before it, and its ring, show
7840
+ // through otherwise.
7841
+ "relative inline-flex shrink-0 bg-[var(--color-bg-panel)] ring-2 ring-[var(--color-bg-panel)] has-focus-visible:z-10",
7836
7842
  AVATAR_SHAPE_CLASS[shape],
7837
7843
  index > 0 && OVERLAP_CLASS[spacing][size],
7838
7844
  index < last && INITIALS_SHIFT_CLASS[spacing][size]
@@ -8810,7 +8816,8 @@ var STATE_CONFIG = {
8810
8816
  saving: { label: "Saving\u2026", loading: true },
8811
8817
  // The `success` intent carries the dark text on green (white on green-500 is about 2.3:1).
8812
8818
  saved: { label: "Saved", icon: lucideReact.Check, intent: "success" },
8813
- error: { label: "Error", intent: "danger" }
8819
+ // What to do next, not the name of the state: the save failed, the click saves again.
8820
+ error: { label: "Try again", intent: "danger" }
8814
8821
  };
8815
8822
  var StatefulSaveButton = ({
8816
8823
  state,
@@ -9160,7 +9167,9 @@ function NotificationsPanelTrigger({
9160
9167
  "aria-expanded": open,
9161
9168
  onClick: () => setOpen(!open),
9162
9169
  className: clsx.clsx(
9163
- "focus-visible:focus-indicator h-ctrl-40 w-ctrl-40 relative flex items-center justify-center rounded-lg border transition-colors",
9170
+ // The ping around the count grows to twice its size: clipped to the bell, it never widens
9171
+ // the row that holds it. The focus ring is a shadow, outside the clip.
9172
+ "focus-visible:focus-indicator h-ctrl-40 w-ctrl-40 relative flex items-center justify-center overflow-hidden rounded-lg border transition-colors",
9164
9173
  muted ? "border-gray-200 text-gray-400 dark:border-gray-700 dark:text-gray-600" : "border-gray-200 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-white/5 dark:hover:text-white",
9165
9174
  className
9166
9175
  ),
@@ -13745,21 +13754,30 @@ var DatePicker = (props) => {
13745
13754
  ]
13746
13755
  }
13747
13756
  ),
13748
- isRange ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx("flex items-center gap-2", !fullWidth && "w-fit"), children: [
13749
- renderTrigger(
13750
- fieldId,
13751
- "from",
13752
- selectedRange.from,
13753
- props.fromPlaceholder ?? "Start date"
13754
- ),
13755
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: "to" }),
13756
- renderTrigger(
13757
- void 0,
13758
- "to",
13759
- selectedRange.to,
13760
- props.toPlaceholder ?? "End date"
13757
+ isRange ? (
13758
+ // Two dates side by side don't fit a phone: the end date goes under the start date.
13759
+ /* @__PURE__ */ jsxRuntime.jsxs(
13760
+ "div",
13761
+ {
13762
+ className: clsx.clsx("flex flex-wrap items-center gap-2", !fullWidth && "w-fit max-w-full"),
13763
+ children: [
13764
+ renderTrigger(
13765
+ fieldId,
13766
+ "from",
13767
+ selectedRange.from,
13768
+ props.fromPlaceholder ?? "Start date"
13769
+ ),
13770
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: "to" }),
13771
+ renderTrigger(
13772
+ void 0,
13773
+ "to",
13774
+ selectedRange.to,
13775
+ props.toPlaceholder ?? "End date"
13776
+ )
13777
+ ]
13778
+ }
13761
13779
  )
13762
- ] }) : renderTrigger(
13780
+ ) : renderTrigger(
13763
13781
  fieldId,
13764
13782
  "from",
13765
13783
  selectedSingle,
@@ -14014,7 +14032,7 @@ var OtpInput = ({
14014
14032
  if (finalValue.length === length) onComplete?.(finalValue);
14015
14033
  };
14016
14034
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx("flex items-center gap-2", className), role: "group", "aria-label": ariaLabel, children: [
14017
- /* @__PURE__ */ jsxRuntime.jsx("div", { dir: "ltr", className: "flex items-center gap-2", children: Array.from({ length }).map((_, i) => {
14035
+ /* @__PURE__ */ jsxRuntime.jsx("div", { dir: "ltr", className: "flex min-w-0 items-center gap-2", children: Array.from({ length }).map((_, i) => {
14018
14036
  const cellChar = value[i] ?? "";
14019
14037
  const display = mask && cellChar ? "\u2022" : cellChar;
14020
14038
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -14037,7 +14055,8 @@ var OtpInput = ({
14037
14055
  onPaste: handlePaste(i),
14038
14056
  onFocus: (e) => e.target.select(),
14039
14057
  className: clsx.clsx(
14040
- "h-ctrl-48 w-10 rounded-lg border bg-white text-center text-lg font-semibold text-gray-900 tabular-nums transition-colors disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-800 dark:text-white",
14058
+ // 2.5rem wide, narrower when the row doesn't fit (eight cells on a phone).
14059
+ "h-ctrl-48 w-10 min-w-0 rounded-lg border bg-white text-center text-lg font-semibold text-gray-900 tabular-nums transition-colors disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-800 dark:text-white",
14041
14060
  fieldStateClass({ invalid: error, success })
14042
14061
  )
14043
14062
  },
@@ -16079,7 +16098,8 @@ function Item4({
16079
16098
  "dd",
16080
16099
  {
16081
16100
  className: clsx.clsx(
16082
- "text-sm font-medium text-[var(--color-text-primary)]",
16101
+ // A value with no space in it (an e-mail) breaks inside the row.
16102
+ "min-w-0 text-sm font-medium break-words text-[var(--color-text-primary)]",
16083
16103
  mono && "font-mono text-xs"
16084
16104
  ),
16085
16105
  children: isolate(children)
@@ -16101,7 +16121,7 @@ function Item4({
16101
16121
  "dd",
16102
16122
  {
16103
16123
  className: clsx.clsx(
16104
- "mt-1 text-sm/6 text-gray-700 sm:col-span-2 sm:mt-0 dark:text-gray-300",
16124
+ "mt-1 min-w-0 text-sm/6 break-words text-gray-700 sm:col-span-2 sm:mt-0 dark:text-gray-300",
16105
16125
  mono && "font-mono"
16106
16126
  ),
16107
16127
  children: isolate(children)
@@ -16198,7 +16218,7 @@ var KpiCard = ({
16198
16218
  );
16199
16219
  const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16200
16220
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center justify-between gap-3", children: [
16201
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 text-xs font-medium tracking-wider text-gray-500 uppercase dark:text-gray-400", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: label }) }),
16221
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 text-xs font-medium tracking-wider break-words hyphens-auto text-gray-500 uppercase dark:text-gray-400", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: label }) }),
16202
16222
  Icon2 && /* @__PURE__ */ jsxRuntime.jsx(
16203
16223
  "span",
16204
16224
  {
@@ -16221,7 +16241,9 @@ var KpiCard = ({
16221
16241
  "span",
16222
16242
  {
16223
16243
  className: clsx.clsx(
16224
- "block text-3xl font-bold tracking-tight tabular-nums",
16244
+ // A figure with no break in it (`€12,418,906.40`) wraps in a narrow card instead of
16245
+ // running out of it: cut, it would read as another number.
16246
+ "block text-3xl font-bold tracking-tight break-words tabular-nums",
16225
16247
  intent === "neutral" ? "text-gray-900 dark:text-white" : INTENT_STYLE[intent].text
16226
16248
  ),
16227
16249
  children: withExact ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -16706,7 +16728,8 @@ var MiniCalendar = ({
16706
16728
  "aria-current": isToday ? "date" : void 0,
16707
16729
  className: clsx.clsx(
16708
16730
  // The number sits above the middle of the cell (`pb-1.5`) to leave room for the event dot under it.
16709
- "h-ctrl-36 relative flex items-center justify-center rounded-md border pb-1.5 text-xs font-medium transition-colors focus-visible:ring-inset",
16731
+ // At least 28px wide: a calendar as wide as its content had columns as narrow as the numbers.
16732
+ "h-ctrl-36 min-w-ctrl-28 relative flex items-center justify-center rounded-md border pb-1.5 text-xs font-medium transition-colors focus-visible:ring-inset",
16710
16733
  isSelected ? "bg-brand-500 hover:bg-brand-600 focus-visible:focus-indicator-on-accent border-transparent text-white" : isToday ? "border-brand-500 text-brand-600 hover:bg-brand-50 focus-visible:focus-indicator dark:text-brand-400 dark:hover:bg-white/5" : "focus-visible:focus-indicator border-transparent text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5"
16711
16734
  ),
16712
16735
  children: [
@@ -18515,12 +18538,13 @@ var DataTableBulkActions = ({
18515
18538
  icon: item.icon,
18516
18539
  disabled: item.disabled,
18517
18540
  onClick: () => item.onClick(selectedRows),
18541
+ className: "shrink-0",
18518
18542
  children: item.label
18519
18543
  },
18520
18544
  item.key
18521
18545
  );
18522
18546
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18523
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx("flex items-center gap-2", phoneIcons && "max-sm:hidden"), children: [
18547
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx("flex flex-wrap items-center gap-2", phoneIcons && "max-sm:hidden"), children: [
18524
18548
  button(first, true),
18525
18549
  rest.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18526
18550
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden items-center gap-2 @min-[1152px]:flex", children: rest.map((item) => button(item, false)) }),
@@ -18920,6 +18944,43 @@ var PageSizeSelect = ({ value, options, onChange }) => {
18920
18944
  ] });
18921
18945
  };
18922
18946
 
18947
+ // src/table/columnWidths.ts
18948
+ var DEFAULT_COLUMN_MIN_WIDTH = "8rem";
18949
+ var NUMBER = String.raw`(?:\d+(?:\.\d+)?|\.\d+)`;
18950
+ var LENGTH = new RegExp(`^${NUMBER}(?:px|rem|em|ch)$`);
18951
+ var PERCENT2 = new RegExp(`^(${NUMBER})%$`);
18952
+ var ratio = (n) => Number(n.toFixed(4));
18953
+ var tableMinWidth = (columns, fixed, takesTheRest) => {
18954
+ if (columns.length === 0) return void 0;
18955
+ const lengths = [...fixed];
18956
+ const autoMins = [];
18957
+ const percents = [];
18958
+ columns.forEach((c, i) => {
18959
+ const width = c.width?.trim() ?? "";
18960
+ const min = c.minWidth ?? DEFAULT_COLUMN_MIN_WIDTH;
18961
+ const share = PERCENT2.exec(width);
18962
+ if (i === takesTheRest) autoMins.push(LENGTH.test(width) ? width : min);
18963
+ else if (LENGTH.test(width)) lengths.push(width);
18964
+ else if (share) percents.push({ share: Number(share[1]) / 100, min });
18965
+ else autoMins.push(min);
18966
+ });
18967
+ const bounds = percents.map((p) => `calc(${p.min} / ${ratio(p.share)})`);
18968
+ const left = ratio(1 - percents.reduce((sum, p) => sum + p.share, 0));
18969
+ const widest = [...new Set(autoMins)];
18970
+ const parts = [
18971
+ ...lengths,
18972
+ ...autoMins.length > 0 ? [`${autoMins.length} * ${widest.length === 1 ? widest[0] : `max(${widest.join(", ")})`}`] : []
18973
+ ];
18974
+ if (parts.length > 0 && left > 0) {
18975
+ bounds.push(
18976
+ left === 1 ? `calc(${parts.join(" + ")})` : `calc((${parts.join(" + ")}) / ${left})`
18977
+ );
18978
+ }
18979
+ const distinct = [...new Set(bounds)];
18980
+ if (distinct.length === 0) return void 0;
18981
+ return distinct.length === 1 ? distinct[0] : `max(${distinct.join(", ")})`;
18982
+ };
18983
+
18923
18984
  // src/table/pipeline.ts
18924
18985
  var filtersToRecord = (filters) => {
18925
18986
  const out = {};
@@ -19809,12 +19870,15 @@ var DataTable = ({
19809
19870
  [filteredRows, columns, manual, sortKey, sortDir]
19810
19871
  );
19811
19872
  const firstColumnTakesTheRest = (selectable || actionColumn) && columns.length > 0 && columns.every((c) => c.width);
19812
- const statedMinWidth = firstColumnTakesTheRest ? `calc(${[
19813
- expandable && EXPAND_COLUMN_WIDTH,
19814
- selectable && SELECT_COLUMN_WIDTH,
19815
- ...columns.map((c) => c.width),
19816
- actionColumn && (rowEditing ? EDIT_ACTION_COLUMN_WIDTH : ACTION_COLUMN_WIDTH)
19817
- ].filter(Boolean).join(" + ")})` : void 0;
19873
+ const tableMinimum = tableMinWidth(
19874
+ columns,
19875
+ [
19876
+ expandable && EXPAND_COLUMN_WIDTH,
19877
+ selectable && SELECT_COLUMN_WIDTH,
19878
+ actionColumn && (rowEditing ? EDIT_ACTION_COLUMN_WIDTH : ACTION_COLUMN_WIDTH)
19879
+ ].filter((w) => Boolean(w)),
19880
+ firstColumnTakesTheRest ? 0 : void 0
19881
+ );
19818
19882
  const mobileSortable = columns.some((c) => c.sortable);
19819
19883
  const hasRows = sortedRows.length > 0;
19820
19884
  const showSkeleton = loading && !hasRows;
@@ -20279,7 +20343,11 @@ var DataTable = ({
20279
20343
  /* @__PURE__ */ jsxRuntime.jsxs(
20280
20344
  "div",
20281
20345
  {
20282
- className: clsx.clsx("flex min-w-0 items-center gap-3", mobileCards && "max-sm:flex-1"),
20346
+ className: clsx.clsx(
20347
+ // The actions go to the next line when the count leaves them too little room.
20348
+ "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2",
20349
+ mobileCards && "max-sm:flex-1"
20350
+ ),
20283
20351
  children: [
20284
20352
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-brand-700 dark:text-brand-300 text-sm font-medium whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsxs("bdi", { children: [
20285
20353
  selection.size,
@@ -20294,7 +20362,7 @@ var DataTable = ({
20294
20362
  children: "Clear"
20295
20363
  }
20296
20364
  ),
20297
- (bulkActionItems || bulkActions) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2 ps-1", children: [
20365
+ (bulkActionItems || bulkActions) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-auto flex-wrap items-center gap-2 ps-1", children: [
20298
20366
  bulkActionItems && /* @__PURE__ */ jsxRuntime.jsx(
20299
20367
  DataTableBulkActions,
20300
20368
  {
@@ -20431,7 +20499,7 @@ var DataTable = ({
20431
20499
  "aria-labelledby": ariaLabelledBy,
20432
20500
  "aria-busy": loading || void 0,
20433
20501
  "aria-rowcount": windowed ? pageRows.length + 1 : void 0,
20434
- style: statedMinWidth ? { minWidth: statedMinWidth } : void 0,
20502
+ style: tableMinimum ? { minWidth: tableMinimum } : void 0,
20435
20503
  className: "w-full table-fixed",
20436
20504
  children: [
20437
20505
  /* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
@@ -21382,7 +21450,7 @@ var SocialAuthButtons = ({
21382
21450
  onClick: () => onProviderClick(provider),
21383
21451
  disabled: isDisabled,
21384
21452
  "aria-label": label,
21385
- className: "focus-visible:focus-indicator h-ctrl-40 flex items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",
21453
+ className: "focus-visible:focus-indicator h-ctrl-40 flex items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700 [&>svg]:shrink-0",
21386
21454
  children: [
21387
21455
  isLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(Icon2, {}),
21388
21456
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: label })