@particle-academy/react-fancy 4.3.0 → 4.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
@@ -2396,6 +2396,8 @@ var Button = react.forwardRef(
2396
2396
  loading = false,
2397
2397
  disabled,
2398
2398
  href,
2399
+ responsive,
2400
+ labelClassName,
2399
2401
  ...props
2400
2402
  }, ref) => {
2401
2403
  const isCircle = variant === "circle";
@@ -2507,7 +2509,10 @@ var Button = react.forwardRef(
2507
2509
  const trailingAlert = renderAlertIcon(true);
2508
2510
  if (trailingAlert) trailingElements.push(trailingAlert);
2509
2511
  const classes = cn(
2510
- "inline-flex items-center justify-center font-medium transition-all duration-200",
2512
+ // `text-left` overrides the UA <button> center default so a wrapped,
2513
+ // width-constrained multi-word label stacks left-aligned. Overridable —
2514
+ // twMerge lets a `text-center` / `text-right` in `className` win.
2515
+ "inline-flex items-center justify-center text-left font-medium transition-all duration-200",
2511
2516
  "focus:outline-none focus:ring-2 focus:ring-offset-1",
2512
2517
  "disabled:opacity-50 disabled:cursor-not-allowed",
2513
2518
  isCircle ? "rounded-full" : "rounded-lg",
@@ -2529,7 +2534,27 @@ var Button = react.forwardRef(
2529
2534
  }
2530
2535
  ) : icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: iconSizeMap[size] }) : children }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2531
2536
  leadingElements,
2532
- children != null && /* @__PURE__ */ jsxRuntime.jsx("span", { children }),
2537
+ children != null && /* @__PURE__ */ jsxRuntime.jsx(
2538
+ "span",
2539
+ {
2540
+ "data-react-fancy-button-label": "",
2541
+ className: cn(
2542
+ // A button label must stay on one line. When a host flex layout
2543
+ // squeezes the button, `whitespace-nowrap` keeps the label and any
2544
+ // trailing icon/arrow together instead of wrapping and stacking the
2545
+ // icon below it (the classic "send" over "→" break). `min-w-0` keeps
2546
+ // the span shrinkable so `truncate`/ellipsis still works; multi-line
2547
+ // wrapping is opt-in via `labelClassName` ("whitespace-normal") or
2548
+ // the `responsive` prop.
2549
+ "min-w-0 whitespace-nowrap",
2550
+ // `responsive` collapses to icon-only when squeezed, while keeping
2551
+ // the label readable to screen readers.
2552
+ responsive && "sr-only sm:not-sr-only",
2553
+ labelClassName
2554
+ ),
2555
+ children
2556
+ }
2557
+ ),
2533
2558
  trailingElements
2534
2559
  ] });
2535
2560
  const safeHref = sanitizeHref(href);
@@ -12894,13 +12919,14 @@ function PromptInput({
12894
12919
  {
12895
12920
  variant: "ghost",
12896
12921
  size: "sm",
12922
+ className: "shrink-0",
12897
12923
  onClick: () => {
12898
12924
  },
12899
12925
  children: "\u{1F4CE} attach"
12900
12926
  }
12901
12927
  ) }),
12902
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-2 flex items-center gap-1.5", children: [
12903
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-24 overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-700", children: /* @__PURE__ */ jsxRuntime.jsx(
12928
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-2 flex min-w-0 items-center gap-1.5 overflow-hidden", children: [
12929
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-24 shrink overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-700", children: /* @__PURE__ */ jsxRuntime.jsx(
12904
12930
  "div",
12905
12931
  {
12906
12932
  className: "h-full rounded-full transition-all",
@@ -12913,7 +12939,7 @@ function PromptInput({
12913
12939
  fmtTokens(budgetTokens)
12914
12940
  ] })
12915
12941
  ] }),
12916
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex items-center gap-2", children: [
12942
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
12917
12943
  showHint && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "hidden text-[10px] text-zinc-500 sm:inline", children: [
12918
12944
  /* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "rounded border border-zinc-300 bg-zinc-50 px-1 py-0.5 font-mono text-[9px] text-zinc-700 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300", children: "\u2318" }),
12919
12945
  " ",
@@ -12923,7 +12949,7 @@ function PromptInput({
12923
12949
  " ",
12924
12950
  "to send"
12925
12951
  ] }),
12926
- /* @__PURE__ */ jsxRuntime.jsx(Button, { color: "violet", size: "sm", onClick: submit, children: "send \u2192" })
12952
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { color: "violet", size: "sm", className: "shrink-0", onClick: submit, children: "send \u2192" })
12927
12953
  ] })
12928
12954
  ] })
12929
12955
  ]