@tensor_1/react 2.65.1 → 2.67.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 (53) hide show
  1. package/README.md +5 -0
  2. package/THIRD_PARTY_NOTICES.md +2 -2
  3. package/component-inventory.json +1124 -0
  4. package/dist/{ChartCore-CY5a4teJ.d.cts → ChartCore-BX0frnUz.d.cts} +1 -8
  5. package/dist/ChartMetric-bCAW4yvf.d.cts +16 -0
  6. package/dist/{GlanceCharts-Cb39RqDC.d.cts → GlanceCharts-PVaEwyp2.d.cts} +1 -1
  7. package/dist/chart-analytic.cjs +41 -38
  8. package/dist/chart-analytic.d.cts +3 -2
  9. package/dist/chart-analytic.d.ts +2 -1
  10. package/dist/chart-preset.cjs +37 -34
  11. package/dist/chart-preset.d.cts +5 -4
  12. package/dist/chart-preset.d.ts +2 -1
  13. package/dist/chart.cjs +37 -34
  14. package/dist/chart.d.cts +5 -4
  15. package/dist/chart.d.ts +2 -1
  16. package/dist/components/Avatar.d.ts +6 -3
  17. package/dist/components/Avatar.js +9 -3
  18. package/dist/components/Chart.d.ts +2 -1
  19. package/dist/components/ChartCore.d.ts +3 -8
  20. package/dist/components/ChartCore.js +1 -7
  21. package/dist/components/ChartMetric.d.ts +16 -0
  22. package/dist/components/ChartMetric.js +12 -0
  23. package/dist/components/ChartPanels.d.ts +1 -0
  24. package/dist/components/FocusOnMount.d.ts +15 -15
  25. package/dist/components/GlanceCharts.d.ts +1 -0
  26. package/dist/components/MotionList.d.ts +16 -16
  27. package/dist/components/RuleBuilder.d.ts +8 -1
  28. package/dist/components/RuleBuilder.js +34 -12
  29. package/dist/glyphs-BAAgp2Xv.d.cts +256 -0
  30. package/dist/icons/Icon.d.ts +23 -24
  31. package/dist/icons/Icon.js +13 -8
  32. package/dist/icons/components.d.ts +13 -1
  33. package/dist/icons/components.js +24 -0
  34. package/dist/icons/glyphs.d.ts +21 -1
  35. package/dist/icons/glyphs.js +33 -3
  36. package/dist/icons/intrinsic-components.d.ts +273 -0
  37. package/dist/icons/intrinsic-components.js +540 -0
  38. package/dist/icons/types.d.ts +9 -2
  39. package/dist/icons-intrinsic.cjs +1383 -0
  40. package/dist/icons-intrinsic.d.cts +275 -0
  41. package/dist/icons-intrinsic.d.ts +4 -0
  42. package/dist/icons-intrinsic.js +5 -0
  43. package/dist/icons.cjs +72 -11
  44. package/dist/icons.d.cts +18 -247
  45. package/dist/icons.d.ts +1 -1
  46. package/dist/index.cjs +355 -304
  47. package/dist/index.d.cts +17 -6
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.js +2 -0
  50. package/dist/rule-builder-model.d.ts +4 -2
  51. package/dist/rule-builder-model.js +7 -1
  52. package/dist/{types-B7OIndwg.d.cts → types-cpbqVqOW.d.cts} +9 -2
  53. package/package.json +7 -2
package/dist/chart.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { Chart, GlanceLineChart, PairedBarChart } from './components/Chart.js';
2
- export { ChartEventHandler, ChartLabels, ChartLegend, ChartLegendItem, ChartLegendItemProps, ChartLegendProps, ChartMetric, ChartMetricProps, ChartOption, ChartProps, ChartTable, ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette } from './components/ChartCore.js';
2
+ export { ChartEventHandler, ChartLabels, ChartLegend, ChartLegendItem, ChartLegendItemProps, ChartLegendProps, ChartOption, ChartProps, ChartTable, ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette } from './components/ChartCore.js';
3
+ export { ChartMetric, ChartMetricProps } from './components/ChartMetric.js';
3
4
  export { ChartTokenSource, UixChartTokens, mergeChartTheme, uixChartAreaGradient, uixChartTheme, uixChartTokens } from './chart-theme.js';
4
5
  export { GLANCE_AT_REST, GlanceFormat, GlanceLineInput, GlanceMotion, PAIRED_BARS_MAX_BUCKETS, PairedBarsInput, glanceLineOption, pairedBarsOption, uixGlanceBase } from './chart-glance.js';
5
6
  export { GlanceChartBaseProps, GlanceLineChartProps, PairedBarChartProps } from './components/GlanceCharts.js';
@@ -8,7 +8,8 @@ declare const DEFAULT_PRESENCE_LABELS: Record<AvatarPresence, string>;
8
8
  interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
9
9
  /** TENSOR RX-125 (UIX-04): translatable; English default. Still honoured for `online`. */
10
10
  onlineLabel?: string;
11
- size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl';
11
+ /** Named kit size, or positive pixels with proportional initials. Invalid numbers use md. */
12
+ size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | number;
12
13
  src?: string;
13
14
  alt?: string;
14
15
  /** Initials / fallback shown when there is no `src`. */
@@ -25,9 +26,11 @@ interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
25
26
  presenceLabels?: Partial<Record<AvatarPresence, string>>;
26
27
  }
27
28
  /** Avatar over `.uix-avatar`. Renders an image when `src` is set, else children (initials). */
28
- declare function Avatar({ size, src, alt, children, status, presence, presenceLabels, onlineLabel, className, ...props }: AvatarProps): react.JSX.Element;
29
+ declare function Avatar({ size, src, alt, children, status, presence, presenceLabels, onlineLabel, className, style, ...props }: AvatarProps): react.JSX.Element;
29
30
  interface PresenceDotProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
30
31
  presence: AvatarPresence;
32
+ /** Positive pixel dimensions; invalid or omitted values keep the kit default. */
33
+ size?: number;
31
34
  /**
32
35
  * The state in words for assistive technology. Default: the English word. Pass `null` when
33
36
  * the state is already written next to the dot, to make the dot decorative.
@@ -35,7 +38,7 @@ interface PresenceDotProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'childr
35
38
  label?: string | null;
36
39
  }
37
40
  /** The presence dot on its own, for a row or a menu that shows no avatar (HAR-1374). */
38
- declare function PresenceDot({ presence, label, className, ...props }: PresenceDotProps): react.JSX.Element;
41
+ declare function PresenceDot({ presence, label, size, className, style, ...props }: PresenceDotProps): react.JSX.Element;
39
42
  interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {
40
43
  children?: ReactNode;
41
44
  }
@@ -6,17 +6,22 @@ const DEFAULT_PRESENCE_LABELS = {
6
6
  away: "away",
7
7
  offline: "offline"
8
8
  };
9
- function Avatar({ size = "md", src, alt, children, status, presence, presenceLabels, onlineLabel, className, ...props }) {
9
+ const positivePixels = (size) => typeof size === "number" && Number.isFinite(size) && size > 0 ? size : void 0;
10
+ function Avatar({ size = "md", src, alt, children, status, presence, presenceLabels, onlineLabel, className, style, ...props }) {
10
11
  const state = presence ?? (status ? "online" : void 0);
11
12
  const word = state && (presenceLabels?.[state] ?? (state === "online" ? onlineLabel : void 0) ?? DEFAULT_PRESENCE_LABELS[state]);
12
- return /* @__PURE__ */ jsxs("span", { className: cx("uix-avatar", size !== "md" && `uix-avatar--${size}`, className), ...props, children: [
13
+ const pixels = positivePixels(size);
14
+ const resolvedStyle = pixels === void 0 ? style : { width: pixels, height: pixels, fontSize: Math.max(9, Math.round(pixels * 0.42)), ...style };
15
+ return /* @__PURE__ */ jsxs("span", { className: cx("uix-avatar", typeof size === "string" && size !== "md" && `uix-avatar--${size}`, className), style: resolvedStyle, ...props, children: [
13
16
  src ? /* @__PURE__ */ jsx("img", { src, alt: alt ?? "" }) : children,
14
17
  state && /* @__PURE__ */ jsx("span", { className: "uix-avatar__status", "data-presence": state === "online" ? void 0 : state, "aria-hidden": "true" }),
15
18
  state && /* @__PURE__ */ jsx("span", { className: "uix-visually-hidden", children: word })
16
19
  ] });
17
20
  }
18
- function PresenceDot({ presence, label, className, ...props }) {
21
+ function PresenceDot({ presence, label, size, className, style, ...props }) {
19
22
  const decorative = label === null;
23
+ const pixels = positivePixels(size);
24
+ const resolvedStyle = pixels === void 0 ? style : { width: pixels, height: pixels, ...style };
20
25
  return /* @__PURE__ */ jsx(
21
26
  "span",
22
27
  {
@@ -24,6 +29,7 @@ function PresenceDot({ presence, label, className, ...props }) {
24
29
  role: decorative ? void 0 : "img",
25
30
  "aria-label": decorative ? void 0 : label ?? DEFAULT_PRESENCE_LABELS[presence],
26
31
  "aria-hidden": decorative ? true : void 0,
32
+ style: resolvedStyle,
27
33
  ...props
28
34
  }
29
35
  );
@@ -1,10 +1,11 @@
1
1
  import * as react from 'react';
2
2
  import { ChartProps } from './ChartCore.js';
3
- export { ChartEventHandler, ChartLabels, ChartLegend, ChartLegendItem, ChartLegendItemProps, ChartLegendProps, ChartMetric, ChartMetricProps, ChartOption, ChartTable, ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette } from './ChartCore.js';
3
+ export { ChartEventHandler, ChartLabels, ChartLegend, ChartLegendItem, ChartLegendItemProps, ChartLegendProps, ChartOption, ChartTable, ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette } from './ChartCore.js';
4
4
  import { GlanceLineChartProps, PairedBarChartProps } from './GlanceCharts.js';
5
5
  export { GlanceChartBaseProps } from './GlanceCharts.js';
6
6
  export { ChartTokenSource, UixChartTokens, mergeChartTheme, uixChartAreaGradient, uixChartTheme, uixChartTokens } from '../chart-theme.js';
7
7
  export { GLANCE_AT_REST, GlanceFormat, GlanceLineInput, GlanceMotion, PAIRED_BARS_MAX_BUCKETS, PairedBarsInput, glanceLineOption, pairedBarsOption, uixGlanceBase } from '../chart-glance.js';
8
+ export { ChartMetric, ChartMetricProps } from './ChartMetric.js';
8
9
  import 'echarts';
9
10
 
10
11
  /** Full-compatibility adapter. Use `@tensor_1/react/chart/preset` for the lean preset. */
@@ -2,6 +2,7 @@ import * as react from 'react';
2
2
  import { CSSProperties, ReactNode, HTMLAttributes } from 'react';
3
3
  import { EChartsOption, ECharts } from 'echarts';
4
4
  import { UixChartTokens } from '../chart-theme.js';
5
+ export { ChartMetric, ChartMetricProps } from './ChartMetric.js';
5
6
 
6
7
  interface ChartEngine {
7
8
  init(element: HTMLElement, theme?: string | null, options?: {
@@ -73,13 +74,7 @@ interface ChartCoreProps extends ChartProps {
73
74
  }
74
75
  /** Shared chart lifecycle. Runtime adapters only choose the ECharts build. */
75
76
  declare function ChartCore({ engine, option, title, subtitle, height, className, style, ariaLabel, tableData, tableHeaders, onReady, header, headerAction, footer, loading, empty, labels: labelOverrides, theme, group, onEvents, tables, }: ChartCoreProps): react.JSX.Element;
76
- interface ChartMetricProps extends HTMLAttributes<HTMLDivElement> {
77
- value: ReactNode;
78
- label?: ReactNode;
79
- delta?: ReactNode;
80
- deltaTone?: 'neutral' | 'positive' | 'negative' | 'warning';
81
- }
82
- declare function ChartMetric({ value, label, delta, deltaTone, className, ...props }: ChartMetricProps): react.JSX.Element;
77
+
83
78
  interface ChartLegendProps extends HTMLAttributes<HTMLUListElement> {
84
79
  children?: ReactNode;
85
80
  }
@@ -91,4 +86,4 @@ interface ChartLegendItemProps extends HTMLAttributes<HTMLLIElement> {
91
86
  }
92
87
  declare function ChartLegendItem({ label, color, swatch, className, style, ...props }: ChartLegendItemProps): react.JSX.Element;
93
88
 
94
- export { ChartCore, type ChartEngine, type ChartEventHandler, type ChartLabels, ChartLegend, ChartLegendItem, type ChartLegendItemProps, type ChartLegendProps, ChartMetric, type ChartMetricProps, type ChartOption, type ChartProps, type ChartTable, type ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette };
89
+ export { ChartCore, type ChartEngine, type ChartEventHandler, type ChartLabels, ChartLegend, ChartLegendItem, type ChartLegendItemProps, type ChartLegendProps, type ChartOption, type ChartProps, type ChartTable, type ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette };
@@ -179,13 +179,7 @@ function ChartCore({
179
179
  footer != null && /* @__PURE__ */ jsx("div", { className: "uix-chart__footer", children: footer })
180
180
  ] });
181
181
  }
182
- function ChartMetric({ value, label, delta, deltaTone = "neutral", className, ...props }) {
183
- return /* @__PURE__ */ jsxs("div", { className: cx("uix-chart__metric", className), ...props, children: [
184
- /* @__PURE__ */ jsx("div", { className: "uix-chart__metric-value", children: value }),
185
- label != null && /* @__PURE__ */ jsx("div", { className: "uix-chart__metric-label", children: label }),
186
- delta != null && /* @__PURE__ */ jsx("div", { className: "uix-chart__delta", "data-tone": deltaTone, children: delta })
187
- ] });
188
- }
182
+ import { ChartMetric } from "./ChartMetric.js";
189
183
  function ChartLegend({ children, className, ...props }) {
190
184
  return /* @__PURE__ */ jsx("ul", { className: cx("uix-legend", className), ...props, children });
191
185
  }
@@ -0,0 +1,16 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+
4
+ /** A body-only metric; importing it from the root loads no chart engine. */
5
+ interface ChartMetricProps extends HTMLAttributes<HTMLDivElement> {
6
+ value: ReactNode;
7
+ label?: ReactNode;
8
+ delta?: ReactNode;
9
+ /** Sentiment is independent of whether the numerical delta rises or falls. */
10
+ deltaTone?: 'neutral' | 'positive' | 'negative' | 'warning';
11
+ /** Omit to retain the responsive chart-header default. */
12
+ align?: 'start' | 'end';
13
+ }
14
+ declare function ChartMetric({ value, label, delta, deltaTone, align, className, ...props }: ChartMetricProps): react.JSX.Element;
15
+
16
+ export { ChartMetric, type ChartMetricProps };
@@ -0,0 +1,12 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cx } from "../cx.js";
3
+ function ChartMetric({ value, label, delta, deltaTone = "neutral", align, className, ...props }) {
4
+ return /* @__PURE__ */ jsxs("div", { className: cx("uix-chart__metric", className), "data-align": align, ...props, children: [
5
+ /* @__PURE__ */ jsx("div", { className: "uix-chart__metric-value", children: value }),
6
+ label != null && /* @__PURE__ */ jsx("div", { className: "uix-chart__metric-label", children: label }),
7
+ delta != null && /* @__PURE__ */ jsx("div", { className: "uix-chart__delta", "data-tone": deltaTone, children: delta })
8
+ ] });
9
+ }
10
+ export {
11
+ ChartMetric
12
+ };
@@ -6,6 +6,7 @@ import { ChartX, ChartEvent } from '../chart-analytic-model.js';
6
6
  import { CorrelationScatterSpec, CorrelationScatterLabels, CorrelationPoint } from '../correlation-scatter-model.js';
7
7
  import 'echarts';
8
8
  import '../chart-theme.js';
9
+ import './ChartMetric.js';
9
10
  import '../chart-stats.js';
10
11
 
11
12
  interface ChartFrameProps {
@@ -21,17 +21,17 @@ declare function FocusOnMount({ as, enabled, children, ...props }: {
21
21
  autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
22
22
  autoFocus?: boolean | undefined;
23
23
  className?: string | undefined;
24
- contentEditable?: (boolean | "false" | "true") | "inherit" | "plaintext-only" | undefined;
24
+ contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
25
25
  contextMenu?: string | undefined;
26
26
  dir?: string | undefined;
27
- draggable?: (boolean | "false" | "true") | undefined;
27
+ draggable?: (boolean | "true" | "false") | undefined;
28
28
  enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
29
29
  hidden?: boolean | undefined;
30
30
  id?: string | undefined;
31
31
  lang?: string | undefined;
32
32
  nonce?: string | undefined;
33
33
  slot?: string | undefined;
34
- spellCheck?: (boolean | "false" | "true") | undefined;
34
+ spellCheck?: (boolean | "true" | "false") | undefined;
35
35
  style?: react.CSSProperties | undefined;
36
36
  title?: string | undefined;
37
37
  translate?: "yes" | "no" | undefined;
@@ -64,11 +64,11 @@ declare function FocusOnMount({ as, enabled, children, ...props }: {
64
64
  exportparts?: string | undefined;
65
65
  part?: string | undefined;
66
66
  "aria-activedescendant"?: string | undefined;
67
- "aria-atomic"?: (boolean | "false" | "true") | undefined;
67
+ "aria-atomic"?: (boolean | "true" | "false") | undefined;
68
68
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
69
69
  "aria-braillelabel"?: string | undefined;
70
70
  "aria-brailleroledescription"?: string | undefined;
71
- "aria-busy"?: (boolean | "false" | "true") | undefined;
71
+ "aria-busy"?: (boolean | "true" | "false") | undefined;
72
72
  "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
73
73
  "aria-colcount"?: number | undefined;
74
74
  "aria-colindex"?: number | undefined;
@@ -79,37 +79,37 @@ declare function FocusOnMount({ as, enabled, children, ...props }: {
79
79
  "aria-describedby"?: string | undefined;
80
80
  "aria-description"?: string | undefined;
81
81
  "aria-details"?: string | undefined;
82
- "aria-disabled"?: (boolean | "false" | "true") | undefined;
82
+ "aria-disabled"?: (boolean | "true" | "false") | undefined;
83
83
  "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
84
84
  "aria-errormessage"?: string | undefined;
85
- "aria-expanded"?: (boolean | "false" | "true") | undefined;
85
+ "aria-expanded"?: (boolean | "true" | "false") | undefined;
86
86
  "aria-flowto"?: string | undefined;
87
- "aria-grabbed"?: (boolean | "false" | "true") | undefined;
87
+ "aria-grabbed"?: (boolean | "true" | "false") | undefined;
88
88
  "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
89
- "aria-hidden"?: (boolean | "false" | "true") | undefined;
89
+ "aria-hidden"?: (boolean | "true" | "false") | undefined;
90
90
  "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
91
91
  "aria-keyshortcuts"?: string | undefined;
92
92
  "aria-label"?: string | undefined;
93
93
  "aria-labelledby"?: string | undefined;
94
94
  "aria-level"?: number | undefined;
95
95
  "aria-live"?: "off" | "assertive" | "polite" | undefined;
96
- "aria-modal"?: (boolean | "false" | "true") | undefined;
97
- "aria-multiline"?: (boolean | "false" | "true") | undefined;
98
- "aria-multiselectable"?: (boolean | "false" | "true") | undefined;
96
+ "aria-modal"?: (boolean | "true" | "false") | undefined;
97
+ "aria-multiline"?: (boolean | "true" | "false") | undefined;
98
+ "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
99
99
  "aria-orientation"?: "horizontal" | "vertical" | undefined;
100
100
  "aria-owns"?: string | undefined;
101
101
  "aria-placeholder"?: string | undefined;
102
102
  "aria-posinset"?: number | undefined;
103
103
  "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
104
- "aria-readonly"?: (boolean | "false" | "true") | undefined;
104
+ "aria-readonly"?: (boolean | "true" | "false") | undefined;
105
105
  "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
106
- "aria-required"?: (boolean | "false" | "true") | undefined;
106
+ "aria-required"?: (boolean | "true" | "false") | undefined;
107
107
  "aria-roledescription"?: string | undefined;
108
108
  "aria-rowcount"?: number | undefined;
109
109
  "aria-rowindex"?: number | undefined;
110
110
  "aria-rowindextext"?: string | undefined;
111
111
  "aria-rowspan"?: number | undefined;
112
- "aria-selected"?: (boolean | "false" | "true") | undefined;
112
+ "aria-selected"?: (boolean | "true" | "false") | undefined;
113
113
  "aria-setsize"?: number | undefined;
114
114
  "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
115
115
  "aria-valuemax"?: number | undefined;
@@ -4,6 +4,7 @@ import { ChartLabels, ChartEventHandler, ChartEngine } from './ChartCore.js';
4
4
  import { GlanceLineInput, PairedBarsInput } from '../chart-glance.js';
5
5
  import 'echarts';
6
6
  import '../chart-theme.js';
7
+ import './ChartMetric.js';
7
8
 
8
9
  /** The props every glance chart shares with Chart. */
9
10
  interface GlanceChartBaseProps {
@@ -44,8 +44,6 @@ declare function MotionList<T>({ items, getKey, renderItem, as, onExited, classN
44
44
  color?: string | undefined | undefined;
45
45
  title?: string | undefined | undefined;
46
46
  id?: string | undefined | undefined;
47
- draggable?: (boolean | "false" | "true") | undefined;
48
- style?: react.CSSProperties | undefined;
49
47
  defaultChecked?: boolean | undefined | undefined;
50
48
  defaultValue?: string | number | readonly string[] | undefined;
51
49
  suppressContentEditableWarning?: boolean | undefined | undefined;
@@ -53,15 +51,17 @@ declare function MotionList<T>({ items, getKey, renderItem, as, onExited, classN
53
51
  accessKey?: string | undefined | undefined;
54
52
  autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
55
53
  autoFocus?: boolean | undefined | undefined;
56
- contentEditable?: "inherit" | (boolean | "false" | "true") | "plaintext-only" | undefined;
54
+ contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
57
55
  contextMenu?: string | undefined | undefined;
58
56
  dir?: string | undefined | undefined;
57
+ draggable?: (boolean | "true" | "false") | undefined;
59
58
  enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
60
59
  hidden?: boolean | undefined | undefined;
61
60
  lang?: string | undefined | undefined;
62
61
  nonce?: string | undefined | undefined;
63
62
  slot?: string | undefined | undefined;
64
- spellCheck?: (boolean | "false" | "true") | undefined;
63
+ spellCheck?: (boolean | "true" | "false") | undefined;
64
+ style?: react.CSSProperties | undefined;
65
65
  tabIndex?: number | undefined | undefined;
66
66
  translate?: "yes" | "no" | undefined | undefined;
67
67
  radioGroup?: string | undefined | undefined;
@@ -92,11 +92,11 @@ declare function MotionList<T>({ items, getKey, renderItem, as, onExited, classN
92
92
  exportparts?: string | undefined | undefined;
93
93
  part?: string | undefined | undefined;
94
94
  "aria-activedescendant"?: string | undefined | undefined;
95
- "aria-atomic"?: (boolean | "false" | "true") | undefined;
95
+ "aria-atomic"?: (boolean | "true" | "false") | undefined;
96
96
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
97
97
  "aria-braillelabel"?: string | undefined | undefined;
98
98
  "aria-brailleroledescription"?: string | undefined | undefined;
99
- "aria-busy"?: (boolean | "false" | "true") | undefined;
99
+ "aria-busy"?: (boolean | "true" | "false") | undefined;
100
100
  "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
101
101
  "aria-colcount"?: number | undefined | undefined;
102
102
  "aria-colindex"?: number | undefined | undefined;
@@ -107,37 +107,37 @@ declare function MotionList<T>({ items, getKey, renderItem, as, onExited, classN
107
107
  "aria-describedby"?: string | undefined | undefined;
108
108
  "aria-description"?: string | undefined | undefined;
109
109
  "aria-details"?: string | undefined | undefined;
110
- "aria-disabled"?: (boolean | "false" | "true") | undefined;
110
+ "aria-disabled"?: (boolean | "true" | "false") | undefined;
111
111
  "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
112
112
  "aria-errormessage"?: string | undefined | undefined;
113
- "aria-expanded"?: (boolean | "false" | "true") | undefined;
113
+ "aria-expanded"?: (boolean | "true" | "false") | undefined;
114
114
  "aria-flowto"?: string | undefined | undefined;
115
- "aria-grabbed"?: (boolean | "false" | "true") | undefined;
115
+ "aria-grabbed"?: (boolean | "true" | "false") | undefined;
116
116
  "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined | undefined;
117
- "aria-hidden"?: (boolean | "false" | "true") | undefined;
117
+ "aria-hidden"?: (boolean | "true" | "false") | undefined;
118
118
  "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined;
119
119
  "aria-keyshortcuts"?: string | undefined | undefined;
120
120
  "aria-label"?: string | undefined | undefined;
121
121
  "aria-labelledby"?: string | undefined | undefined;
122
122
  "aria-level"?: number | undefined | undefined;
123
123
  "aria-live"?: "off" | "assertive" | "polite" | undefined | undefined;
124
- "aria-modal"?: (boolean | "false" | "true") | undefined;
125
- "aria-multiline"?: (boolean | "false" | "true") | undefined;
126
- "aria-multiselectable"?: (boolean | "false" | "true") | undefined;
124
+ "aria-modal"?: (boolean | "true" | "false") | undefined;
125
+ "aria-multiline"?: (boolean | "true" | "false") | undefined;
126
+ "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
127
127
  "aria-orientation"?: "horizontal" | "vertical" | undefined | undefined;
128
128
  "aria-owns"?: string | undefined | undefined;
129
129
  "aria-placeholder"?: string | undefined | undefined;
130
130
  "aria-posinset"?: number | undefined | undefined;
131
131
  "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
132
- "aria-readonly"?: (boolean | "false" | "true") | undefined;
132
+ "aria-readonly"?: (boolean | "true" | "false") | undefined;
133
133
  "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
134
- "aria-required"?: (boolean | "false" | "true") | undefined;
134
+ "aria-required"?: (boolean | "true" | "false") | undefined;
135
135
  "aria-roledescription"?: string | undefined | undefined;
136
136
  "aria-rowcount"?: number | undefined | undefined;
137
137
  "aria-rowindex"?: number | undefined | undefined;
138
138
  "aria-rowindextext"?: string | undefined | undefined;
139
139
  "aria-rowspan"?: number | undefined | undefined;
140
- "aria-selected"?: (boolean | "false" | "true") | undefined;
140
+ "aria-selected"?: (boolean | "true" | "false") | undefined;
141
141
  "aria-setsize"?: number | undefined | undefined;
142
142
  "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
143
143
  "aria-valuemax"?: number | undefined | undefined;
@@ -86,6 +86,13 @@ interface RuleBuilderProps {
86
86
  /** The action types of the "Then" block. Not needed with `conditionsOnly`. */
87
87
  actions?: RuleActionDefinition[];
88
88
  maxDepth?: number;
89
+ /**
90
+ * Maximum condition leaves across the whole definition (unlimited by default).
91
+ * At capacity, add actions are absent. Existing over-limit controlled input is
92
+ * preserved for editing/removal. Use 1 with conditionsOnly and allowGroups=false
93
+ * for an optional single condition; checks.emptyGroup=false permits the empty value.
94
+ */
95
+ maxConditions?: number;
89
96
  /**
90
97
  * `true`: the same builder with every control disabled and no add, move or remove buttons.
91
98
  * `'summary'`: one sentence instead of the controls (what `readOnly` rendered up to 2.31.0;
@@ -128,6 +135,6 @@ interface RuleBuilderProps {
128
135
  labels?: Partial<RuleBuilderLabels>;
129
136
  }
130
137
  /** Declarative controlled when-conditions-to-actions editor with bounded nesting. */
131
- declare function RuleBuilder({ value, onChange, fields, operators, actions, maxDepth, readOnly, conditionsOnly, combinator, hideCombinator, allowGroups, checks, validate, className, addConditionLabel, addGroupLabel, addActionLabel, labels: labelOverrides, }: RuleBuilderProps): react.JSX.Element;
138
+ declare function RuleBuilder({ value, onChange, fields, operators, actions, maxDepth, readOnly, conditionsOnly, maxConditions, combinator, hideCombinator, allowGroups, checks, validate, className, addConditionLabel, addGroupLabel, addActionLabel, labels: labelOverrides, }: RuleBuilderProps): react.JSX.Element;
132
139
 
133
140
  export { DEFAULT_RULE_BUILDER_LABELS, type RuleActionDefinition, RuleBuilder, type RuleBuilderLabels, type RuleBuilderProps, type RuleFieldDefinition, type RuleOperatorDefinition, type RuleValueEditorProps };
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useLayoutEffect, useRef } from "react";
3
4
  import { cx } from "../cx.js";
4
5
  import {
5
6
  appendRuleNode,
@@ -8,6 +9,7 @@ import {
8
9
  moveRuleNode,
9
10
  removeRuleNode,
10
11
  setRuleCombinator,
12
+ ruleConditionCount,
11
13
  summarizeRule,
12
14
  validateRuleDefinition
13
15
  } from "../rule-builder-model.js";
@@ -65,14 +67,28 @@ function defaultCondition(fields, operators) {
65
67
  const operator = operators.find((item) => field?.operators?.includes(item.id)) ?? operators[0];
66
68
  return { id: nextId("condition"), field: field?.id ?? "", operator: operator?.id ?? "", value: "" };
67
69
  }
68
- function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, disabled, onRootChange, labels, combinator, hideCombinator, allowGroups }) {
70
+ function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, maxConditions, disabled, onRootChange, labels, combinator, hideCombinator, allowGroups }) {
71
+ const groupRef = useRef(null);
72
+ const addRef = useRef(null);
73
+ const focusAfterMutation = useRef(null);
74
+ useLayoutEffect(() => {
75
+ if (focusAfterMutation.current === "row") {
76
+ const target = groupRef.current?.querySelector('[role="combobox"]') ?? groupRef.current?.querySelector("select, input");
77
+ target?.focus();
78
+ } else if (focusAfterMutation.current === "add") addRef.current?.focus();
79
+ focusAfterMutation.current = null;
80
+ }, [group.conditions]);
81
+ const canAdd = maxConditions === Number.POSITIVE_INFINITY || ruleConditionCount(root) < maxConditions;
69
82
  const updateNode = (id, update) => onRootChange(mapRuleGroup(root, id, update));
70
- const addCondition = () => onRootChange(appendRuleNode(root, group.id, defaultCondition(fields, operators), maxDepth));
71
- const addGroup = () => onRootChange(appendRuleNode(root, group.id, {
72
- id: nextId("group"),
73
- combinator: combinator ?? "and",
74
- conditions: [defaultCondition(fields, operators)]
75
- }, maxDepth));
83
+ const append = (node) => {
84
+ if (disabled || !canAdd) return;
85
+ const next = appendRuleNode(root, group.id, node, maxDepth, maxConditions);
86
+ if (next === root) return;
87
+ if (maxConditions === 1) focusAfterMutation.current = "row";
88
+ onRootChange(next);
89
+ };
90
+ const addCondition = () => append(defaultCondition(fields, operators));
91
+ const addGroup = () => append({ id: nextId("group"), combinator: combinator ?? "and", conditions: [defaultCondition(fields, operators)] });
76
92
  const rowControls = (node, index, label) => disabled ? null : /* @__PURE__ */ jsx(
77
93
  RowControls,
78
94
  {
@@ -83,10 +99,13 @@ function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, disa
83
99
  disabled: false,
84
100
  onUp: () => onRootChange(moveRuleNode(root, node.id, -1)),
85
101
  onDown: () => onRootChange(moveRuleNode(root, node.id, 1)),
86
- onRemove: () => onRootChange(removeRuleNode(root, node.id))
102
+ onRemove: () => {
103
+ if (maxConditions === 1) focusAfterMutation.current = ruleConditionCount(root) === ruleConditionCount(node) ? "add" : "row";
104
+ onRootChange(removeRuleNode(root, node.id));
105
+ }
87
106
  }
88
107
  );
89
- return /* @__PURE__ */ jsxs("fieldset", { className: "uix-rule-builder__group", "data-depth": depth, children: [
108
+ return /* @__PURE__ */ jsxs("fieldset", { ref: groupRef, className: "uix-rule-builder__group", "data-depth": depth, children: [
90
109
  /* @__PURE__ */ jsxs("legend", { className: "uix-rule-builder__group-heading", children: [
91
110
  /* @__PURE__ */ jsx("span", { children: depth === 1 ? labels.when : labels.group }),
92
111
  !hideCombinator && (combinator ? /* @__PURE__ */ jsxs("span", { className: "uix-rule-builder__match", children: [
@@ -108,7 +127,7 @@ function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, disa
108
127
  ] }))
109
128
  ] }),
110
129
  /* @__PURE__ */ jsx("div", { className: "uix-rule-builder__rows", children: group.conditions.map((node, index) => isRuleGroup(node) ? /* @__PURE__ */ jsxs("div", { className: "uix-rule-builder__nested", children: [
111
- /* @__PURE__ */ jsx(RuleGroupEditor, { ...{ group: node, depth: depth + 1, root, fields, operators, maxDepth, disabled, onRootChange, labels, combinator, hideCombinator, allowGroups } }),
130
+ /* @__PURE__ */ jsx(RuleGroupEditor, { ...{ group: node, depth: depth + 1, root, fields, operators, maxDepth, maxConditions, disabled, onRootChange, labels, combinator, hideCombinator, allowGroups } }),
112
131
  rowControls(node, index, labels.itemGroup)
113
132
  ] }, node.id) : /* @__PURE__ */ jsx(
114
133
  ConditionRow,
@@ -123,8 +142,8 @@ function RuleGroupEditor({ group, depth, root, fields, operators, maxDepth, disa
123
142
  },
124
143
  node.id
125
144
  )) }),
126
- !disabled && /* @__PURE__ */ jsxs("div", { className: "uix-rule-builder__add", children: [
127
- /* @__PURE__ */ jsx("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: addCondition, disabled: fields.length === 0 || operators.length === 0, children: labels.addCondition }),
145
+ !disabled && canAdd && /* @__PURE__ */ jsxs("div", { className: "uix-rule-builder__add", children: [
146
+ /* @__PURE__ */ jsx("button", { ref: addRef, type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: addCondition, disabled: fields.length === 0 || operators.length === 0, children: labels.addCondition }),
128
147
  allowGroups && /* @__PURE__ */ jsx("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", onClick: addGroup, disabled: depth >= maxDepth, children: labels.addGroup })
129
148
  ] })
130
149
  ] });
@@ -183,6 +202,7 @@ function RuleBuilder({
183
202
  maxDepth = 3,
184
203
  readOnly = false,
185
204
  conditionsOnly = false,
205
+ maxConditions = Number.POSITIVE_INFINITY,
186
206
  combinator,
187
207
  hideCombinator = false,
188
208
  allowGroups = true,
@@ -241,6 +261,7 @@ function RuleBuilder({
241
261
  ] });
242
262
  }
243
263
  const disabled = readOnly === true;
264
+ const conditionLimit = Number.isNaN(maxConditions) ? 0 : Math.max(0, Math.floor(maxConditions));
244
265
  const emitWhen = (when) => onChange({ ...value, when: combinator ? setRuleCombinator(when, combinator) : when });
245
266
  const updateActions = (next) => onChange({ ...value, then: next });
246
267
  return /* @__PURE__ */ jsxs("section", { className: cx("uix-rule-builder", disabled && "uix-rule-builder--readonly", className), "aria-label": labels.region, children: [
@@ -253,6 +274,7 @@ function RuleBuilder({
253
274
  fields,
254
275
  operators,
255
276
  maxDepth,
277
+ maxConditions: conditionLimit,
256
278
  disabled,
257
279
  onRootChange: emitWhen,
258
280
  labels,