@mechane-ai/elements 0.17.1 → 0.18.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.
@@ -1,5 +1,5 @@
1
- import { a as e, n as t, r as n, s as r, t as i } from "../chart-frame-Bf1l_7-R.js";
2
- import { n as a, r as o, t as s } from "../chart-input-fBuRm0Lc.js";
1
+ import { a as e, n as t, r as n, s as r, t as i } from "../chart-frame-vwS7YVgv.js";
2
+ import { n as a, r as o, t as s } from "../chart-input-D6Fw2UGV.js";
3
3
  import { t as c } from "../plot-width--OgdohB5.js";
4
4
  import * as l from "@stylexjs/stylex";
5
5
  import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
- import { a as e, n as t, r as n, s as r, t as i } from "../chart-frame-Bf1l_7-R.js";
2
- import { n as a, t as o } from "../chart-input-fBuRm0Lc.js";
1
+ import { a as e, n as t, r as n, s as r, t as i } from "../chart-frame-vwS7YVgv.js";
2
+ import { n as a, t as o } from "../chart-input-D6Fw2UGV.js";
3
3
  import * as s from "@stylexjs/stylex";
4
4
  import { useId as c } from "react";
5
5
  import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
- import { i as e, r as t, t as n } from "../categorical-values-l5YTG9G3.js";
2
- import { o as r, r as i, s as a } from "../chart-frame-Bf1l_7-R.js";
3
- import { t as o } from "../chart-input-fBuRm0Lc.js";
1
+ import { i as e, r as t, t as n } from "../categorical-values-D-sSI9JB.js";
2
+ import { o as r, r as i, s as a } from "../chart-frame-vwS7YVgv.js";
3
+ import { t as o } from "../chart-input-D6Fw2UGV.js";
4
4
  import { t as s } from "../plot-width--OgdohB5.js";
5
5
  import * as c from "@stylexjs/stylex";
6
6
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  import { r as e } from "../tokens.stylex-DTHHFbyl.js";
2
- import { n as t, r as n, t as r } from "../chart-input-fBuRm0Lc.js";
3
- import { a as i, n as a, r as o, s, t as c } from "../chart-frame-Bf1l_7-R.js";
2
+ import { n as t, r as n, t as r } from "../chart-input-D6Fw2UGV.js";
3
+ import { a as i, n as a, r as o, s, t as c } from "../chart-frame-vwS7YVgv.js";
4
4
  import * as l from "@stylexjs/stylex";
5
5
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
6
6
  // packages/charts/src/matrix/heatmap-scale.ts
@@ -1,5 +1,5 @@
1
1
  import { c as e } from "../src-BXh4g2VY.js";
2
- import { n as t, t as n } from "../chart-input-fBuRm0Lc.js";
2
+ import { n as t, t as n } from "../chart-input-D6Fw2UGV.js";
3
3
  import * as r from "@stylexjs/stylex";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  import { scaleLinear as o } from "@visx/scale";
package/dist/charts.js CHANGED
@@ -1 +1 @@
1
- export { r as ChartFrame, i as ChartLegend } from "./chart-frame-Bf1l_7-R.js";
1
+ export { r as ChartFrame, i as ChartLegend } from "./chart-frame-vwS7YVgv.js";
package/dist/elements.css CHANGED
@@ -1097,6 +1097,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
1097
1097
  flex-shrink: 1;
1098
1098
  }
1099
1099
 
1100
+ .xozqiw3 {
1101
+ flex-wrap: nowrap;
1102
+ }
1103
+
1100
1104
  .x1a02dak {
1101
1105
  flex-wrap: wrap;
1102
1106
  }
@@ -1581,6 +1585,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
1581
1585
  transform: translateY(calc(-100% - 16px));
1582
1586
  }
1583
1587
 
1588
+ .x1hj3fc7 {
1589
+ transform-origin: 0 0;
1590
+ }
1591
+
1584
1592
  .x1mq3mr6 {
1585
1593
  transition-duration: 0s;
1586
1594
  }
@@ -1605,6 +1613,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
1605
1613
  transition-property: opacity;
1606
1614
  }
1607
1615
 
1616
+ .xwcsmn1 {
1617
+ transition-property: transform, opacity;
1618
+ }
1619
+
1608
1620
  .x11xpdln {
1609
1621
  transition-property: transform;
1610
1622
  }
@@ -1989,6 +2001,12 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
1989
2001
  text-decoration-line: underline;
1990
2002
  }
1991
2003
 
2004
+ @media (prefers-reduced-motion: reduce) {
2005
+ .x12w9bfk.x12w9bfk {
2006
+ transition-duration: 0s;
2007
+ }
2008
+ }
2009
+
1992
2010
  @container inspector (width <= 860px) {
1993
2011
  .xdctr63.xdctr63 {
1994
2012
  border-inline-start-width: 0;
@@ -2393,6 +2411,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
2393
2411
  max-width: min(360px, 100vw - 24px);
2394
2412
  }
2395
2413
 
2414
+ .x1x1rfll {
2415
+ max-width: none;
2416
+ }
2417
+
2396
2418
  .x9g60mw {
2397
2419
  max-width: var(--x11mzuvh);
2398
2420
  }
@@ -2421,6 +2443,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
2421
2443
  min-height: 35px;
2422
2444
  }
2423
2445
 
2446
+ .x1rtsecp {
2447
+ min-height: calc(var(--xdvbmuj) * 2);
2448
+ }
2449
+
2424
2450
  .x1avwmir {
2425
2451
  min-height: var(--x10l6e8v);
2426
2452
  }
package/dist/layout.js CHANGED
@@ -120,39 +120,39 @@ function M({ children: e, label: t }) {
120
120
  }), e]
121
121
  });
122
122
  }
123
- function N({ children: e, icon: t, isSelected: n = !1, onClick: r, className: i, style: s, ...c }) {
124
- let l = d(E), u = p(), f = l !== null && !l.isExpanded;
123
+ function N({ children: e, icon: t, isSelected: n = !1, shouldCloseOnActivate: r = !0, onClick: i, className: s, style: c, ...l }) {
124
+ let u = d(E), f = p(), m = u !== null && !u.isExpanded;
125
125
  return /* @__PURE__ */ _("div", {
126
126
  ...{
127
127
  0: { className: "x78zum5 xeuugli x1ok0vyi" },
128
128
  1: { className: "x78zum5 xeuugli x1ok0vyi x1r7kqkb" }
129
129
  }[!!n | 0],
130
130
  children: /* @__PURE__ */ v(o, {
131
- ...c,
131
+ ...l,
132
132
  ...a({
133
- className: i,
134
- style: s,
133
+ className: s,
134
+ style: c,
135
135
  styles: {
136
136
  0: { className: "x9f619 x78zum5 x6s0dn4 x1ok0vyi xbixft xjbqb8w x1hz01jw xtqrqnz x1778rvt xj57cvi xvmahel xdpxx8g xkrqix3 x17lu4q8 x1480za7 x13qnu6 x9v5kkp x19rmrnh x1bqaal xc342km x1ypdohk xwj21n9 x1m8qfh3 x1nhvcw1 x1hnptsi x15rya3k x992rv9 x1avwmir xh8yej3 xeuugli xt970qd xksvo5r" },
137
137
  1: { className: "x9f619 x78zum5 x6s0dn4 x1ok0vyi xbixft xjbqb8w x1hz01jw xtqrqnz x1778rvt xj57cvi xvmahel xdpxx8g xkrqix3 x17lu4q8 x1480za7 x13qnu6 x9v5kkp x19rmrnh x1bqaal xc342km x1ypdohk xwj21n9 x1m8qfh3 x1hnptsi x15rya3k x992rv9 x1avwmir xh8yej3 xeuugli xt970qd xksvo5r xl56j7k x1l31gyv" }
138
- }[!!f | 0]
138
+ }[!!m | 0]
139
139
  }),
140
140
  "aria-current": n ? "page" : void 0,
141
- "aria-labelledby": c["aria-labelledby"] ?? (c["aria-label"] === void 0 ? u : void 0),
142
- title: c.title ?? (typeof e == "string" ? e : void 0),
141
+ "aria-labelledby": l["aria-labelledby"] ?? (l["aria-label"] === void 0 ? f : void 0),
142
+ title: l.title ?? (typeof e == "string" ? e : void 0),
143
143
  onClick: (e) => {
144
- r !== void 0 && r(e), !e.defaultPrevented && l !== null && l.onNavigate();
144
+ i !== void 0 && i(e), !e.defaultPrevented && u !== null && r && u.onNavigate();
145
145
  },
146
146
  children: [t != null && /* @__PURE__ */ _("span", {
147
147
  "aria-hidden": !0,
148
148
  className: "x3nfvp2 x6s0dn4 xl56j7k xtwnzbg x18utl2x x2lah0s",
149
149
  children: t
150
150
  }), /* @__PURE__ */ _("span", {
151
- id: u,
151
+ id: f,
152
152
  ...{
153
153
  0: { className: "xeuugli xb3r6kr xlyipyv xuxw1ft" },
154
154
  1: { className: "xeuugli xb3r6kr xlyipyv xuxw1ft x1s85apg xeod2sa" }
155
- }[!!f | 0],
155
+ }[!!m | 0],
156
156
  children: e
157
157
  })]
158
158
  })
@@ -252,7 +252,7 @@ var R = { drawer: {
252
252
  $$css: !0
253
253
  } };
254
254
  function z({ sidebarHeader: t, sidebar: n, footer: r, children: i, mainId: a = "main", shouldFocus: o = !1 }) {
255
- let [s, c] = h(!0), [l, u] = h(!1), [d] = h(() => e.createHandle()), g = p(), y = m(null), b = m(null);
255
+ let [s, c] = h(!0), [l, u] = h(!1), [d] = h(() => e.createHandle()), g = p(), y = m(null), b = m(null), x = m(!1);
256
256
  return f(() => {
257
257
  let e = globalThis.matchMedia(T.sidebarDesktopQuery);
258
258
  function t() {
@@ -267,7 +267,9 @@ function z({ sidebarHeader: t, sidebar: n, footer: r, children: i, mainId: a = "
267
267
  navigationToggleRef: y,
268
268
  mobileNavigationToggleRef: b,
269
269
  onToggle: () => c((e) => !e),
270
- onNavigate: () => u(!1)
270
+ onNavigate: () => {
271
+ x.current = l, u(!1);
272
+ }
271
273
  },
272
274
  children: [/* @__PURE__ */ v("div", {
273
275
  className: "x9f619 x1ov3xa9 x78zum5 xpvm0e4 xbixft x1hz01jw xtqrqnz x1778rvt xvmahel",
@@ -298,7 +300,14 @@ function z({ sidebarHeader: t, sidebar: n, footer: r, children: i, mainId: a = "
298
300
  onOpenChange: u,
299
301
  children: /* @__PURE__ */ v(e.Portal, { children: [/* @__PURE__ */ _(e.Backdrop, {}), /* @__PURE__ */ _(e.Viewport, { children: /* @__PURE__ */ v(e.Popup, {
300
302
  xstyle: R.drawer,
301
- finalFocus: () => globalThis.matchMedia(T.sidebarDesktopQuery).matches ? y.current : b.current,
303
+ finalFocus: () => {
304
+ if (x.current) {
305
+ x.current = !1;
306
+ let e = document.querySelector(`#${CSS.escape(a)}`), t = document.activeElement;
307
+ return t instanceof HTMLElement && e?.contains(t) === !0 ? t : e;
308
+ }
309
+ return globalThis.matchMedia(T.sidebarDesktopQuery).matches ? y.current : b.current;
310
+ },
302
311
  children: [/* @__PURE__ */ _(e.Title, {
303
312
  isVisuallyHidden: !0,
304
313
  children: "Navigation"
@@ -367,14 +376,14 @@ function U({ label: e, children: t, isFlush: n = !1, scrollRestorationId: r }) {
367
376
  children: t
368
377
  });
369
378
  }
370
- function ee({ children: e }) {
379
+ function W({ children: e }) {
371
380
  return /* @__PURE__ */ _("div", {
372
381
  className: "x2lah0s x1c8xbx5 x178xt8z x13fuv20 xhjagg4 xpvm0e4",
373
382
  children: e
374
383
  });
375
384
  }
376
385
  // packages/layout/src/view-stack.tsx
377
- function W({ children: e }) {
386
+ function ee({ children: e }) {
378
387
  return /* @__PURE__ */ _("div", {
379
388
  className: "x1n2onr6 x78zum5 xdt5ytf x98rzlu xeuugli x2lwn1j",
380
389
  children: e
@@ -392,7 +401,7 @@ function G({ isActive: e, children: t }) {
392
401
  });
393
402
  }
394
403
  var K = {
395
- Root: W,
404
+ Root: ee,
396
405
  Panel: G
397
406
  }, q = { action: {
398
407
  k7Eaqz: "xeuugli",
@@ -578,4 +587,4 @@ var ce = {
578
587
  Pane: oe,
579
588
  Handle: se
580
589
  };
581
- export { z as AppShell, B as DetailPage, V as FocusPage, j as Navigation, N as NavigationItem, P as NavigationLink, M as NavigationSection, X as PageContent, J as PageToolbar, ie as RecordPage, ce as Resizable, I as SidebarFooter, F as SidebarLabel, Y as ToolbarAction, K as ViewStack, H as Workbench, ee as WorkbenchFooter, U as WorkbenchScroll };
590
+ export { z as AppShell, B as DetailPage, V as FocusPage, j as Navigation, N as NavigationItem, P as NavigationLink, M as NavigationSection, X as PageContent, J as PageToolbar, ie as RecordPage, ce as Resizable, I as SidebarFooter, F as SidebarLabel, Y as ToolbarAction, K as ViewStack, H as Workbench, W as WorkbenchFooter, U as WorkbenchScroll };
@@ -1,12 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ChartSelection } from '../chart-frame.tsx';
3
- import type { ChartTone } from '../chart-theme.ts';
4
- export type BarSeries = {
5
- readonly id: string;
6
- readonly label: string;
7
- readonly values: ReadonlyArray<number | null>;
8
- readonly tone?: ChartTone | undefined;
9
- };
3
+ import type { BarComposition, BarSeries } from './bar-data.ts';
4
+ export type { BarSeries, BarBucket, BarComposition } from './bar-data.ts';
10
5
  export type BarChartProps = {
11
6
  readonly title: string;
12
7
  readonly description?: string | undefined;
@@ -18,6 +13,7 @@ export type BarChartProps = {
18
13
  readonly series: ReadonlyArray<BarSeries>;
19
14
  readonly domain: readonly [number, number];
20
15
  readonly mode?: 'grouped' | 'stacked' | undefined;
16
+ readonly composition?: BarComposition | undefined;
21
17
  readonly formatValue: (value: number) => string;
22
18
  readonly selection?: ChartSelection | undefined;
23
19
  readonly height?: number | undefined;
@@ -27,4 +23,4 @@ export type BarChartPlaceholderProps = Pick<BarChartProps, 'description' | 'heig
27
23
  readonly series?: ReadonlyArray<Pick<BarSeries, 'id' | 'label' | 'tone'>> | undefined;
28
24
  };
29
25
  export declare function BarChartPlaceholder({ title, description, series, height, }: BarChartPlaceholderProps): ReactNode;
30
- export declare function BarChart({ title, description, categories, series, domain, mode, formatValue, selection, height, }: BarChartProps): ReactNode;
26
+ export declare function BarChart({ title, description, categories, series, domain, mode, formatValue, selection, height, composition, }: BarChartProps): ReactNode;
@@ -0,0 +1,31 @@
1
+ import type { ChartTone } from '../chart-theme.ts';
2
+ export type BarSeries = {
3
+ readonly id: string;
4
+ readonly label: string;
5
+ readonly values: ReadonlyArray<number | null>;
6
+ readonly tone?: ChartTone | undefined;
7
+ };
8
+ export type BarBucket = {
9
+ readonly kind: 'parts' | 'total';
10
+ readonly total: number;
11
+ } | {
12
+ readonly kind: 'gap';
13
+ };
14
+ export type BarComposition = {
15
+ readonly buckets: ReadonlyArray<BarBucket>;
16
+ readonly contextLabel: string;
17
+ readonly focusedSeries?: BarSeries | undefined;
18
+ readonly annotation?: {
19
+ readonly categoryId: string;
20
+ readonly value: number;
21
+ readonly label: string;
22
+ } | undefined;
23
+ };
24
+ type CompositionInput = {
25
+ readonly composition: BarComposition | undefined;
26
+ readonly series: ReadonlyArray<BarSeries>;
27
+ readonly categoryIds: ReadonlyArray<string>;
28
+ readonly domain: readonly [number, number];
29
+ };
30
+ export declare function validateComposition({ composition, series, categoryIds, domain, }: CompositionInput): string | undefined;
31
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { BarBucket, BarSeries } from './bar-data.ts';
3
+ type CompositionBarsProps = {
4
+ readonly bucket: BarBucket;
5
+ readonly series: ReadonlyArray<BarSeries>;
6
+ readonly focusedSeries: BarSeries | undefined;
7
+ readonly index: number;
8
+ readonly x: number;
9
+ readonly width: number;
10
+ readonly y: (value: number) => number;
11
+ readonly isHighlighted: boolean;
12
+ };
13
+ export declare function CompositionBars({ bucket, series, focusedSeries, index, x, width, y, isHighlighted, }: CompositionBarsProps): ReactNode;
14
+ export {};
@@ -1,4 +1,4 @@
1
- export type { BarSeries, BarChartProps, BarChartPlaceholderProps } from './bar-chart.tsx';
1
+ export type { BarSeries, BarBucket, BarComposition, BarChartProps, BarChartPlaceholderProps } from './bar-chart.tsx';
2
2
  export { BarChart, BarChartPlaceholder } from './bar-chart.tsx';
3
3
  export type { BreakdownBarProps } from './breakdown-bar.tsx';
4
4
  export { BreakdownBar } from './breakdown-bar.tsx';
@@ -19,9 +19,10 @@ export type ChartLegendItem = {
19
19
  export type ChartLegendProps = {
20
20
  readonly items: ReadonlyArray<ChartLegendItem>;
21
21
  readonly label?: string | undefined;
22
+ readonly isScrollable?: boolean | undefined;
22
23
  };
23
24
  export declare function ChartFrame({ title, description, children, actions, footer }: ChartFrameProps): ReactNode;
24
- export declare function ChartLegend({ items, label }: ChartLegendProps): ReactNode;
25
+ export declare function ChartLegend({ items, label, isScrollable }: ChartLegendProps): ReactNode;
25
26
  export declare function ChartDatumButton({ label, isSelected, onSelect, children, }: {
26
27
  readonly label: string;
27
28
  readonly isSelected?: boolean | undefined;
@@ -24,6 +24,7 @@ type NavigationProps = {
24
24
  type NavigationItemProps = ComponentProps<typeof BaseButton> & {
25
25
  readonly icon?: ReactNode;
26
26
  readonly isSelected?: boolean;
27
+ readonly shouldCloseOnActivate?: boolean;
27
28
  };
28
29
  type NavigationLinkProps = ComponentProps<'a'> & {
29
30
  readonly icon?: ReactNode;
@@ -45,7 +46,7 @@ export declare function NavigationSection({ children, label, }: {
45
46
  readonly children: ReactNode;
46
47
  readonly label: string;
47
48
  }): ReactNode;
48
- export declare function NavigationItem({ children, icon, isSelected, onClick, className, style, ...props }: NavigationItemProps): ReactNode;
49
+ export declare function NavigationItem({ children, icon, isSelected, shouldCloseOnActivate, onClick, className, style, ...props }: NavigationItemProps): ReactNode;
49
50
  export declare function NavigationLink({ children, icon, isSelected, onClick, className, style, ...props }: NavigationLinkProps): ReactNode;
50
51
  export declare function SidebarLabel({ children, shouldGrow }: SidebarLabelProps): ReactNode;
51
52
  export declare function SidebarFooter({ children, layout }: SidebarFooterProps): ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mechane-ai/elements",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "description": "Elements by Mechane — React components for applications, AI interfaces, and analytical graphics",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {