@makoai/app-sdk 2.29.0 → 2.30.1

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.
package/ui.css CHANGED
@@ -183,6 +183,8 @@ button, input, select, textarea { font-family: inherit; }
183
183
  padding: 8px 10px; font-size: 12px; line-height: 1.4; white-space: nowrap;
184
184
  }
185
185
  .mk-tip-title { font-weight: 600; margin-bottom: 4px; }
186
+ /* `note` (2.30): a muted line under the table, e.g. a click hint. */
187
+ .mk-tip-note { margin-top: 6px; font-size: 11px; color: var(--muted-foreground); white-space: normal; }
186
188
  .mk-tip table { border-collapse: collapse; }
187
189
  .mk-tip thead th { color: var(--muted-foreground); font-weight: 500; text-align: right; padding-left: 12px; }
188
190
  .mk-tip tbody th { text-align: left; font-weight: 400; padding-top: 2px; }
@@ -193,7 +195,7 @@ button, input, select, textarea { font-family: inherit; }
193
195
  /* A zero ("0", "0%") or a missing value ("–"): kept, but muted. */
194
196
  .mk-tip-muted { color: var(--muted-foreground); font-weight: 400; }
195
197
  .mk-tip-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
196
- .mk-tip-total th, .mk-tip-total td { font-weight: 600; }
198
+ .mk-tip .mk-tip-total th, .mk-tip .mk-tip-total td { font-weight: 600; }
197
199
  .mk-tip-rule th, .mk-tip-rule td { border-top: 1px solid var(--border); padding-top: 3px; }
198
200
 
199
201
  /* ---- DataTable ----------------------------------------------------------- */
@@ -320,6 +322,35 @@ button, input, select, textarea { font-family: inherit; }
320
322
  .mk-dt-table tfoot td.mk-dt-pin { z-index: 3; box-shadow: inset -1px 0 0 var(--border), inset 0 1px 0 var(--border); }
321
323
  .mk-dt-table tfoot tr.mk-dt-total.mk-dt-click:hover > td,
322
324
  .mk-dt-table tfoot tr.mk-dt-total.mk-dt-click:focus-visible > td { background: color-mix(in srgb, var(--muted) 50%, var(--card)); }
325
+ /* Section rows (2.30): one cell across the columns, a small muted heading
326
+ * on a tinted band (agent-acquisition-funnel's "Inbound" / "Outbound"). */
327
+ .mk-dt-table tbody tr.mk-dt-section-row > td,
328
+ .mk-dt-table tbody tr.mk-dt-section-row:hover > td {
329
+ padding: 0; background: color-mix(in srgb, var(--muted) 40%, var(--card));
330
+ }
331
+ .mk-dt-section-label {
332
+ position: sticky; left: 0; width: max-content; max-width: 100%; padding: 12px 10px 4px;
333
+ font-size: 11px; font-weight: 600; color: var(--muted-foreground); white-space: normal;
334
+ }
335
+ /* `loading` (2.30): shadcn's Skeleton (bg-accent animate-pulse rounded-md)
336
+ * in each cell while there are no rows; rows on screen dim instead. */
337
+ .mk-dt-skeleton { display: block; height: 14px; border-radius: calc(var(--radius, .625rem) - 2px); background: var(--accent); animation: mk-skeleton-pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
338
+ .mk-dt-table .mk-dt-num .mk-dt-skeleton { margin-left: auto; }
339
+ .mk-dt-table .mk-dt-center .mk-dt-skeleton { margin-inline: auto; }
340
+ .mk-dt-table tbody tr.mk-dt-skeleton-row:hover > td { background: var(--card); }
341
+ @keyframes mk-skeleton-pulse { 50% { opacity: .5; } }
342
+ .mk-dt-busy { opacity: .5; transition: opacity .15s; }
343
+ /* Column resizing (2.30): a drag handle on each header's right edge, after
344
+ * idx-portal's: a 2px line shows on hover, in brand while dragging. */
345
+ .mk-dt-table--grouped thead th.mk-dt-resizable:not(.mk-dt-pin) { position: relative; }
346
+ .mk-dt-resizer { position: absolute; top: 0; right: 0; bottom: 0; z-index: 4; width: 8px; cursor: col-resize; touch-action: none; user-select: none; }
347
+ .mk-dt-resizer::after { content: ""; position: absolute; top: 8px; bottom: 8px; right: 0; width: 2px; border-radius: 1px; background: transparent; }
348
+ .mk-dt-table th:hover > .mk-dt-resizer::after { background: var(--border); }
349
+ .mk-dt-table th > .mk-dt-resizer:hover::after, .mk-dt-resizer--active::after { background: var(--brand); }
350
+ body.mk-dt-col-resizing { cursor: col-resize; user-select: none; }
351
+ /* "onEnd": the handle travels past its header while dragging, so that header
352
+ * stops clipping and paints above its neighbours until release. */
353
+ .mk-dt-table thead th:has(> .mk-dt-resizer--active) { overflow: visible; z-index: 5; }
323
354
  .mk-dt-foot {
324
355
  flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
325
356
  padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted-foreground);
@@ -347,6 +378,8 @@ button, input, select, textarea { font-family: inherit; }
347
378
  transition: background .15s var(--mk-ease), border-color .15s var(--mk-ease);
348
379
  }
349
380
  .mk-ms-trigger:hover { background: var(--accent); }
381
+ /* `disabled` (2.30): shadcn Button's disabled look (disabled:pointer-events-none disabled:opacity-50). */
382
+ .mk-ms-trigger:disabled { pointer-events: none; opacity: .5; }
350
383
  .mk-ms-trigger:focus-visible { outline: none; }
351
384
  .mk-ms-trigger.open, .mk-ms-trigger:focus-visible { border-color: var(--ring); box-shadow: var(--mk-ring-focus); }
352
385
  .mk-ms-value { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
package/ui.d.ts CHANGED
@@ -175,6 +175,8 @@ export interface MultiSelectProps<V extends string = string> {
175
175
  locale?: string;
176
176
  /** Override single texts on top of the locale (2.29). The explicit props win. */
177
177
  labels?: Partial<FilterLabels>;
178
+ /** Disables the trigger as shadcn's Button does (2.30): half opacity, no pointer, not focusable. An open menu closes. */
179
+ disabled?: boolean;
178
180
  className?: string;
179
181
  "aria-label"?: string;
180
182
  }
@@ -274,6 +276,8 @@ export interface FreshnessBadgeProps {
274
276
  action?: React.ReactNode;
275
277
  footer?: React.ReactNode;
276
278
  align?: "start" | "end";
279
+ /** BCP 47 tag (2.30), e.g. "fr-CH": the panel's and the source list's screen-reader names in that language. Default English. */
280
+ locale?: string;
277
281
  className?: string;
278
282
  }
279
283
  export function FreshnessBadge(props: FreshnessBadgeProps): React.ReactElement;
@@ -295,6 +299,12 @@ export interface RefreshAllButtonProps {
295
299
  schedule?: string;
296
300
  /** Override the rebuild (tests, custom engines). Default refreshBinding. */
297
301
  refresh?: (name: string) => Promise<unknown>;
302
+ /**
303
+ * BCP 47 tag (2.30), e.g. "fr-CH": the button, the modal, each source's
304
+ * state and the finish time in that language (STRINGS[lang].refresh).
305
+ * Default English, exactly as before. `labels` stays the binding names' map.
306
+ */
307
+ locale?: string;
298
308
  className?: string;
299
309
  }
300
310
  export function RefreshAllButton(props: RefreshAllButtonProps): React.ReactElement;
@@ -307,6 +317,8 @@ export interface TooltipRow {
307
317
  /** A null or undefined cell shows a muted "–"; "" stays blank. */
308
318
  cells: React.ReactNode[];
309
319
  key?: string;
320
+ /** A rule above this row (2.30), e.g. an "Ending MRR" line before the total. Default false. */
321
+ rule?: boolean;
310
322
  }
311
323
  export interface TableTooltipProps {
312
324
  title?: React.ReactNode;
@@ -320,6 +332,8 @@ export interface TableTooltipProps {
320
332
  after?: TooltipRow[];
321
333
  /** The value columns' minimum width: "9ch", or px as a number. Default 7ch. */
322
334
  colWidth?: number | string;
335
+ /** A muted line under the table (2.30): a caveat, "Click to list the opportunities". */
336
+ note?: React.ReactNode;
323
337
  className?: string;
324
338
  }
325
339
  /** The house chart tooltip: a table with swatches, right-aligned numbers and a total row. */
@@ -412,6 +426,21 @@ export interface DataTableColumn<R = any> {
412
426
  grow?: boolean;
413
427
  /** A growing column's floor; defaults to its `width`. Other columns are exactly `width`. */
414
428
  minWidth?: number | string;
429
+ /** TanStack Table's width in px (2.30): the column's width when `width` is unset, and its start width for resizing. */
430
+ size?: number;
431
+ /** The narrowest a drag makes the column, px (2.30, TanStack's). Default 20. */
432
+ minSize?: number;
433
+ /** The widest a drag makes the column, px (2.30, TanStack's). Default none. */
434
+ maxSize?: number;
435
+ /** false: no resize handle on this column (2.30, TanStack's). Default true under `enableColumnResizing`. */
436
+ enableResizing?: boolean;
437
+ /**
438
+ * A class for each body cell (2.30), from the cell's value and row, e.g. a
439
+ * heat cell: `(v) => v > 0.5 ? "heat-high" : undefined`. Not on the total row.
440
+ */
441
+ cellClassName?: string | ((value: any, row: R) => string | undefined);
442
+ /** An inline style for each body cell (2.30), e.g. a heat colour from the value. Not on the total row. */
443
+ cellStyle?: React.CSSProperties | ((value: any, row: R) => React.CSSProperties | undefined);
415
444
  /**
416
445
  * Default true: the cell stays on one line and ellipsizes at the column's
417
446
  * width, the raw value (text or number) as its hover title. false wraps the
@@ -500,6 +529,8 @@ export interface DataTableLabels {
500
529
  collapse: (row: any) => string;
501
530
  /** A header "i" button's aria-label. Default "About MRR". */
502
531
  info: (label: string) => string;
532
+ /** A column resize handle's hover title (2.30). Default "Drag to resize · double-click to reset". */
533
+ resizeHint: string;
503
534
  }
504
535
  /**
505
536
  * Which rows show their detail row: `true` for every row, or the open rows'
@@ -507,6 +538,18 @@ export interface DataTableLabels {
507
538
  * `ExpandedState`, so one state can drive both.
508
539
  */
509
540
  export type DataTableExpanded = true | Record<string, boolean>;
541
+ /** TanStack Table's SortingState (2.30). DataTable reads the first entry only. */
542
+ export type SortingState = { id: string; desc: boolean }[];
543
+ /** TanStack Table's PaginationState (2.30): a 0-based page index and the page size. */
544
+ export interface PaginationState {
545
+ pageIndex: number;
546
+ pageSize: number;
547
+ }
548
+ /** TanStack Table's ColumnSizingState (2.30): dragged widths in px, by column id. */
549
+ export type ColumnSizingState = Record<string, number>;
550
+ /** TanStack Table's Updater and OnChangeFn. DataTable always passes the next value, never a function. */
551
+ export type Updater<T> = T | ((old: T) => T);
552
+ export type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void;
510
553
  /** The English defaults of `DataTableLabels`. */
511
554
  export const DATA_TABLE_LABELS: DataTableLabels;
512
555
  /** The labels a DataTable uses for a locale (2.29), `labels` on top. */
@@ -609,6 +652,55 @@ export interface DataTableProps<R = any> {
609
652
  onTotalRowClick?: (row: R, event: React.SyntheticEvent) => void;
610
653
  /** Append the total row to the CSV export. Default false. */
611
654
  exportTotalRow?: boolean;
655
+ /**
656
+ * Server-side sort (2.30, TanStack's): the rows come sorted, the table
657
+ * never reorders them. A header click still reports the next sort through
658
+ * `onSortingChange` / `onSortChange`. Default false.
659
+ */
660
+ manualSorting?: boolean;
661
+ /**
662
+ * Server-side paging (2.30, TanStack's): `rows` is the current page, shown
663
+ * as given, and `rowCount` the total behind the footer and the pager.
664
+ * The built-in CSV export is off (the table holds one page). Default false.
665
+ */
666
+ manualPagination?: boolean;
667
+ /** The total row count for `manualPagination` (TanStack's). Without it the pager knows only the pages so far. */
668
+ rowCount?: number;
669
+ /** Controlled sort in TanStack's shape (2.30). Wins over `sort`. */
670
+ sorting?: SortingState;
671
+ /** Gets `[{ id, desc }]` on a header click (2.30). A `useState` setter works. */
672
+ onSortingChange?: OnChangeFn<SortingState>;
673
+ /** Controlled page and size in TanStack's shape (2.30), 0-based. Wins over `page` and `pageSize`. */
674
+ pagination?: PaginationState;
675
+ /** Gets `{ pageIndex, pageSize }` once per page or size change (2.30). A `useState` setter works. */
676
+ onPaginationChange?: OnChangeFn<PaginationState>;
677
+ /**
678
+ * The rows are loading (2.30): with no rows, up to 10 skeleton rows (shadcn's
679
+ * Skeleton) fill the body; with rows, they dim until the next ones land.
680
+ * The footer counts `rowCount` meanwhile. Default false.
681
+ */
682
+ loading?: boolean;
683
+ /**
684
+ * A drag handle on each header's right edge (2.30, TanStack's). A double
685
+ * click resets the column. Widths clamp to `minSize` / `maxSize`. Pointer
686
+ * only, as TanStack: no keyboard resize. Default false.
687
+ */
688
+ enableColumnResizing?: boolean;
689
+ /** "onEnd" (TanStack's default): the handle moves and the width changes on release. "onChange": the width follows the pointer. */
690
+ columnResizeMode?: "onChange" | "onEnd";
691
+ /** Controlled widths `{ [id]: px }` (2.30); pair with `onColumnSizingChange` to keep them per viewer. */
692
+ columnSizing?: ColumnSizingState;
693
+ onColumnSizingChange?: OnChangeFn<ColumnSizingState>;
694
+ /**
695
+ * Flags section rows (2.30): each renders one cell across every column, a
696
+ * heading for the rows after it ("Inbound", "Outbound"). Rows sort inside
697
+ * their section, and section rows stay out of the pager, the footer
698
+ * count, the CSV and `totalRow`. A section repeats at the top of a page
699
+ * its rows continue on.
700
+ */
701
+ isSectionRow?: (row: R) => boolean;
702
+ /** A section row's content. Default the first column's `render` (else `value`) of that row. */
703
+ renderSection?: (row: R) => React.ReactNode;
612
704
  className?: string;
613
705
  style?: React.CSSProperties;
614
706
  }
@@ -627,10 +719,22 @@ export function defaultColumnWidth(column: Pick<DataTableColumn, "num" | "align"
627
719
  * The fixed layout a DataTable renders: each `<col>` width (null for a
628
720
  * growing column) and the table's min-width, the sum of the columns.
629
721
  */
630
- export function columnLayout(columns: readonly Pick<DataTableColumn, "id" | "num" | "align" | "date" | "sticky" | "width" | "minWidth" | "grow">[]): {
722
+ export function columnLayout(
723
+ columns: readonly Pick<DataTableColumn, "id" | "num" | "align" | "date" | "sticky" | "width" | "minWidth" | "grow" | "size">[],
724
+ sizing?: ColumnSizingState,
725
+ ): {
631
726
  cols: { id: string; width: string | null }[];
632
727
  minWidth: string;
728
+ /** Set when `sizing` left no growing column: the table is exactly `minWidth` wide. */
729
+ fixed?: true;
633
730
  };
731
+ /** A width after a drag (2.30): start + travel, rounded, within `minSize` (default 20) and `maxSize`. */
732
+ export function resizeWidth(column: Pick<DataTableColumn, "minSize" | "maxSize">, startWidth: number, delta: number): number;
733
+ /** Runs of rows split at each section row (2.30). Rows before the first section run with `section: null`. */
734
+ export function splitSections<R>(rows: readonly R[], isSection: (row: R) => boolean): { section: R | null; rows: R[] }[];
735
+ /** TanStack's SortingState as a DataTable sort (first entry only), and back. */
736
+ export function fromSorting(sorting: SortingState | null | undefined): DataTableSort | null;
737
+ export function toSorting(sort: DataTableSort | null | undefined): SortingState;
634
738
  /** A sorted copy: stable, by `value(row)`, empty values (null, "", NaN) last both ways. */
635
739
  export function sortRows<R>(rows: readonly R[], columns: readonly DataTableColumn<R>[], sort: DataTableSort | null | undefined): R[];
636
740
  /** The sort after a header click: same column flips; a new one starts desc for `num`, else asc. */