@altertable/data-app-react 0.79.0 → 0.80.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.
@@ -175,12 +175,12 @@ type PresentStoryProps = {
175
175
  theme?: ThemeController;
176
176
  headerActions?: ReactNode;
177
177
  footer?: ReactNode;
178
- /** False renders only the presentation, which `?present=1&step=` opens. */
178
+ /** False renders only the presentation, which `?_present=1&_step=` opens. */
179
179
  trigger?: boolean;
180
180
  } & Omit<ComponentPropsWithRef<'button'>, 'title'>;
181
181
  /**
182
- * Uses an already loaded snapshot. Navigation is stored in `?present=1&step=`, and step
183
- * inspection uses `?about=`. The presentation owns its modal structure.
182
+ * Uses an already loaded snapshot. Navigation is stored in `?_present=1&_step=`, and step
183
+ * inspection uses `?_about=`. The presentation owns its modal structure.
184
184
  */
185
185
  declare function PresentStory({ title, findings, empty, scope, dataContext, theme, headerActions, footer, trigger: showTrigger, children, className, onClick, disabled, ref, ...props }: PresentStoryProps): import("react").JSX.Element;
186
186
  //#endregion
@@ -37,6 +37,7 @@ type FilterControls = {
37
37
  /** Every filter one client's operations read, and the hook rendering their controls. */
38
38
  type ClientFilters = {
39
39
  filters: FilterCollection;
40
+ widgets: ReadonlyMap<string, WidgetTarget>;
40
41
  useControls: () => FilterControls;
41
42
  };
42
43
  //#endregion
@@ -62,6 +63,15 @@ declare class ViewContent<Data, Input> {
62
63
  view: DeclaredView<Data, Input, unknown>;
63
64
  };
64
65
  }
66
+ type WidgetContentOptions = {
67
+ /** Stable ID for `?_widget=<id>`. Use lowercase letters and digits separated by single hyphens. IDs must be unique within this `createDataHooks()` instance. */
68
+ id: string;
69
+ /** Wait for custom asynchronous drawing after the selected data commits. Return when ready, including if drawing already finished. Reject on render failure and stop observing when the signal aborts. */
70
+ waitForReady?: (element: HTMLElement, signal: AbortSignal) => void | Promise<void>;
71
+ };
72
+ type WidgetTarget = WidgetContentOptions & {
73
+ content: ViewContent<any, any>;
74
+ };
65
75
  //#endregion
66
76
  //#region src/view.d.ts
67
77
  type ViewDefinition<Name extends string, Input, Data> = {
@@ -392,7 +402,8 @@ type BoundView<Name extends string, Filters extends FilterCollection, Data, Cont
392
402
  previous?: never;
393
403
  }): Metric<Data, FilterInput<Filters>>;
394
404
  scope(snapshot: DisplayedSnapshot<Data, FilterInput<Filters>>): string;
395
- content(render: (state: DataContentState<Data, FilterInput<Filters>>) => ReactNode): ViewContent<Data, FilterInput<Filters>>;
405
+ /** Options are optional. For a read-only `?_widget=<id>` link, declare content at module scope with a stable `id`. Use `waitForReady` for custom asynchronous drawing. */
406
+ content(render: (state: DataContentState<Data, FilterInput<Filters>>) => ReactNode, options?: WidgetContentOptions): ViewContent<Data, FilterInput<Filters>>;
396
407
  };
397
408
  type BoundDetailView<Data, Input, Context extends AuthoringDataContext, Own = Input> = DetailView<Data, Input, Own> & {
398
409
  dataset<Row = DatasetRows<Data>, const Columns extends Record<string, object> = Record<string, object>>(definition: BoundDatasetDefinition<Data, Input, Row, Columns, Context>): Dataset<Data, Input, Row>;
@@ -127,7 +127,7 @@ export declare function TabList<T>({ className, ref, ...props }: TabListProps<T>
127
127
  export declare function Tab(props: ComponentPropsWithRef<typeof Tab$1>): import("react").JSX.Element;
128
128
  export declare function TabPanel(props: ComponentPropsWithRef<typeof TabPanel$1>): import("react").JSX.Element;
129
129
  export declare function Tabs({ className, ...props }: ComponentPropsWithRef<typeof Tabs$1>): import("react").JSX.Element;
130
- /** Keep a page-level tab in `?view=`; reserve `?tab=` for the inspect sheet. */
130
+ /** Keep a page-level tab in `?_view=`; reserve `?_tab=` for the inspect sheet. */
131
131
  export declare function useViewTab<View extends string>(views: readonly View[], fallback: View): [View, (key: string | number) => void];
132
132
  //#endregion
133
133
  //#region src/ui/GlossaryExplanation.d.ts
package/dist/ui/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as ChoicePicker, A as MenuSeparator, B as useDeclaredResult, Bt as Tooltip, D as MenuItem, Dt as DataAppProvider, E as Menu, F as isPlainKeyEvent, Ft as TabPanels, G as NumberFilterPicker, H as ControlBar, Ht as ChartTooltip$1, I as createDataHooks, It as Tabs, J as DimensionPicker, Jt as AppIcon, K as NumberField, Lt as useViewTab, Mt as Tab, Nt as TabList, O as MenuPopover, Pt as TabPanel, Qt as classNames, Rt as Sheet, T as LiveControl, Tt as ShimmerText, U as SearchTypeahead, Ut as TooltipSurface, V as FilterActions, Vt as TooltipProvider, W as SearchField, X as DateTimeRangePicker, Xt as Button$1, Y as FilterBar, Z as Select, Zt as PressButton, _t as HelpPopover, a as DataTable, at as useAppFilters, b as Notice, c as DataTableTimestamp, ct as searchItems, d as explorationMenuEvents, en as useDateFormatting, f as getPrimaryExplorationAction, h as DataWidget, ht as DateDisplay, it as dateTimeRangePresets, j as MenuTrigger, k as MenuSection, kt as AboutData, l as ExplorationActionControl, m as useChartActions, n as createDataContext, nn as injectDataAppStyles, nt as SearchMatch, o as DataTableEmptyRow, p as openExplorationMenu, q as NumberRangeField, r as chartBarFill, rt as dateTimeRangeFilter, s as DataTableShare, st as matchSearchText, t as SectionHeading, tt as SelectionMark, u as ExplorationActionMenu, w as PresentStory, x as DataAppFrame, zt as GradientScroll } from "../chunks/SectionHeading-BAZB-Fnf.js";
1
+ import { $ as DimensionPicker, A as LiveControl, B as isPlainKeyEvent, Bt as TabList, C as DataAppFrame, F as MenuSeparator, G as useDeclaredResult, Gt as Sheet, Ht as TabPanels, I as MenuTrigger, It as AboutData, J as SearchTypeahead, K as FilterActions, Kt as GradientScroll, M as MenuItem, Mt as ShimmerText, N as MenuPopover, P as MenuSection, Pt as DataAppProvider, Q as NumberRangeField, Qt as TooltipSurface, St as HelpPopover, Ut as Tabs, V as createDataHooks, Vt as TabPanel, Wt as useViewTab, X as NumberFilterPicker, Xt as TooltipProvider, Y as SearchField, Yt as Tooltip, Z as NumberField, Zt as ChartTooltip$1, a as DataTable, an as Button$1, b as Notice, bt as DateDisplay, c as DataTableTimestamp, ct as dateTimeRangeFilter, d as explorationMenuEvents, dn as injectDataAppStyles, et as FilterBar, f as getPrimaryExplorationAction, ft as matchSearchText, h as DataWidget, it as ChoicePicker, j as Menu, k as PresentStory, l as ExplorationActionControl, ln as useDateFormatting, lt as dateTimeRangePresets, m as useChartActions, n as createDataContext, nt as Select, o as DataTableEmptyRow, on as PressButton, ot as SelectionMark, p as openExplorationMenu, pt as searchItems, q as ControlBar, r as chartBarFill, rn as AppIcon, s as DataTableShare, sn as classNames, st as SearchMatch, t as SectionHeading, tt as DateTimeRangePicker, u as ExplorationActionMenu, ut as useAppFilters, zt as Tab } from "../chunks/SectionHeading-DR8RX7YZ.js";
2
2
  import { KEY_SEPARATOR, invariant, validateChoiceOptions } from "@altertable/data-app/internal";
3
3
  import { Children, Fragment, cloneElement, createContext, isValidElement, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { Label, Radio as Radio$1, RadioGroup as RadioGroup$1 } from "react-aria-components";
@@ -2445,19 +2445,23 @@ function timeTickIndices(items, width) {
2445
2445
  function PlotBoundsObserver({ overlayRef }) {
2446
2446
  const plot = usePlotArea();
2447
2447
  const left = plot?.x;
2448
+ const top = plot?.y;
2448
2449
  const width = plot?.width;
2449
2450
  useLayoutEffect(() => {
2450
- if (left === void 0 || width === void 0 || !Number.isFinite(left) || !Number.isFinite(width) || !overlayRef.current) return;
2451
+ if (left === void 0 || top === void 0 || width === void 0 || !Number.isFinite(left) || !Number.isFinite(top) || !Number.isFinite(width) || !overlayRef.current) return;
2451
2452
  const overlay = overlayRef.current;
2453
+ overlay.style.top = `${top}px`;
2452
2454
  overlay.style.marginLeft = `${left}px`;
2453
2455
  overlay.style.width = `${width}px`;
2454
2456
  return () => {
2457
+ overlay.style.top = "";
2455
2458
  overlay.style.marginLeft = "";
2456
2459
  overlay.style.width = "";
2457
2460
  };
2458
2461
  }, [
2459
2462
  overlayRef,
2460
2463
  left,
2464
+ top,
2461
2465
  width
2462
2466
  ]);
2463
2467
  return null;
@@ -2634,9 +2638,9 @@ function BarChart({ items, unit, ariaLabel, formatValue: authoredFormatValue, it
2634
2638
  data,
2635
2639
  responsive: true,
2636
2640
  width: "100%",
2637
- height: 220 + axisLabelSpace,
2641
+ height: 220 + 2 * axisLabelSpace,
2638
2642
  margin: {
2639
- top: 0,
2643
+ top: axisLabelSpace,
2640
2644
  right: 0,
2641
2645
  bottom: axisLabelSpace,
2642
2646
  left: 0
@@ -2705,6 +2709,7 @@ function BarChart({ items, unit, ariaLabel, formatValue: authoredFormatValue, it
2705
2709
  /* @__PURE__ */ jsx("div", {
2706
2710
  className: "altertable-selectable-bars-scroll",
2707
2711
  "data-time-axis": compactTimeAxis || void 0,
2712
+ style: { "--atbl-internal-bar-axis-space": `${axisLabelSpace}px` },
2708
2713
  ref: scrollport,
2709
2714
  children: /* @__PURE__ */ jsxs("div", {
2710
2715
  className: "altertable-selectable-bars-plot",