@usetheo/ui 0.29.0 → 0.31.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.
@@ -39,6 +39,13 @@ export interface TrendChartProps extends HTMLAttributes<HTMLElement> {
39
39
  height?: number;
40
40
  /** Formats y-axis labels and table cells (tremor vocabulary). */
41
41
  valueFormatter?: (v: number) => string;
42
+ /**
43
+ * Pin the top of the y-axis. Pass a fixed bound (e.g. `1` for a 0–1 score) so the
44
+ * scale is stable and comparable across renders instead of auto-fitting to the data
45
+ * max via {@link niceMax} (which makes 0.68 look near the top of a [0, 0.7] axis).
46
+ * Ignored when ≤ 0. Default: auto (`niceMax`).
47
+ */
48
+ yMax?: number;
42
49
  }
43
50
  declare const TrendChart: import("react").ForwardRefExoticComponent<TrendChartProps & import("react").RefAttributes<HTMLElement>>;
44
51
  export { TrendChart };
@@ -3,7 +3,10 @@ import type { ComponentPropsWithoutRef, HTMLAttributes } from "react";
3
3
  interface ContentProps extends ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
4
4
  hideCloseButton?: boolean;
5
5
  }
6
- declare const Dialog: import("react").FC<DialogPrimitive.DialogProps> & {
6
+ declare const Dialog: {
7
+ (props: ComponentPropsWithoutRef<typeof DialogPrimitive.Root>): import("react").JSX.Element;
8
+ displayName: string;
9
+ } & {
7
10
  Trigger: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
8
11
  Close: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
9
12
  Content: import("react").ForwardRefExoticComponent<ContentProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,57 +1,33 @@
1
1
  import * as DialogPrimitive from "@radix-ui/react-dialog";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  import type { ComponentPropsWithoutRef, HTMLAttributes } from "react";
4
- /**
5
- * Sheet — slide-in side panel built on Radix Dialog.
6
- *
7
- * Same Radix primitive as Dialog, but Content slides from an edge instead of
8
- * fading from center. Used for: workspace overlays (Memory, Observability,
9
- * Sub-agents), Settings, contextual filters.
10
- *
11
- * Composition:
12
- * <Sheet>
13
- * <Sheet.Trigger>Open</Sheet.Trigger>
14
- * <Sheet.Content side="right">
15
- * <Sheet.Header>
16
- * <Sheet.Title>Memory</Sheet.Title>
17
- * <Sheet.Description>Episodes and wiki pages</Sheet.Description>
18
- * </Sheet.Header>
19
- * <Sheet.Body>…</Sheet.Body>
20
- * <Sheet.Footer>…</Sheet.Footer>
21
- * </Sheet.Content>
22
- * </Sheet>
23
- */
24
- declare const Overlay: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
25
4
  declare const sheetVariants: (props?: ({
26
5
  side?: "bottom" | "left" | "right" | "top" | null | undefined;
27
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
28
7
  interface ContentProps extends ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
29
8
  hideCloseButton?: boolean;
30
9
  }
31
- declare const Content: import("react").ForwardRefExoticComponent<ContentProps & import("react").RefAttributes<HTMLDivElement>>;
32
- declare const Header: {
33
- ({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
10
+ declare const Sheet: {
11
+ (props: ComponentPropsWithoutRef<typeof DialogPrimitive.Root>): import("react").JSX.Element;
34
12
  displayName: string;
35
- };
36
- declare const Body: {
37
- ({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
38
- displayName: string;
39
- };
40
- declare const Footer: {
41
- ({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
42
- displayName: string;
43
- };
44
- declare const Title: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
45
- declare const Description: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
46
- declare const Sheet: typeof DialogPrimitive.Root & {
47
- Trigger: typeof DialogPrimitive.Trigger;
48
- Close: typeof DialogPrimitive.Close;
49
- Content: typeof Content;
50
- Overlay: typeof Overlay;
51
- Header: typeof Header;
52
- Body: typeof Body;
53
- Footer: typeof Footer;
54
- Title: typeof Title;
55
- Description: typeof Description;
13
+ } & {
14
+ Trigger: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
15
+ Close: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
16
+ Content: import("react").ForwardRefExoticComponent<ContentProps & import("react").RefAttributes<HTMLDivElement>>;
17
+ Overlay: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
18
+ Header: {
19
+ ({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
20
+ displayName: string;
21
+ };
22
+ Body: {
23
+ ({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
24
+ displayName: string;
25
+ };
26
+ Footer: {
27
+ ({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
28
+ displayName: string;
29
+ };
30
+ Title: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
31
+ Description: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
56
32
  };
57
33
  export { Sheet, sheetVariants };
package/dist/index.js CHANGED
@@ -1729,7 +1729,9 @@ var Description3 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
1729
1729
  }
1730
1730
  ));
1731
1731
  Description3.displayName = "Dialog.Description";
1732
- var Dialog = /* @__PURE__ */ Object.assign(DialogPrimitive.Root, {
1732
+ var Root7 = (props) => /* @__PURE__ */ jsx(DialogPrimitive.Root, { ...props });
1733
+ Root7.displayName = "Dialog";
1734
+ var Dialog = /* @__PURE__ */ Object.assign(Root7, {
1733
1735
  Trigger: DialogPrimitive.Trigger,
1734
1736
  Close: DialogPrimitive.Close,
1735
1737
  Content: Content3,
@@ -1793,7 +1795,7 @@ var Tabs = /* @__PURE__ */ Object.assign(TabsPrimitive.Root, {
1793
1795
  Content: Content5
1794
1796
  });
1795
1797
  var Provider2 = TooltipPrimitive.Provider;
1796
- var Root9 = TooltipPrimitive.Root;
1798
+ var Root10 = TooltipPrimitive.Root;
1797
1799
  var Trigger5 = TooltipPrimitive.Trigger;
1798
1800
  var Content7 = forwardRef(({ className, sideOffset = 6, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1799
1801
  TooltipPrimitive.Content,
@@ -1821,13 +1823,13 @@ var Tooltip = ({
1821
1823
  delayDuration = 200,
1822
1824
  children,
1823
1825
  ...rootProps
1824
- }) => /* @__PURE__ */ jsx(Provider2, { delayDuration, children: /* @__PURE__ */ jsxs(Root9, { ...rootProps, children: [
1826
+ }) => /* @__PURE__ */ jsx(Provider2, { delayDuration, children: /* @__PURE__ */ jsxs(Root10, { ...rootProps, children: [
1825
1827
  /* @__PURE__ */ jsx(Trigger5, { asChild: true, children }),
1826
1828
  /* @__PURE__ */ jsx(Content7, { side, align, children: label })
1827
1829
  ] }) });
1828
1830
  var TooltipWithStatics = Tooltip;
1829
1831
  TooltipWithStatics.Provider = Provider2;
1830
- TooltipWithStatics.Root = Root9;
1832
+ TooltipWithStatics.Root = Root10;
1831
1833
  TooltipWithStatics.Trigger = Trigger5;
1832
1834
  TooltipWithStatics.Content = Content7;
1833
1835
  var ScrollAreaRoot = forwardRef(
@@ -2679,7 +2681,7 @@ var Textarea = forwardRef(
2679
2681
  )
2680
2682
  );
2681
2683
  Textarea.displayName = "Textarea";
2682
- var Root19 = forwardRef(
2684
+ var Root20 = forwardRef(
2683
2685
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2684
2686
  "aside",
2685
2687
  {
@@ -2693,7 +2695,7 @@ var Root19 = forwardRef(
2693
2695
  }
2694
2696
  )
2695
2697
  );
2696
- Root19.displayName = "Sidebar";
2698
+ Root20.displayName = "Sidebar";
2697
2699
  var Header3 = forwardRef(
2698
2700
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2699
2701
  "div",
@@ -2795,13 +2797,13 @@ var Footer3 = forwardRef(
2795
2797
  )
2796
2798
  );
2797
2799
  Footer3.displayName = "Sidebar.Footer";
2798
- var Sidebar = /* @__PURE__ */ Object.assign(Root19, {
2800
+ var Sidebar = /* @__PURE__ */ Object.assign(Root20, {
2799
2801
  Header: Header3,
2800
2802
  Section,
2801
2803
  Item: Item6,
2802
2804
  Footer: Footer3
2803
2805
  });
2804
- var Root20 = forwardRef(
2806
+ var Root21 = forwardRef(
2805
2807
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2806
2808
  "header",
2807
2809
  {
@@ -2815,7 +2817,7 @@ var Root20 = forwardRef(
2815
2817
  }
2816
2818
  )
2817
2819
  );
2818
- Root20.displayName = "TopNav";
2820
+ Root21.displayName = "TopNav";
2819
2821
  var Left = forwardRef(
2820
2822
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2821
2823
  "div",
@@ -2950,7 +2952,7 @@ var ModeSwitcher = forwardRef(
2950
2952
  }
2951
2953
  );
2952
2954
  ModeSwitcher.displayName = "TopNav.ModeSwitcher";
2953
- var TopNav = /* @__PURE__ */ Object.assign(Root20, {
2955
+ var TopNav = /* @__PURE__ */ Object.assign(Root21, {
2954
2956
  Left,
2955
2957
  Center,
2956
2958
  Right,
@@ -3064,16 +3066,19 @@ var Description6 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
3064
3066
  }
3065
3067
  ));
3066
3068
  Description6.displayName = "Sheet.Description";
3067
- var Sheet = DialogPrimitive.Root;
3068
- Sheet.Trigger = DialogPrimitive.Trigger;
3069
- Sheet.Close = DialogPrimitive.Close;
3070
- Sheet.Content = Content10;
3071
- Sheet.Overlay = Overlay4;
3072
- Sheet.Header = Header4;
3073
- Sheet.Body = Body3;
3074
- Sheet.Footer = Footer4;
3075
- Sheet.Title = Title6;
3076
- Sheet.Description = Description6;
3069
+ var Root23 = (props) => /* @__PURE__ */ jsx(DialogPrimitive.Root, { ...props });
3070
+ Root23.displayName = "Sheet";
3071
+ var Sheet = /* @__PURE__ */ Object.assign(Root23, {
3072
+ Trigger: DialogPrimitive.Trigger,
3073
+ Close: DialogPrimitive.Close,
3074
+ Content: Content10,
3075
+ Overlay: Overlay4,
3076
+ Header: Header4,
3077
+ Body: Body3,
3078
+ Footer: Footer4,
3079
+ Title: Title6,
3080
+ Description: Description6
3081
+ });
3077
3082
  var INTENT_FILL = {
3078
3083
  default: "bg-primary",
3079
3084
  success: "bg-success",
@@ -3246,7 +3251,7 @@ var alignClass = {
3246
3251
  center: "text-center",
3247
3252
  right: "text-right"
3248
3253
  };
3249
- var Root22 = forwardRef(
3254
+ var Root24 = forwardRef(
3250
3255
  ({ className, density = "default", children, ...props }, ref) => /* @__PURE__ */ jsx(TableDensityContext.Provider, { value: density, children: /* @__PURE__ */ jsx(
3251
3256
  "table",
3252
3257
  {
@@ -3258,7 +3263,7 @@ var Root22 = forwardRef(
3258
3263
  }
3259
3264
  ) })
3260
3265
  );
3261
- Root22.displayName = "Table";
3266
+ Root24.displayName = "Table";
3262
3267
  var Header5 = forwardRef(
3263
3268
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3264
3269
  "thead",
@@ -3378,7 +3383,7 @@ var HeaderCell = forwardRef(
3378
3383
  }
3379
3384
  );
3380
3385
  HeaderCell.displayName = "Table.HeaderCell";
3381
- var Table = Object.assign(Root22, { Header: Header5, Body: Body4, Row, Cell, HeaderCell });
3386
+ var Table = Object.assign(Root24, { Header: Header5, Body: Body4, Row, Cell, HeaderCell });
3382
3387
 
3383
3388
  // src/lib/env.ts
3384
3389
  function readNodeEnv() {
@@ -3659,7 +3664,7 @@ var StatTile = forwardRef(
3659
3664
  }
3660
3665
  );
3661
3666
  StatTile.displayName = "StatTile";
3662
- var Root23 = forwardRef(
3667
+ var Root25 = forwardRef(
3663
3668
  ({ className, title = "Danger Zone", children, ...props }, ref) => /* @__PURE__ */ jsxs(
3664
3669
  "section",
3665
3670
  {
@@ -3675,7 +3680,7 @@ var Root23 = forwardRef(
3675
3680
  }
3676
3681
  )
3677
3682
  );
3678
- Root23.displayName = "DangerZone";
3683
+ Root25.displayName = "DangerZone";
3679
3684
  var Action2 = forwardRef(
3680
3685
  ({ className, title, description, action, ...props }, ref) => /* @__PURE__ */ jsxs(
3681
3686
  "div",
@@ -3698,7 +3703,7 @@ var Action2 = forwardRef(
3698
3703
  )
3699
3704
  );
3700
3705
  Action2.displayName = "DangerZone.Action";
3701
- var DangerZone = Object.assign(Root23, { Action: Action2 });
3706
+ var DangerZone = Object.assign(Root25, { Action: Action2 });
3702
3707
  var ConfirmDialog = forwardRef(
3703
3708
  ({
3704
3709
  open,
@@ -5087,7 +5092,7 @@ function niceMax(values) {
5087
5092
  const m = Math.max(0, ...values.filter((v) => Number.isFinite(v)));
5088
5093
  if (m <= 0) return 0;
5089
5094
  const pow = 10 ** Math.floor(Math.log10(m));
5090
- return Math.ceil(m / pow) * pow;
5095
+ return Number((Math.ceil(m / pow) * pow).toPrecision(12));
5091
5096
  }
5092
5097
  function seriesPath(points, xScale, yScale) {
5093
5098
  const finite = points.filter((p) => Number.isFinite(p.y));
@@ -5098,7 +5103,29 @@ var VIEW_W = 600;
5098
5103
  var PAD = { top: 8, right: 8, bottom: 4, left: 40 };
5099
5104
  var SPARSE_MARKER_MAX = 5;
5100
5105
  var TrendChart = forwardRef(
5101
- ({ title, series, height = 180, valueFormatter = (v) => String(v), className, ...props }, ref) => {
5106
+ ({
5107
+ title,
5108
+ series,
5109
+ height = 180,
5110
+ valueFormatter = (v) => String(v),
5111
+ yMax: yMaxProp,
5112
+ className,
5113
+ ...props
5114
+ }, ref) => {
5115
+ const [viewW, setViewW] = useState(VIEW_W);
5116
+ const roRef = useRef(null);
5117
+ const setSvgNode = useCallback((node) => {
5118
+ roRef.current?.disconnect();
5119
+ roRef.current = null;
5120
+ if (!node || typeof ResizeObserver === "undefined") return;
5121
+ const measure = () => {
5122
+ const w = node.clientWidth;
5123
+ if (w > 0) setViewW(w);
5124
+ };
5125
+ measure();
5126
+ roRef.current = new ResizeObserver(measure);
5127
+ roRef.current.observe(node);
5128
+ }, []);
5102
5129
  const allPoints = series.flatMap((s) => s.points);
5103
5130
  const hasData = allPoints.some((p) => Number.isFinite(p.y));
5104
5131
  if (!hasData) {
@@ -5128,17 +5155,18 @@ var TrendChart = forwardRef(
5128
5155
  const xs = allPoints.map((p) => p.x);
5129
5156
  const xMin = Math.min(...xs);
5130
5157
  const xMax = Math.max(...xs);
5131
- const yMax = niceMax(allPoints.map((p) => p.y)) || 1;
5158
+ const yMax = yMaxProp != null && yMaxProp > 0 ? yMaxProp : niceMax(allPoints.map((p) => p.y)) || 1;
5132
5159
  const axisXs = Array.from(new Set(allPoints.map((p) => p.x))).sort((a, b) => a - b);
5133
5160
  const yByX = series.map((s) => new Map(s.points.map((p) => [p.x, p.y])));
5134
- const xScale = linScale([xMin, xMax], [PAD.left, VIEW_W - PAD.right]);
5161
+ const xScale = linScale([xMin, xMax], [PAD.left, viewW - PAD.right]);
5135
5162
  const yScale = linScale([0, yMax], [height - PAD.bottom, PAD.top]);
5136
5163
  return /* @__PURE__ */ jsxs("figure", { "data-slot": "trend-chart", ref, className: cn("space-y-1", className), ...props, children: [
5137
5164
  /* @__PURE__ */ jsx("figcaption", { className: "font-semibold text-label-caps text-muted-foreground uppercase", children: title }),
5138
5165
  /* @__PURE__ */ jsxs(
5139
5166
  "svg",
5140
5167
  {
5141
- viewBox: `0 0 ${VIEW_W} ${height}`,
5168
+ ref: setSvgNode,
5169
+ viewBox: `0 0 ${viewW} ${height}`,
5142
5170
  preserveAspectRatio: "none",
5143
5171
  role: "img",
5144
5172
  "aria-label": `${title} trend`,
@@ -5150,7 +5178,7 @@ var TrendChart = forwardRef(
5150
5178
  {
5151
5179
  x1: PAD.left,
5152
5180
  y1: height - PAD.bottom,
5153
- x2: VIEW_W - PAD.right,
5181
+ x2: viewW - PAD.right,
5154
5182
  y2: height - PAD.bottom,
5155
5183
  className: "stroke-border",
5156
5184
  strokeWidth: 1
@@ -5161,7 +5189,7 @@ var TrendChart = forwardRef(
5161
5189
  {
5162
5190
  x1: PAD.left,
5163
5191
  y1: PAD.top,
5164
- x2: VIEW_W - PAD.right,
5192
+ x2: viewW - PAD.right,
5165
5193
  y2: PAD.top,
5166
5194
  className: "stroke-border/50",
5167
5195
  strokeWidth: 1,
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@usetheo/ui",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Violet Forge design system — generic React components + primitives (the non-AI foundation of @theokit/ui).",
8
8
  "sideEffects": false,
9
- "files": ["dist"],
9
+ "files": [
10
+ "dist"
11
+ ],
10
12
  "exports": {
11
13
  ".": {
12
14
  "types": "./dist/index.d.ts",