@timbal-ai/timbal-react 1.4.0 → 1.6.0

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +43 -4
  3. package/dist/app.cjs +3770 -1506
  4. package/dist/app.d.cts +76 -31
  5. package/dist/app.d.ts +76 -31
  6. package/dist/app.esm.js +30 -8
  7. package/dist/{chart-artifact-C8-Py6lc.d.cts → chart-artifact-C2pZQsaP.d.ts} +247 -41
  8. package/dist/{chart-artifact-CMnDys2t.d.ts → chart-artifact-VAqgH-My.d.cts} +247 -41
  9. package/dist/{chat-ClmzWzCX.d.cts → chat-DDsp-Vzz.d.cts} +1 -1
  10. package/dist/{chat-ClmzWzCX.d.ts → chat-DDsp-Vzz.d.ts} +1 -1
  11. package/dist/chat.cjs +280 -123
  12. package/dist/chat.d.cts +3 -3
  13. package/dist/chat.d.ts +3 -3
  14. package/dist/chat.esm.js +4 -3
  15. package/dist/chunk-24B4I4XC.esm.js +232 -0
  16. package/dist/{chunk-VOWNCS3F.esm.js → chunk-6SQMTBPL.esm.js} +1669 -504
  17. package/dist/chunk-EDEKQYSU.esm.js +10 -0
  18. package/dist/{chunk-QIABF4KB.esm.js → chunk-ELEY66OH.esm.js} +2 -2
  19. package/dist/{chunk-THBA27QY.esm.js → chunk-HSL36SJ4.esm.js} +243 -124
  20. package/dist/chunk-JJOO4PR5.esm.js +391 -0
  21. package/dist/{chunk-QU7ET55D.esm.js → chunk-MBS7XHV2.esm.js} +335 -192
  22. package/dist/chunk-NO5AWNWT.esm.js +1066 -0
  23. package/dist/{chunk-VXMM2HX7.esm.js → chunk-R4RQT2XQ.esm.js} +3 -3
  24. package/dist/{chunk-OFWC4MIY.esm.js → chunk-TMP7RIA7.esm.js} +5 -3
  25. package/dist/{chunk-GQBYZRD7.esm.js → chunk-WQIQW7EM.esm.js} +40 -28
  26. package/dist/{chunk-OH23AX2V.esm.js → chunk-YYEI6XME.esm.js} +441 -957
  27. package/dist/{circular-progress-Ci8L-Hfa.d.cts → circular-progress-B9nnwzCu.d.cts} +20 -78
  28. package/dist/{circular-progress-Ci8L-Hfa.d.ts → circular-progress-B9nnwzCu.d.ts} +20 -78
  29. package/dist/index.cjs +5547 -3192
  30. package/dist/index.d.cts +10 -8
  31. package/dist/index.d.ts +10 -8
  32. package/dist/index.esm.js +76 -44
  33. package/dist/kanban-FFBeaZPS.d.cts +212 -0
  34. package/dist/kanban-FFBeaZPS.d.ts +212 -0
  35. package/dist/{layout-BTJyU8wd.d.ts → layout-CuKeSY74.d.ts} +1 -1
  36. package/dist/{layout-C2G-FcER.d.cts → layout-PzVwkJyL.d.cts} +1 -1
  37. package/dist/site.cjs +429 -0
  38. package/dist/site.d.cts +198 -0
  39. package/dist/site.d.ts +198 -0
  40. package/dist/site.esm.js +23 -0
  41. package/dist/studio.cjs +722 -363
  42. package/dist/studio.d.cts +2 -2
  43. package/dist/studio.d.ts +2 -2
  44. package/dist/studio.esm.js +8 -6
  45. package/dist/styles.css +56 -0
  46. package/dist/{timbal-v2-button-CNfdwGq4.d.cts → timbal-v2-button-DCAZNyUx.d.cts} +3 -3
  47. package/dist/{timbal-v2-button-CNfdwGq4.d.ts → timbal-v2-button-DCAZNyUx.d.ts} +3 -3
  48. package/dist/ui.cjs +1553 -708
  49. package/dist/ui.d.cts +11 -4
  50. package/dist/ui.d.ts +11 -4
  51. package/dist/ui.esm.js +45 -36
  52. package/dist/{welcome-DXqsGTwH.d.ts → welcome-B00oH5Io.d.cts} +5 -1
  53. package/dist/{welcome-BFGRoNfK.d.cts → welcome-DU-4NTjZ.d.ts} +5 -1
  54. package/package.json +9 -1
  55. package/dist/button-BoyX5pM_.d.cts +0 -18
  56. package/dist/button-BoyX5pM_.d.ts +0 -18
  57. package/dist/chunk-UCGVL7ZY.esm.js +0 -52
package/dist/chat.cjs CHANGED
@@ -968,7 +968,7 @@ function TooltipContent({
968
968
  "data-slot": "tooltip-content",
969
969
  sideOffset,
970
970
  className: cn(
971
- "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
971
+ "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-2.5 py-1 text-xs text-balance",
972
972
  className
973
973
  ),
974
974
  ...props,
@@ -991,31 +991,23 @@ var TIMBAL_V2_MODAL_SURFACE = cn(
991
991
  "border border-border shadow-card-elevated"
992
992
  );
993
993
  var TIMBAL_V2_PRIMARY_GRADIENT = "bg-gradient-to-b from-primary-fill-from to-primary-fill-to";
994
- var TIMBAL_V2_FROM_LEGACY_BUTTON = {
995
- default: "primary",
996
- destructive: "destructive",
997
- outline: "secondary",
998
- secondary: "secondary",
999
- ghost: "ghost",
1000
- link: "link"
1001
- };
1002
994
  var TIMBAL_V2_SIZE_HEIGHT = {
1003
- xs: "min-h-8 h-8",
1004
- sm: "min-h-9 h-9",
1005
- md: "min-h-10 h-10",
1006
- lg: "min-h-11 h-11"
995
+ xs: "min-h-7 h-7",
996
+ sm: "min-h-8 h-8",
997
+ md: "min-h-9 h-9",
998
+ lg: "min-h-10 h-10"
1007
999
  };
1008
1000
  var TIMBAL_V2_SIZE_ICON = {
1009
- xs: "min-h-8 min-w-8 size-8",
1001
+ xs: "min-h-7 min-w-7 size-7",
1010
1002
  sm: "min-h-8 min-w-8 size-8",
1011
- md: "min-h-10 min-w-10 size-10",
1012
- lg: "min-h-11 min-w-11 size-11"
1003
+ md: "min-h-9 min-w-9 size-9",
1004
+ lg: "min-h-10 min-w-10 size-10"
1013
1005
  };
1014
1006
  var TIMBAL_V2_SIZE_LABEL_PX = {
1015
- xs: "px-3",
1016
- sm: "px-4",
1017
- md: "px-5",
1018
- lg: "px-6"
1007
+ xs: "px-2.5",
1008
+ sm: "px-3",
1009
+ md: "px-3.5",
1010
+ lg: "px-4.5"
1019
1011
  };
1020
1012
  var TIMBAL_V2_FILL = {
1021
1013
  primary: [
@@ -1034,6 +1026,11 @@ var TIMBAL_V2_FILL = {
1034
1026
  "group-hover/tbv2:from-destructive-fill-hover-from group-hover/tbv2:to-destructive-fill-hover-to",
1035
1027
  "group-active/tbv2:from-destructive-fill-active-from group-active/tbv2:to-destructive-fill-active-to"
1036
1028
  ].join(" "),
1029
+ "destructive-solid": [
1030
+ "bg-gradient-to-b from-destructive-solid-from to-destructive-solid-to",
1031
+ "group-hover/tbv2:from-destructive-solid-hover-from group-hover/tbv2:to-destructive-solid-hover-to",
1032
+ "group-active/tbv2:from-destructive-solid-active-from group-active/tbv2:to-destructive-solid-active-to"
1033
+ ].join(" "),
1037
1034
  secondary: [
1038
1035
  TIMBAL_V2_ELEVATED_GRADIENT,
1039
1036
  "group-hover/tbv2:from-secondary-fill-hover-from group-hover/tbv2:to-secondary-fill-hover-to",
@@ -1050,6 +1047,7 @@ var TIMBAL_V2_LABEL = {
1050
1047
  primary: "text-primary-foreground",
1051
1048
  informative: "text-primary-foreground",
1052
1049
  destructive: "text-destructive",
1050
+ "destructive-solid": "text-destructive-foreground",
1053
1051
  secondary: "text-foreground",
1054
1052
  ghost: "text-foreground",
1055
1053
  link: "text-foreground underline decoration-foreground/25 underline-offset-2 group-hover/tbv2:decoration-foreground/45"
@@ -1058,6 +1056,7 @@ var TIMBAL_V2_BORDER = {
1058
1056
  primary: "",
1059
1057
  informative: "border border-foreground/15",
1060
1058
  destructive: "border border-destructive/45",
1059
+ "destructive-solid": "",
1061
1060
  secondary: "border border-border",
1062
1061
  ghost: "",
1063
1062
  link: ""
@@ -1066,6 +1065,7 @@ var TIMBAL_V2_SHADOW = {
1066
1065
  primary: "shadow-card",
1067
1066
  informative: "shadow-card",
1068
1067
  destructive: "shadow-card",
1068
+ "destructive-solid": "shadow-card",
1069
1069
  secondary: "shadow-card",
1070
1070
  ghost: "",
1071
1071
  link: ""
@@ -1169,7 +1169,7 @@ function DialogContent({
1169
1169
  "data-slot": "dialog-content",
1170
1170
  className: cn(
1171
1171
  TIMBAL_V2_MODAL_SURFACE,
1172
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-[70] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl p-6 duration-200 outline-none sm:max-w-lg",
1172
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-[70] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl p-5 duration-200 outline-none sm:max-w-lg",
1173
1173
  className
1174
1174
  ),
1175
1175
  ...props,
@@ -1227,9 +1227,9 @@ function isBrandedVariant(variant) {
1227
1227
  return variant === "secondary" || variant === "primary" || variant === "chart";
1228
1228
  }
1229
1229
  var AVATAR_SIZE_CLASS = {
1230
- default: "size-8",
1231
- sm: "size-6",
1232
- lg: "size-10"
1230
+ default: "size-7",
1231
+ sm: "size-5",
1232
+ lg: "size-9"
1233
1233
  };
1234
1234
  function Avatar({
1235
1235
  className,
@@ -1311,8 +1311,8 @@ function AvatarFallback({
1311
1311
  branded ? cn(
1312
1312
  "bg-transparent font-medium",
1313
1313
  TIMBAL_V2_LABEL.secondary,
1314
- "text-sm group-data-[size=sm]/avatar:text-xs"
1315
- ) : "bg-muted font-normal text-muted-foreground text-sm group-data-[size=sm]/avatar:text-xs",
1314
+ "text-xs group-data-[size=sm]/avatar:text-[10px]"
1315
+ ) : "bg-muted font-normal text-muted-foreground text-xs group-data-[size=sm]/avatar:text-[10px]",
1316
1316
  className
1317
1317
  ),
1318
1318
  style,
@@ -1346,6 +1346,11 @@ var TIMBAL_V2_FILL_AS_CHILD = {
1346
1346
  "hover:from-destructive-fill-hover-from hover:to-destructive-fill-hover-to",
1347
1347
  "active:from-destructive-fill-active-from active:to-destructive-fill-active-to"
1348
1348
  ].join(" "),
1349
+ "destructive-solid": [
1350
+ "bg-gradient-to-b from-destructive-solid-from to-destructive-solid-to",
1351
+ "hover:from-destructive-solid-hover-from hover:to-destructive-solid-hover-to",
1352
+ "active:from-destructive-solid-active-from active:to-destructive-solid-active-to"
1353
+ ].join(" "),
1349
1354
  secondary: [
1350
1355
  TIMBAL_V2_ELEVATED_GRADIENT,
1351
1356
  "hover:from-secondary-fill-hover-from hover:to-secondary-fill-hover-to",
@@ -1368,7 +1373,7 @@ var TimbalV2Button = React2.forwardRef(function TimbalV2Button2({
1368
1373
  isIconOnly = false,
1369
1374
  isLoading = false,
1370
1375
  fullWidth = false,
1371
- shape: _shape = "pill",
1376
+ shape = "pill",
1372
1377
  asChild = false,
1373
1378
  className,
1374
1379
  disabled,
@@ -1378,7 +1383,7 @@ var TimbalV2Button = React2.forwardRef(function TimbalV2Button2({
1378
1383
  }, ref) {
1379
1384
  const isDisabled = disabled || isLoading;
1380
1385
  const sizeClass = isIconOnly ? TIMBAL_V2_SIZE_ICON[size] : TIMBAL_V2_SIZE_HEIGHT[size];
1381
- const radiusClass = "rounded-full";
1386
+ const radiusClass = shape === "rect" ? "rounded-lg" : "rounded-full";
1382
1387
  const sharedRootClass = cn(
1383
1388
  "relative box-border inline-flex items-center justify-center gap-2 whitespace-nowrap border-0 text-sm font-normal shadow-none transition duration-200 ease-in-out",
1384
1389
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",
@@ -1679,7 +1684,7 @@ function ChartContainer({
1679
1684
  ...props,
1680
1685
  children: [
1681
1686
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartStyle, { id: chartId, config }),
1682
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RechartsPrimitive.ResponsiveContainer, { children })
1687
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RechartsPrimitive.ResponsiveContainer, { width: "100%", height: "100%", children })
1683
1688
  ]
1684
1689
  }
1685
1690
  ) });
@@ -1710,6 +1715,36 @@ ${colorConfig.map(([key, itemConfig]) => {
1710
1715
  );
1711
1716
  };
1712
1717
  var ChartTooltip = RechartsPrimitive.Tooltip;
1718
+ var CHART_TOOLTIP_SURFACE = "rounded-xl border px-5 py-4 text-left text-[11px] leading-snug shadow-[0_12px_40px_-10px_rgba(0,0,0,0.55)] border-white/10 bg-gradient-to-b from-neutral-800 to-neutral-950 text-white dark:border-black/10 dark:from-white dark:to-neutral-100 dark:text-neutral-900";
1719
+ var CHART_TOOLTIP_TEXT = "text-white dark:text-neutral-900";
1720
+ var CHART_TOOLTIP_MUTED = "text-neutral-300 dark:text-neutral-600";
1721
+ function isCssColor(value) {
1722
+ return typeof value === "string" && value.length > 0 && !value.startsWith("url(");
1723
+ }
1724
+ function resolvePayloadConfigKey(payload, key) {
1725
+ if (typeof payload !== "object" || payload === null) {
1726
+ return key;
1727
+ }
1728
+ const row = payload;
1729
+ const nested = "payload" in row && typeof row.payload === "object" && row.payload !== null ? row.payload : void 0;
1730
+ if (key in row && typeof row[key] === "string") {
1731
+ return row[key];
1732
+ }
1733
+ if (nested && key in nested && typeof nested[key] === "string") {
1734
+ return nested[key];
1735
+ }
1736
+ if (typeof row.value === "string") {
1737
+ return row.value;
1738
+ }
1739
+ return key;
1740
+ }
1741
+ function resolveSwatchColor(itemConfig, configKey, ...candidates) {
1742
+ for (const candidate of candidates) {
1743
+ if (isCssColor(candidate)) return candidate;
1744
+ }
1745
+ if (isCssColor(itemConfig?.color)) return itemConfig.color;
1746
+ return `var(--color-${configKey})`;
1747
+ }
1713
1748
  function ChartTooltipContent({
1714
1749
  active,
1715
1750
  payload,
@@ -1721,6 +1756,7 @@ function ChartTooltipContent({
1721
1756
  labelFormatter,
1722
1757
  labelClassName,
1723
1758
  formatter,
1759
+ valueFormatter,
1724
1760
  color,
1725
1761
  nameKey,
1726
1762
  labelKey
@@ -1735,12 +1771,12 @@ function ChartTooltipContent({
1735
1771
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
1736
1772
  const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
1737
1773
  if (labelFormatter) {
1738
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
1774
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("font-medium leading-none", labelClassName), children: labelFormatter(value, payload) });
1739
1775
  }
1740
1776
  if (!value) {
1741
1777
  return null;
1742
1778
  }
1743
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("font-medium", labelClassName), children: value });
1779
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("font-medium leading-none", labelClassName), children: value });
1744
1780
  }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
1745
1781
  if (!active || !payload?.length) {
1746
1782
  return null;
@@ -1750,7 +1786,8 @@ function ChartTooltipContent({
1750
1786
  "div",
1751
1787
  {
1752
1788
  className: cn(
1753
- "border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
1789
+ "grid min-w-[8rem] items-start gap-1.5",
1790
+ CHART_TOOLTIP_SURFACE,
1754
1791
  "animate-in fade-in-0 zoom-in-95 duration-150",
1755
1792
  className
1756
1793
  ),
@@ -1758,31 +1795,35 @@ function ChartTooltipContent({
1758
1795
  !nestLabel ? tooltipLabel : null,
1759
1796
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
1760
1797
  const key = `${nameKey || item.name || item.dataKey || "value"}`;
1798
+ const configKey = resolvePayloadConfigKey(item, key);
1761
1799
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
1762
- const indicatorColor = color || item.payload?.fill || item.color;
1800
+ const indicatorColor = resolveSwatchColor(
1801
+ itemConfig,
1802
+ configKey,
1803
+ color,
1804
+ item.payload?.fill,
1805
+ item.color
1806
+ );
1763
1807
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1764
1808
  "div",
1765
1809
  {
1766
1810
  className: cn(
1767
- "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
1811
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-neutral-500 dark:[&>svg]:text-neutral-400",
1768
1812
  indicator === "dot" && "items-center"
1769
1813
  ),
1770
1814
  children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1771
1815
  itemConfig?.icon ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1772
1816
  "div",
1773
1817
  {
1774
- className: cn(
1775
- "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
1776
- {
1777
- "h-2.5 w-2.5": indicator === "dot",
1778
- "w-1": indicator === "line",
1779
- "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
1780
- "my-0.5": nestLabel && indicator === "dashed"
1781
- }
1782
- ),
1818
+ className: cn("shrink-0 rounded-[2px]", {
1819
+ "h-2.5 w-2.5": indicator === "dot",
1820
+ "w-1": indicator === "line",
1821
+ "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
1822
+ "my-0.5": nestLabel && indicator === "dashed"
1823
+ }),
1783
1824
  style: {
1784
- "--color-bg": indicatorColor,
1785
- "--color-border": indicatorColor
1825
+ backgroundColor: indicator === "dashed" ? void 0 : indicatorColor,
1826
+ borderColor: indicatorColor
1786
1827
  }
1787
1828
  }
1788
1829
  ),
@@ -1790,15 +1831,15 @@ function ChartTooltipContent({
1790
1831
  "div",
1791
1832
  {
1792
1833
  className: cn(
1793
- "flex flex-1 justify-between leading-none",
1834
+ "flex flex-1 justify-between gap-3 leading-none",
1794
1835
  nestLabel ? "items-end" : "items-center"
1795
1836
  ),
1796
1837
  children: [
1797
1838
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid gap-1.5", children: [
1798
1839
  nestLabel ? tooltipLabel : null,
1799
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", children: itemConfig?.label || item.name })
1840
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: CHART_TOOLTIP_MUTED, children: itemConfig?.label || item.name })
1800
1841
  ] }),
1801
- item.value != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-foreground font-mono font-medium tabular-nums", children: typeof item.value === "number" ? item.value.toLocaleString() : String(item.value) })
1842
+ item.value != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("font-medium tabular-nums", CHART_TOOLTIP_TEXT), children: valueFormatter ? valueFormatter(item.value, item) : typeof item.value === "number" ? item.value.toLocaleString() : String(item.value) })
1802
1843
  ]
1803
1844
  }
1804
1845
  )
@@ -1833,7 +1874,9 @@ function ChartLegendContent({
1833
1874
  ),
1834
1875
  children: payload.filter((item) => item.type !== "none").map((item, index) => {
1835
1876
  const key = `${nameKey || item.dataKey || "value"}`;
1877
+ const configKey = resolvePayloadConfigKey(item, key);
1836
1878
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
1879
+ const swatchColor = resolveSwatchColor(itemConfig, configKey, item.color);
1837
1880
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1838
1881
  "div",
1839
1882
  {
@@ -1843,7 +1886,7 @@ function ChartLegendContent({
1843
1886
  "div",
1844
1887
  {
1845
1888
  className: "h-2 w-2 shrink-0 rounded-[2px]",
1846
- style: { backgroundColor: item.color }
1889
+ style: { backgroundColor: swatchColor }
1847
1890
  }
1848
1891
  ),
1849
1892
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 truncate", children: itemConfig?.label ?? (item.value != null ? String(item.value) : null) })
@@ -1859,13 +1902,7 @@ function getPayloadConfigFromPayload(config, payload, key) {
1859
1902
  if (typeof payload !== "object" || payload === null) {
1860
1903
  return void 0;
1861
1904
  }
1862
- const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
1863
- let configLabelKey = key;
1864
- if (key in payload && typeof payload[key] === "string") {
1865
- configLabelKey = payload[key];
1866
- } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
1867
- configLabelKey = payloadPayload[key];
1868
- }
1905
+ const configLabelKey = resolvePayloadConfigKey(payload, key);
1869
1906
  return configLabelKey in config ? config[configLabelKey] : config[key];
1870
1907
  }
1871
1908
 
@@ -1971,13 +2008,13 @@ function resolveChartMargin(options) {
1971
2008
  }
1972
2009
  const anyAxis = showXAxis || showYAxis;
1973
2010
  if (!anyAxis) {
1974
- return { top: 8, right: 12, bottom: 8, left: 12 };
2011
+ return { top: 8, right: 0, bottom: 0, left: 0 };
1975
2012
  }
1976
2013
  return {
1977
2014
  top: 8,
1978
- right: 12,
1979
- bottom: showXAxis ? 24 : 8,
1980
- left: showYAxis ? 8 : 12
2015
+ right: showYAxis ? 12 : 0,
2016
+ bottom: showXAxis ? 24 : 0,
2017
+ left: showYAxis ? 8 : 0
1981
2018
  };
1982
2019
  }
1983
2020
  function flushBarCategoryGap(flush, showCategoryAxis) {
@@ -2025,7 +2062,7 @@ var LineAreaChart = ({
2025
2062
  barRadius = 4,
2026
2063
  gridLines,
2027
2064
  layout = "default",
2028
- showGrid = true,
2065
+ showGrid: showGridProp,
2029
2066
  showXAxis: showXAxisProp,
2030
2067
  showYAxis: showYAxisProp,
2031
2068
  showLegend: showLegendProp,
@@ -2041,6 +2078,7 @@ var LineAreaChart = ({
2041
2078
  const xKey = xKeyProp ?? inferXKey(data);
2042
2079
  const series = resolveSeries(seriesProp, data, xKey);
2043
2080
  const flush = layout === "flush";
2081
+ const showGrid = showGridProp ?? !flush;
2044
2082
  const horizontal = orientation === "horizontal" && variant === "bar";
2045
2083
  const showXAxis = showXAxisProp ?? !flush;
2046
2084
  const showYAxis = showYAxisProp ?? !flush;
@@ -2081,14 +2119,7 @@ var LineAreaChart = ({
2081
2119
  const category = resolveTooltipCategory(label, items, xKey, data, xFmt);
2082
2120
  return category || null;
2083
2121
  },
2084
- formatter: (value, name, item) => {
2085
- const key = String(item.dataKey ?? name ?? "value");
2086
- const seriesLabel = config[key]?.label ?? name;
2087
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-1 items-center justify-between leading-none", children: [
2088
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-muted-foreground", children: seriesLabel }),
2089
- value != null ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-foreground font-mono font-medium tabular-nums", children: valueFmt(value) }) : null
2090
- ] });
2091
- }
2122
+ valueFormatter: (value) => value != null ? valueFmt(value) : null
2092
2123
  }
2093
2124
  )
2094
2125
  }
@@ -2099,13 +2130,27 @@ var LineAreaChart = ({
2099
2130
  if (variant === "bar") {
2100
2131
  const dataKeys = series.map((s) => s.dataKey);
2101
2132
  const barDefs = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BarGradientDefs, { scopeId: gradientScopeId, dataKeys, horizontal });
2102
- const bars = series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2133
+ const bars = stacked ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2134
+ import_recharts.BarStack,
2135
+ {
2136
+ radius: barCornerRadius(barRadius, horizontal, false),
2137
+ stackId: "stack",
2138
+ children: series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2139
+ import_recharts.Bar,
2140
+ {
2141
+ dataKey: s.dataKey,
2142
+ fill: `url(#${barGradientId(gradientScopeId, s.dataKey)})`,
2143
+ isAnimationActive: true
2144
+ },
2145
+ s.dataKey
2146
+ ))
2147
+ }
2148
+ ) : series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2103
2149
  import_recharts.Bar,
2104
2150
  {
2105
2151
  dataKey: s.dataKey,
2106
2152
  fill: `url(#${barGradientId(gradientScopeId, s.dataKey)})`,
2107
- radius: barCornerRadius(barRadius, horizontal, stacked),
2108
- stackId: stacked ? "stack" : void 0,
2153
+ radius: barCornerRadius(barRadius, horizontal, false),
2109
2154
  isAnimationActive: true
2110
2155
  },
2111
2156
  s.dataKey
@@ -2178,7 +2223,7 @@ var LineAreaChart = ({
2178
2223
  tick: categoryTick("middle"),
2179
2224
  ...flushCategoryXAxisProps
2180
2225
  }
2181
- ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.XAxis, { dataKey: xKey, hide: true }),
2226
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.XAxis, { dataKey: xKey, hide: true, height: 0 }),
2182
2227
  showYAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2183
2228
  import_recharts.YAxis,
2184
2229
  {
@@ -2189,7 +2234,7 @@ var LineAreaChart = ({
2189
2234
  tickFormatter: (v) => valueFmt(v),
2190
2235
  domain: yDomain
2191
2236
  }
2192
- ) : null,
2237
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.YAxis, { hide: true, width: 0, domain: yDomain }),
2193
2238
  tooltipEl,
2194
2239
  legendEl,
2195
2240
  bars
@@ -2225,7 +2270,7 @@ var LineAreaChart = ({
2225
2270
  tickFormatter: (v, i) => xFmt(v, i),
2226
2271
  ...flushCategoryXAxisProps
2227
2272
  }
2228
- ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.XAxis, { dataKey: chartXKey, hide: true }),
2273
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.XAxis, { dataKey: chartXKey, hide: true, height: 0 }),
2229
2274
  showYAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2230
2275
  import_recharts.YAxis,
2231
2276
  {
@@ -2236,7 +2281,7 @@ var LineAreaChart = ({
2236
2281
  tickFormatter: (v) => valueFmt(v),
2237
2282
  domain: yDomain
2238
2283
  }
2239
- ) : null
2284
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.YAxis, { hide: true, width: 0, domain: yDomain })
2240
2285
  ] });
2241
2286
  const chartA11y = flush ? {} : { accessibilityLayer: true };
2242
2287
  if (variant === "area") {
@@ -2415,7 +2460,7 @@ var PieChart = ({
2415
2460
  fill: palette[i % palette.length]
2416
2461
  }));
2417
2462
  const config = {};
2418
- for (const s of slices) config[s.name] = { label: s.name };
2463
+ for (const s of slices) config[s.name] = { label: s.name, color: s.fill };
2419
2464
  const innerPct = innerRadius > 0 ? `${Math.round(innerRadius * 75)}%` : 0;
2420
2465
  const hasCenter = innerRadius > 0 && (centerValue != null || centerLabel != null);
2421
2466
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
@@ -2535,7 +2580,7 @@ var RadialChart = ({
2535
2580
  }));
2536
2581
  const max = maxValue ?? Math.max(...rows.map((r) => r.value), 1);
2537
2582
  const config = {};
2538
- for (const r of rows) config[r.name] = { label: r.name };
2583
+ for (const r of rows) config[r.name] = { label: r.name, color: r.fill };
2539
2584
  const hasCenter = centerValue != null || centerLabel != null;
2540
2585
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("flex w-full flex-col items-center gap-3", className), children: [
2541
2586
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
@@ -3209,69 +3254,181 @@ var import_react16 = require("@assistant-ui/react");
3209
3254
 
3210
3255
  // src/ui/button.tsx
3211
3256
  var import_class_variance_authority = require("class-variance-authority");
3257
+ var import_radix_ui5 = require("radix-ui");
3212
3258
  var import_jsx_runtime24 = require("react/jsx-runtime");
3213
- var LEGACY_SIZE_TO_V2 = {
3214
- default: "md",
3215
- xs: "xs",
3216
- sm: "sm",
3217
- lg: "lg",
3218
- icon: "sm",
3219
- "icon-xs": "xs",
3220
- "icon-sm": "sm",
3221
- "icon-lg": "lg"
3222
- };
3259
+ var SOLID_SKEUOMORPHIC_SHADOW = "shadow-skeuomorphic-solid";
3260
+ var BORDERED_SKEUOMORPHIC_SHADOW = "shadow-skeuomorphic-bordered";
3223
3261
  var buttonVariants = (0, import_class_variance_authority.cva)(
3224
- "inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0",
3262
+ cn(
3263
+ "relative inline-flex shrink-0 cursor-pointer select-none items-center justify-center whitespace-nowrap font-medium",
3264
+ "transition-all duration-300 ease-in-out outline-none border",
3265
+ "focus-visible:ring-4 focus-visible:ring-primary/20 focus-visible:ring-offset-0",
3266
+ "disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:pointer-events-none",
3267
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5",
3268
+ // Overflow hidden can clip out-of-bounds shadow, so we use precise overflow management and rounded-[inherit] on pseudo overlays
3269
+ "after:absolute after:inset-0 after:rounded-[inherit] after:pointer-events-none after:transition-opacity after:duration-300 after:ease-in-out after:opacity-0"
3270
+ ),
3225
3271
  {
3226
3272
  variants: {
3227
- variant: {
3228
- default: "",
3229
- destructive: "",
3230
- outline: "",
3231
- secondary: "",
3232
- ghost: "",
3233
- link: ""
3273
+ color: {
3274
+ primary: cn(
3275
+ // Exact Premium Untitled UI primary BLACK / dark charcoal: gradient + borders
3276
+ "bg-gradient-to-b from-[#344054] to-[#0F1117] text-white border-[#1A1E29]",
3277
+ "hover:border-[#181C26]",
3278
+ "active:border-[#0A0D14]",
3279
+ SOLID_SKEUOMORPHIC_SHADOW,
3280
+ // Hover/active overlays for beautiful animation (the gradient is static, the overlay opacity is transitioned)
3281
+ "after:bg-white/[0.08] hover:after:opacity-100 active:after:bg-black/[0.12]",
3282
+ // Premium Dark Mode inversion: Primary becomes white, popping out elegantly
3283
+ "dark:bg-gradient-to-b dark:from-white dark:to-[#F9FAFB] dark:text-[#10121C] dark:border-white",
3284
+ "dark:hover:border-[#D0D5DD] dark:hover:text-[#10121C]",
3285
+ "dark:shadow-skeuomorphic-bordered",
3286
+ "dark:after:bg-black/[0.04] dark:active:after:bg-black/[0.08]"
3287
+ ),
3288
+ secondary: cn(
3289
+ // Exact Untitled UI secondary: premium white/gray gradient + borders
3290
+ "bg-gradient-to-b from-white to-[#F9FAFB] text-[#344054] border-[#D0D5DD]",
3291
+ "hover:text-[#1D2939] hover:border-[#D0D5DD]",
3292
+ BORDERED_SKEUOMORPHIC_SHADOW,
3293
+ // Hover/active overlays for white/gray gradient
3294
+ "after:bg-black/[0.03] hover:after:opacity-100 active:after:bg-black/[0.08]",
3295
+ // Premium Dark Mode inversion: Secondary becomes dark charcoal/gray, merging into the background
3296
+ "dark:bg-gradient-to-b dark:from-[#1F242F] dark:to-[#10121C] dark:text-[#D1D5DB] dark:border-[#344054]",
3297
+ "dark:hover:border-[#475467] dark:hover:text-white",
3298
+ "dark:shadow-skeuomorphic-solid",
3299
+ "dark:after:bg-white/[0.06] dark:active:after:bg-black/[0.15]"
3300
+ ),
3301
+ tertiary: cn(
3302
+ "bg-transparent text-[#475467] border-transparent",
3303
+ "hover:bg-[#F9FAFB] hover:text-[#344054]",
3304
+ "active:bg-[#F2F4F7] active:text-[#1D2939]",
3305
+ "after:hidden",
3306
+ // No overlay needed for transparent surfaces
3307
+ // Dark Mode
3308
+ "dark:text-[#9CA3AF] dark:hover:bg-[#1F242F] dark:hover:text-white dark:active:bg-[#11131A]"
3309
+ ),
3310
+ link: cn(
3311
+ "h-auto! bg-transparent p-0! border-transparent text-[#1F242F] hover:text-[#10121C]",
3312
+ "hover:underline",
3313
+ "after:hidden",
3314
+ // Dark Mode
3315
+ "dark:text-[#9CA3AF] dark:hover:text-white"
3316
+ ),
3317
+ "primary-destructive": cn(
3318
+ // Exact Untitled UI primary destructive: premium red gradient + borders (vibrant and subtle, not too dark)
3319
+ "bg-gradient-to-b from-[#D92D20] to-[#B42318] text-white border-[#B42318]",
3320
+ "hover:border-[#9E1B12]",
3321
+ "active:border-[#84140D]",
3322
+ SOLID_SKEUOMORPHIC_SHADOW,
3323
+ // Destructive red hover/active overlays
3324
+ "after:bg-white/[0.12] hover:after:opacity-100 active:after:bg-black/[0.15]"
3325
+ ),
3326
+ "secondary-destructive": cn(
3327
+ // Exact Untitled UI secondary destructive: soft red bordered
3328
+ "bg-gradient-to-b from-white to-[#F9FAFB] text-[#B42318] border-[#FDA29B]",
3329
+ "hover:text-[#9E1B12] hover:border-[#FDA29B]",
3330
+ BORDERED_SKEUOMORPHIC_SHADOW,
3331
+ // Hover overlay
3332
+ "after:bg-red-500/[0.04] hover:after:opacity-100 active:after:bg-red-950/[0.08]",
3333
+ // Dark Mode Secondary Destructive: Charcoal fill with red borders and label
3334
+ "dark:bg-gradient-to-b dark:from-[#1F242F] dark:to-[#10121C] dark:text-[#F87171] dark:border-[#9E1B12]/50",
3335
+ "dark:hover:border-[#F87171]/40",
3336
+ "dark:shadow-skeuomorphic-solid",
3337
+ "dark:after:bg-white/[0.06] dark:active:after:bg-black/[0.15]"
3338
+ )
3234
3339
  },
3235
3340
  size: {
3236
- default: "",
3237
- xs: "",
3238
- sm: "",
3239
- lg: "",
3240
- icon: "",
3241
- "icon-xs": "",
3242
- "icon-sm": "",
3243
- "icon-lg": ""
3341
+ xs: "h-7 gap-1 rounded-md px-2 text-xs",
3342
+ sm: "h-8 gap-1 rounded-md px-2.5 text-xs",
3343
+ md: "h-9 gap-1.5 rounded-lg px-3 text-sm",
3344
+ lg: "h-10 gap-1.5 rounded-lg px-3.5 text-sm",
3345
+ xl: "h-11 gap-2 rounded-lg px-4 text-base",
3346
+ default: "h-9 gap-1.5 rounded-lg px-3 text-sm",
3347
+ icon: "h-9 w-9 rounded-lg",
3348
+ "icon-xs": "h-7 w-7 rounded-md",
3349
+ "icon-sm": "h-8 w-8 rounded-md",
3350
+ "icon-lg": "h-10 w-10 rounded-lg"
3351
+ },
3352
+ shape: {
3353
+ pill: "rounded-full!",
3354
+ rounded: ""
3355
+ // defaults to the size variant's standard rounded-lg
3244
3356
  }
3245
3357
  },
3246
3358
  defaultVariants: {
3247
- variant: "default",
3248
- size: "default"
3359
+ color: "primary",
3360
+ size: "default",
3361
+ shape: "rounded"
3249
3362
  }
3250
3363
  }
3251
3364
  );
3252
3365
  function Button({
3253
3366
  className,
3254
- variant = "default",
3255
- size = "default",
3367
+ variant,
3368
+ color,
3369
+ size,
3370
+ shape,
3371
+ iconLeading,
3372
+ iconTrailing,
3373
+ isLoading = false,
3256
3374
  asChild = false,
3375
+ disabled,
3376
+ type = "button",
3377
+ children,
3257
3378
  ...props
3258
3379
  }) {
3259
- const v2Variant = TIMBAL_V2_FROM_LEGACY_BUTTON[variant ?? "default"];
3260
- const v2Size = LEGACY_SIZE_TO_V2[size ?? "default"];
3261
- const isIconOnly = typeof size === "string" && size.startsWith("icon");
3262
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3263
- TimbalV2Button,
3380
+ const isDisabled = disabled || isLoading;
3381
+ let resolvedColor = "primary";
3382
+ if (color) {
3383
+ resolvedColor = color;
3384
+ } else if (variant) {
3385
+ if (variant === "default" || variant === "informative") resolvedColor = "primary";
3386
+ else if (variant === "secondary" || variant === "outline") resolvedColor = "secondary";
3387
+ else if (variant === "destructive") resolvedColor = "primary-destructive";
3388
+ else if (variant === "ghost") resolvedColor = "tertiary";
3389
+ else if (variant === "link") resolvedColor = "link";
3390
+ }
3391
+ const classes = cn(
3392
+ buttonVariants({
3393
+ color: resolvedColor,
3394
+ size: size ?? "default",
3395
+ shape: shape ?? "rounded"
3396
+ }),
3397
+ className
3398
+ );
3399
+ if (asChild) {
3400
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3401
+ import_radix_ui5.Slot.Root,
3402
+ {
3403
+ className: classes,
3404
+ "aria-disabled": isDisabled ? true : void 0,
3405
+ "data-slot": "button",
3406
+ "data-variant": resolvedColor,
3407
+ ...props,
3408
+ children
3409
+ }
3410
+ );
3411
+ }
3412
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3413
+ "button",
3264
3414
  {
3415
+ type,
3416
+ disabled: isDisabled,
3265
3417
  "data-slot": "button",
3266
- "data-variant": variant,
3267
- "data-size": size,
3268
- variant: v2Variant,
3269
- size: v2Size,
3270
- shape: "pill",
3271
- isIconOnly,
3272
- asChild,
3273
- className: cn(buttonVariants({ variant, size, className })),
3274
- ...props
3418
+ "data-variant": resolvedColor,
3419
+ className: classes,
3420
+ ...props,
3421
+ children: [
3422
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3423
+ "span",
3424
+ {
3425
+ "aria-hidden": true,
3426
+ className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent"
3427
+ }
3428
+ ) : iconLeading,
3429
+ children,
3430
+ !isLoading ? iconTrailing : null
3431
+ ]
3275
3432
  }
3276
3433
  );
3277
3434
  }
@@ -3447,7 +3604,7 @@ var BadgeNode = ({ node }) => {
3447
3604
  "span",
3448
3605
  {
3449
3606
  className: cn(
3450
- "aui-ui-badge inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",
3607
+ "aui-ui-badge inline-flex w-fit shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-medium",
3451
3608
  BADGE_TONE[node.tone ?? "default"],
3452
3609
  node.className
3453
3610
  ),