@copilotkit/react-core 1.88.0 → 1.90.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 (40) hide show
  1. package/dist/{copilotkit-D4AAgBT1.cjs → copilotkit-CBTsyfYP.cjs} +267 -61
  2. package/dist/copilotkit-CBTsyfYP.cjs.map +1 -0
  3. package/dist/{copilotkit-RAr-1JSr.d.mts → copilotkit-CfnudBCL.d.mts} +20 -5
  4. package/dist/copilotkit-CfnudBCL.d.mts.map +1 -0
  5. package/dist/{copilotkit-CYqkB8Nv.mjs → copilotkit-CslZDEfY.mjs} +271 -65
  6. package/dist/copilotkit-CslZDEfY.mjs.map +1 -0
  7. package/dist/{copilotkit-BS_3fQrS.d.cts → copilotkit-XLp7jKQk.d.cts} +20 -5
  8. package/dist/copilotkit-XLp7jKQk.d.cts.map +1 -0
  9. package/dist/{hooks-CEFWIeKR.d.cts → hooks-DMSkcNOl.d.cts} +4 -4
  10. package/dist/{hooks-CEFWIeKR.d.cts.map → hooks-DMSkcNOl.d.cts.map} +1 -1
  11. package/dist/{hooks-DFgYRjj3.d.mts → hooks-EwGvqYsW.d.mts} +4 -4
  12. package/dist/{hooks-DFgYRjj3.d.mts.map → hooks-EwGvqYsW.d.mts.map} +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.d.cts +1 -1
  15. package/dist/index.d.mts +1 -1
  16. package/dist/index.mjs +1 -1
  17. package/dist/index.umd.js +15 -10
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/generative-ui/native.d.cts +1 -1
  20. package/dist/v2/generative-ui/native.d.mts +1 -1
  21. package/dist/v2/generative-ui.cjs +66 -33
  22. package/dist/v2/generative-ui.cjs.map +1 -1
  23. package/dist/v2/generative-ui.d.cts +47 -47
  24. package/dist/v2/generative-ui.d.cts.map +1 -1
  25. package/dist/v2/generative-ui.d.mts +47 -47
  26. package/dist/v2/generative-ui.d.mts.map +1 -1
  27. package/dist/v2/generative-ui.mjs +66 -33
  28. package/dist/v2/generative-ui.mjs.map +1 -1
  29. package/dist/v2/index.cjs +19 -1
  30. package/dist/v2/index.css +1 -1
  31. package/dist/v2/index.d.cts +2 -2
  32. package/dist/v2/index.d.mts +2 -2
  33. package/dist/v2/index.mjs +2 -2
  34. package/dist/v2/index.umd.js +284 -60
  35. package/dist/v2/index.umd.js.map +1 -1
  36. package/package.json +10 -10
  37. package/dist/copilotkit-BS_3fQrS.d.cts.map +0 -1
  38. package/dist/copilotkit-CYqkB8Nv.mjs.map +0 -1
  39. package/dist/copilotkit-D4AAgBT1.cjs.map +0 -1
  40. package/dist/copilotkit-RAr-1JSr.d.mts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { C as createGenerativeUI, E as useGenerativeUIAccessibility, O as GenerativeUIChatSurfaceProps, S as GenerativeUIStateOf, T as GenerativeUIAriaAttributes, _ as GenerativeUIFunctionArgs, a as GenerativeUIRuntimeContext, b as GenerativeUIFunctionName, c as useGenerativeUIRuntime, d as GenerativeUI, f as GenerativeUIComponentDefinition, g as GenerativeUIEventDefinition, i as GenerativeUIRuntime, k as GenerativeUIToolCallRenderer, l as useRequiredGenerativeUIRuntime, m as GenerativeUIComponentProps, n as GenerativeUIErrorBoundaryConfig, o as GenerativeUITheme, p as GenerativeUIComponentName, r as GenerativeUIMarkdownConfig, s as GenerativeUIToolConfig, t as GenerativeUIConfig, u as CreateGenerativeUIConfig, v as GenerativeUIFunctionDefinition, w as GenerativeUIAccessibility, x as GenerativeUISlotKind, y as GenerativeUIFunctionInput } from "../../runtime-context-Da7T5vy4.cjs";
2
- import { a as childList, i as child, n as useGenerativeUIState, r as useManagerVersion, t as useGenerativeUIFunction } from "../../hooks-CEFWIeKR.cjs";
2
+ import { a as childList, i as child, n as useGenerativeUIState, r as useManagerVersion, t as useGenerativeUIFunction } from "../../hooks-DMSkcNOl.cjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
  import React, { ComponentType, ReactNode } from "react";
5
5
  import { GenerativeUIRejectedOperation, GenerativeUISurfaceContent } from "@copilotkit/shared";
@@ -1,5 +1,5 @@
1
1
  import { C as createGenerativeUI, E as useGenerativeUIAccessibility, O as GenerativeUIChatSurfaceProps, S as GenerativeUIStateOf, T as GenerativeUIAriaAttributes, _ as GenerativeUIFunctionArgs, a as GenerativeUIRuntimeContext, b as GenerativeUIFunctionName, c as useGenerativeUIRuntime, d as GenerativeUI, f as GenerativeUIComponentDefinition, g as GenerativeUIEventDefinition, i as GenerativeUIRuntime, k as GenerativeUIToolCallRenderer, l as useRequiredGenerativeUIRuntime, m as GenerativeUIComponentProps, n as GenerativeUIErrorBoundaryConfig, o as GenerativeUITheme, p as GenerativeUIComponentName, r as GenerativeUIMarkdownConfig, s as GenerativeUIToolConfig, t as GenerativeUIConfig, u as CreateGenerativeUIConfig, v as GenerativeUIFunctionDefinition, w as GenerativeUIAccessibility, x as GenerativeUISlotKind, y as GenerativeUIFunctionInput } from "../../runtime-context-B4fKyzo6.mjs";
2
- import { a as childList, i as child, n as useGenerativeUIState, r as useManagerVersion, t as useGenerativeUIFunction } from "../../hooks-DFgYRjj3.mjs";
2
+ import { a as childList, i as child, n as useGenerativeUIState, r as useManagerVersion, t as useGenerativeUIFunction } from "../../hooks-EwGvqYsW.mjs";
3
3
  import React, { ComponentType, ReactNode } from "react";
4
4
  import { GenerativeUIRejectedOperation, GenerativeUISurfaceContent } from "@copilotkit/shared";
5
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
@@ -2466,6 +2466,25 @@ const VISUALLY_HIDDEN = {
2466
2466
  border: 0
2467
2467
  };
2468
2468
  /** Legend labels use the text color, not the series color. */
2469
+ /**
2470
+ * A category label on the side axis of a horizontal bar chart: one line,
2471
+ * shortened to fit the axis, with the full text as a tooltip. Wrapped labels
2472
+ * there run into the labels of the neighbouring bars.
2473
+ */
2474
+ function CategoryTick(props) {
2475
+ const text = String(props.payload?.value ?? "");
2476
+ const fits = Math.max(4, Math.floor((props.width - 8) / 6.6));
2477
+ const shown = text.length > fits ? `${text.slice(0, fits - 1).trimEnd()}…` : text;
2478
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("text", {
2479
+ x: props.x,
2480
+ y: props.y,
2481
+ dy: "0.35em",
2482
+ textAnchor: "end",
2483
+ fontSize: 12,
2484
+ fill: props.fill,
2485
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("title", { children: text }), shown]
2486
+ });
2487
+ }
2469
2488
  function legendFormatter(value) {
2470
2489
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2471
2490
  style: {
@@ -2575,9 +2594,11 @@ function createRechartsChart(R) {
2575
2594
  fontSize: 12,
2576
2595
  fill: (0, _copilotkit_shared_generative_ui.textColor)("secondary")
2577
2596
  };
2597
+ const isHorizontal = props.layout === "horizontal";
2578
2598
  const valueLabel = props.showValueLabels ? {
2579
- position: "top",
2599
+ position: isHorizontal ? "right" : "top",
2580
2600
  fontSize: 11,
2601
+ fill: (0, _copilotkit_shared_generative_ui.textColor)("secondary"),
2581
2602
  formatter: format
2582
2603
  } : void 0;
2583
2604
  const tooltip = showTooltip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(R.Tooltip, {
@@ -2616,10 +2637,11 @@ function createRechartsChart(R) {
2616
2637
  }
2617
2638
  const CartesianChart = cartesianChartOf(R, chartType);
2618
2639
  const stackId = props.stacked ? "stack" : void 0;
2619
- const isHorizontal = props.layout === "horizontal";
2620
2640
  const xKey = props.xKey;
2621
2641
  const isNumericScatter = chartType === "scatter" && xKey !== void 0 && data.length > 0 && data.every((row) => typeof row[xKey] === "number" && Number.isFinite(row[xKey]));
2622
2642
  const domain = [props.yAxis?.min ?? "auto", props.yAxis?.max ?? "auto"];
2643
+ const longestCategory = Math.max(0, ...data.map((row) => props.xKey ? String(row[props.xKey] ?? "").length : 0));
2644
+ const categoryWidth = props.yAxis?.width ?? Math.min(168, Math.max(64, Math.ceil(longestCategory * 6.6) + 12));
2623
2645
  const valueAxisLabel = props.yAxis?.label ? {
2624
2646
  value: props.yAxis.label,
2625
2647
  position: isHorizontal ? "insideBottom" : "insideLeft",
@@ -2697,7 +2719,7 @@ function createRechartsChart(R) {
2697
2719
  layout: isHorizontal ? "vertical" : "horizontal",
2698
2720
  margin: {
2699
2721
  top: 8,
2700
- right: 8,
2722
+ right: isHorizontal && props.showValueLabels ? 48 : 8,
2701
2723
  bottom: 0,
2702
2724
  left: 0
2703
2725
  },
@@ -2715,14 +2737,19 @@ function createRechartsChart(R) {
2715
2737
  tickLine: false,
2716
2738
  axisLine: { stroke: (0, _copilotkit_shared_generative_ui.borderColor)("default") },
2717
2739
  tickFormatter: format,
2718
- label: valueAxisLabel
2740
+ label: valueAxisLabel,
2741
+ height: valueAxisLabel ? 48 : void 0
2719
2742
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(R.YAxis, {
2720
2743
  type: isNumericScatter ? "number" : "category",
2721
2744
  dataKey: props.xKey,
2722
- tick: axisTick,
2745
+ interval: 0,
2746
+ tick: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CategoryTick, {
2747
+ width: categoryWidth,
2748
+ fill: axisTick.fill
2749
+ }),
2723
2750
  tickLine: false,
2724
2751
  axisLine: false,
2725
- width: props.yAxis?.width ?? 96
2752
+ width: categoryWidth
2726
2753
  })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(R.XAxis, {
2727
2754
  type: isNumericScatter ? "number" : "category",
2728
2755
  dataKey: props.xKey,
@@ -3234,7 +3261,32 @@ function Table(props) {
3234
3261
  maxHeight: props.stickyHeader ? 480 : void 0,
3235
3262
  overflowY: props.stickyHeader ? "auto" : void 0
3236
3263
  };
3237
- if (props.children !== void 0 && rows.length === 0 && columns.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3264
+ const isChildrenMode = props.children !== void 0 && rows.length === 0;
3265
+ const rowLengths = rows.map((row) => row.length);
3266
+ const columnCount = Math.max(columns.length, ...rowLengths, 1);
3267
+ const stickyStyle = props.stickyHeader ? {
3268
+ position: "sticky",
3269
+ top: 0,
3270
+ background: (0, _copilotkit_shared_generative_ui.backgroundColor)("surface")
3271
+ } : {};
3272
+ const header = columns.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: columns.map((column, index) => {
3273
+ const cell = cellAttributes({
3274
+ isHeader: true,
3275
+ hasDivider: true,
3276
+ align: column.align,
3277
+ width: column.width
3278
+ });
3279
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", {
3280
+ scope: "col",
3281
+ ...cell,
3282
+ style: {
3283
+ ...cell.style,
3284
+ ...stickyStyle
3285
+ },
3286
+ children: [column.label, column.componentId ? components.get(column.componentId) : null]
3287
+ }, `${column.label ?? column.componentId}-${index}`);
3288
+ }) }) }) : null;
3289
+ if (isChildrenMode) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3238
3290
  className: "a2ui-std-table-wrap",
3239
3291
  "data-a2ui-std": "",
3240
3292
  style: wrapperStyle,
@@ -3247,17 +3299,14 @@ function Table(props) {
3247
3299
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
3248
3300
  className: "a2ui-std-table",
3249
3301
  style: tableStyle,
3250
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Caption$1, { text: props.caption }), props.children]
3302
+ children: [
3303
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Caption$1, { text: props.caption }),
3304
+ header,
3305
+ props.children
3306
+ ]
3251
3307
  })
3252
3308
  })
3253
3309
  });
3254
- const rowLengths = rows.map((row) => row.length);
3255
- const columnCount = Math.max(columns.length, ...rowLengths, 1);
3256
- const stickyStyle = props.stickyHeader ? {
3257
- position: "sticky",
3258
- top: 0,
3259
- background: (0, _copilotkit_shared_generative_ui.backgroundColor)("surface")
3260
- } : {};
3261
3310
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3262
3311
  className: "a2ui-std-table-wrap",
3263
3312
  "data-a2ui-std": "",
@@ -3267,23 +3316,7 @@ function Table(props) {
3267
3316
  style: tableStyle,
3268
3317
  children: [
3269
3318
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Caption$1, { text: props.caption }),
3270
- columns.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: columns.map((column, index) => {
3271
- const cell = cellAttributes({
3272
- isHeader: true,
3273
- hasDivider: true,
3274
- align: column.align,
3275
- width: column.width
3276
- });
3277
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("th", {
3278
- scope: "col",
3279
- ...cell,
3280
- style: {
3281
- ...cell.style,
3282
- ...stickyStyle
3283
- },
3284
- children: [column.label, column.componentId ? components.get(column.componentId) : null]
3285
- }, `${column.label ?? column.componentId}-${index}`);
3286
- }) }) }) : null,
3319
+ header,
3287
3320
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: rows.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
3288
3321
  colSpan: columnCount,
3289
3322
  className: "a2ui-std-cell",
@@ -4961,7 +4994,7 @@ function Select(props) {
4961
4994
  ...controlStyle(props, "xl"),
4962
4995
  ...SELECT_STYLE,
4963
4996
  width: props.block === false ? void 0 : "100%",
4964
- paddingLeft: props.icon ? `${PAD_X[props.size ?? "xl"] + 24}px` : void 0
4997
+ ...props.icon ? { paddingLeft: `${PAD_X[props.size ?? "xl"] + 24}px` } : {}
4965
4998
  },
4966
4999
  ...(0, _copilotkit_core_generative_ui.controlAria)(aria),
4967
5000
  children: [hasEmptyOption ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {