@datum-cloud/datum-ui 1.8.0 → 2.1.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 (91) hide show
  1. package/dist/autocomplete/index.mjs +1 -1
  2. package/dist/{autocomplete-DM6JYV4W.mjs → autocomplete-DZ_HSBak.mjs} +1 -1
  3. package/dist/autosearch/index.mjs +1 -1
  4. package/dist/{calendar-date-picker-AzvSqjeS.mjs → calendar-date-picker-ynSGADfR.mjs} +1 -1
  5. package/dist/components/base/sheet/sheet.d.ts +2 -1
  6. package/dist/components/features/data-table/columns/selection-column.d.ts +5 -4
  7. package/dist/components/features/data-table/components/bulk-actions.d.ts +2 -1
  8. package/dist/components/features/data-table/components/column-header.d.ts +2 -1
  9. package/dist/components/features/data-table/components/inline-content.d.ts +2 -1
  10. package/dist/components/features/data-table/components/row-actions.d.ts +2 -1
  11. package/dist/components/features/data-table/core/client-provider.d.ts +3 -2
  12. package/dist/components/features/data-table/core/data-table-context.d.ts +46 -6
  13. package/dist/components/features/data-table/core/features.d.ts +59 -0
  14. package/dist/components/features/data-table/core/filter-engine.d.ts +4 -3
  15. package/dist/components/features/data-table/core/server-provider.d.ts +3 -2
  16. package/dist/components/features/data-table/core/store.d.ts +2 -1
  17. package/dist/components/features/data-table/hooks/use-data-table-client.d.ts +86 -7
  18. package/dist/components/features/data-table/hooks/use-data-table-server.d.ts +86 -7
  19. package/dist/components/features/data-table/hooks/use-selectors.d.ts +7 -6
  20. package/dist/components/features/data-table/index.d.ts +2 -0
  21. package/dist/components/features/data-table/types.d.ts +30 -29
  22. package/dist/components/features/date-time/date-time.d.ts +6 -0
  23. package/dist/components/features/date-time/formatters.d.ts +13 -0
  24. package/dist/components/features/date-time/index.d.ts +3 -0
  25. package/dist/components/features/date-time/types.d.ts +47 -0
  26. package/dist/components/features/grouped-table/grouped-table.d.ts +2 -1
  27. package/dist/components/features/grouped-table/lib/bucket-rows.d.ts +3 -2
  28. package/dist/components/features/grouped-table/lib/compose-columns.d.ts +4 -3
  29. package/dist/components/features/grouped-table/lib/sort-rows.d.ts +3 -2
  30. package/dist/components/features/grouped-table/types.d.ts +7 -6
  31. package/dist/components/features/grouped-table/use-grouped-expansion.d.ts +2 -1
  32. package/dist/components/features/index.d.ts +1 -0
  33. package/dist/components/features/logs/components/detail.d.ts +3 -0
  34. package/dist/components/features/logs/components/explorer.d.ts +3 -0
  35. package/dist/components/features/logs/components/filters.d.ts +11 -0
  36. package/dist/components/features/logs/components/root.d.ts +2 -0
  37. package/dist/components/features/logs/components/status-badge.d.ts +7 -0
  38. package/dist/components/features/logs/components/table.d.ts +3 -0
  39. package/dist/components/features/logs/components/toolbar.d.ts +12 -0
  40. package/dist/components/features/logs/fixtures/index.d.ts +2 -0
  41. package/dist/components/features/logs/hooks/use-controllable-state.d.ts +5 -0
  42. package/dist/components/features/logs/hooks/use-logs.d.ts +3 -0
  43. package/dist/components/features/logs/index.d.ts +4 -0
  44. package/dist/components/features/logs/logs.d.ts +18 -0
  45. package/dist/components/features/logs/types.d.ts +105 -0
  46. package/dist/components/features/logs/utils/build-logql.d.ts +2 -0
  47. package/dist/components/features/logs/utils/constants.d.ts +6 -0
  48. package/dist/components/features/logs/utils/facets.d.ts +3 -0
  49. package/dist/components/features/logs/utils/flatten-loki.d.ts +3 -0
  50. package/dist/components/features/logs/utils/format-timestamp.d.ts +4 -0
  51. package/dist/components/features/logs/utils/index.d.ts +8 -0
  52. package/dist/components/features/logs/utils/parse-log-line.d.ts +7 -0
  53. package/dist/components/features/logs/utils/severity.d.ts +5 -0
  54. package/dist/components/features/logs/utils/time-range.d.ts +3 -0
  55. package/dist/data-table/index.mjs +2 -2
  56. package/dist/{data-table-mByk373T.mjs → data-table-Du7_FLBi.mjs} +44 -12
  57. package/dist/date-picker/index.mjs +3 -3
  58. package/dist/date-time/index.mjs +2 -0
  59. package/dist/date-time-CA-09lnw.mjs +134 -0
  60. package/dist/date-time-picker/index.mjs +1 -1
  61. package/dist/{date-time-picker-D3-DeNo8.mjs → date-time-picker-BzcHrf-A.mjs} +1 -1
  62. package/dist/{picker-b5-x-EHs.mjs → date-time-range-picker-Dog33Ry0.mjs} +22 -456
  63. package/dist/form/index.mjs +1 -1
  64. package/dist/{form-BUUNQfC9.mjs → form-BhBsoMFA.mjs} +4 -4
  65. package/dist/grouped-table/index.mjs +1 -1
  66. package/dist/{grouped-table-b2jDEPR6.mjs → grouped-table--jejU1Jy.mjs} +5 -6
  67. package/dist/index.mjs +19 -18
  68. package/dist/logs/fixtures/index.mjs +231 -0
  69. package/dist/logs/index.mjs +980 -0
  70. package/dist/mobile-sheet/index.mjs +1 -1
  71. package/dist/{mobile-sheet-D9L-JOee.mjs → mobile-sheet-BYp-QQmn.mjs} +1 -1
  72. package/dist/more-actions/index.mjs +1 -1
  73. package/dist/{more-actions-Bx443Ccx.mjs → more-actions-B1FUf2rm.mjs} +1 -1
  74. package/dist/multi-select/index.mjs +1 -1
  75. package/dist/{multi-select-PHaMEbY-.mjs → multi-select-PtdMChPF.mjs} +1 -1
  76. package/dist/picker/index.mjs +2 -1
  77. package/dist/picker-raVuDxsh.mjs +453 -0
  78. package/dist/responsive-dropdown/index.mjs +1 -1
  79. package/dist/{responsive-dropdown-fCmduKaz.mjs → responsive-dropdown-n0Txkax5.mjs} +1 -1
  80. package/dist/responsive-popover/index.mjs +1 -1
  81. package/dist/{responsive-popover-DJZgXWIE.mjs → responsive-popover-C_1nzIvm.mjs} +1 -1
  82. package/dist/rich-text-editor/index.mjs +1 -1
  83. package/dist/{rich-text-editor-CGuSn8xi.mjs → rich-text-editor-Dohp-pbf.mjs} +1 -1
  84. package/dist/sheet/index.mjs +1 -1
  85. package/dist/{sheet-BZViad2U.mjs → sheet-C2i2k5i2.mjs} +2 -2
  86. package/dist/task-queue/index.mjs +1 -1
  87. package/dist/{task-queue-dropdown-pqFd4rSf.mjs → task-queue-dropdown-ClLLTMxU.mjs} +1 -1
  88. package/dist/time-picker/index.mjs +1 -1
  89. package/dist/{time-picker-B_fN5vhO.mjs → time-picker-CFhaHTtI.mjs} +1 -1
  90. package/dist/{to-api-format-43Boq7OR.mjs → to-api-format-WC7b9Mcv.mjs} +2 -2
  91. package/package.json +20 -5
@@ -1,6 +1,7 @@
1
- import type { Cell, Column, ColumnDef, Row, RowSelectionState, SortingState, Table } from '@tanstack/react-table';
1
+ import type { Cell, Column, ColumnDef, ReactTable, Row, RowData, RowSelectionState, SortingState, Table } from '@tanstack/react-table';
2
2
  import type { ReactNode } from 'react';
3
3
  import type { ActionItem } from '../more-actions';
4
+ import type { DataTableFeatures } from './core/features';
4
5
  export type { ActionItem } from '../more-actions';
5
6
  export interface FilterOption {
6
7
  readonly label: string;
@@ -71,16 +72,16 @@ export interface ServerFetchArgs {
71
72
  readonly filters: FilterValue;
72
73
  readonly search: string;
73
74
  }
74
- export interface ServerTransformResult<TData> {
75
+ export interface ServerTransformResult<TData extends RowData> {
75
76
  readonly data: TData[];
76
77
  readonly cursor?: string;
77
78
  readonly hasNextPage: boolean;
78
79
  }
79
- export interface InlineContentRenderParams<TData> {
80
+ export interface InlineContentRenderParams<TData extends RowData> {
80
81
  readonly onClose: () => void;
81
82
  readonly rowData: TData | null;
82
83
  }
83
- export interface InlineContentEntry<TData> {
84
+ export interface InlineContentEntry<TData extends RowData> {
84
85
  readonly id: string;
85
86
  readonly position: 'top' | 'row';
86
87
  readonly rowId?: string;
@@ -89,7 +90,7 @@ export interface InlineContentEntry<TData> {
89
90
  readonly className?: string;
90
91
  readonly render: (params: InlineContentRenderParams<TData>) => ReactNode;
91
92
  }
92
- export interface InlineContentProps<TData> {
93
+ export interface InlineContentProps<TData extends RowData> {
93
94
  readonly position: 'top' | 'row';
94
95
  readonly rowId?: string;
95
96
  readonly open: boolean;
@@ -97,22 +98,22 @@ export interface InlineContentProps<TData> {
97
98
  readonly className?: string;
98
99
  readonly children: (params: InlineContentRenderParams<TData>) => ReactNode;
99
100
  }
100
- export interface SelectionColumnOptions<TData = unknown> {
101
+ export interface SelectionColumnOptions<TData extends RowData = Record<string, any>> {
101
102
  /** CSS class for cell checkboxes */
102
103
  readonly className?: string;
103
104
  /** CSS class for header checkbox */
104
105
  readonly headerClassName?: string;
105
106
  /** Custom header render (replaces default "select all" checkbox) */
106
107
  readonly renderHeader?: (props: {
107
- table: Table<TData>;
108
+ table: Table<DataTableFeatures, TData>;
108
109
  }) => ReactNode;
109
110
  /** Custom cell render (replaces default row checkbox) */
110
111
  readonly renderCell?: (props: {
111
- row: Row<TData>;
112
+ row: Row<DataTableFeatures, TData>;
112
113
  }) => ReactNode;
113
114
  }
114
- export interface DataTableContextValue<TData> {
115
- readonly table: Table<TData>;
115
+ export interface DataTableContextValue<TData extends RowData> {
116
+ readonly table: ReactTable<DataTableFeatures, TData>;
116
117
  readonly mode: 'client' | 'server';
117
118
  readonly sorting: SortingState;
118
119
  readonly filters: FilterValue;
@@ -131,9 +132,9 @@ export interface DataTableContextValue<TData> {
131
132
  readonly registerInlineContent: (entry: InlineContentEntry<TData>) => void;
132
133
  readonly unregisterInlineContent: (id: string) => void;
133
134
  }
134
- export interface UseDataTableClientOptions<TData> {
135
+ export interface UseDataTableClientOptions<TData extends RowData> {
135
136
  readonly data: TData[];
136
- readonly columns: ColumnDef<TData, unknown>[];
137
+ readonly columns: ColumnDef<DataTableFeatures, TData, unknown>[];
137
138
  readonly pageSize?: number;
138
139
  readonly getRowId?: (row: TData) => string;
139
140
  readonly enableRowSelection?: boolean | SelectionColumnOptions<TData>;
@@ -144,8 +145,8 @@ export interface UseDataTableClientOptions<TData> {
144
145
  readonly filterFns?: FilterFnMap;
145
146
  readonly stateAdapter?: StateAdapter;
146
147
  }
147
- export interface UseDataTableServerOptions<TResponse, TData> {
148
- readonly columns: ColumnDef<TData, unknown>[];
148
+ export interface UseDataTableServerOptions<TResponse, TData extends RowData> {
149
+ readonly columns: ColumnDef<DataTableFeatures, TData, unknown>[];
149
150
  readonly fetchFn: (args: ServerFetchArgs) => Promise<TResponse>;
150
151
  readonly transform: (response: TResponse) => ServerTransformResult<TData>;
151
152
  readonly limit?: number;
@@ -155,9 +156,9 @@ export interface UseDataTableServerOptions<TResponse, TData> {
155
156
  readonly defaultFilters?: FilterValue;
156
157
  readonly stateAdapter?: StateAdapter;
157
158
  }
158
- interface DataTableBaseProps<TData> {
159
+ interface DataTableBaseProps<TData extends RowData> {
159
160
  readonly data: TData[];
160
- readonly columns: ColumnDef<TData, unknown>[];
161
+ readonly columns: ColumnDef<DataTableFeatures, TData, unknown>[];
161
162
  readonly sorting: SortingState;
162
163
  readonly setSorting: (sorting: SortingState) => void;
163
164
  readonly filters: FilterValue;
@@ -174,12 +175,12 @@ interface DataTableBaseProps<TData> {
174
175
  readonly className?: string;
175
176
  readonly children: ReactNode;
176
177
  }
177
- export interface DataTableClientProps<TData> extends DataTableBaseProps<TData> {
178
+ export interface DataTableClientProps<TData extends RowData> extends DataTableBaseProps<TData> {
178
179
  readonly pagination: ClientPaginationState;
179
180
  readonly searchableColumns?: string[];
180
181
  readonly searchFn?: (row: TData, search: string) => boolean;
181
182
  }
182
- export interface DataTableServerProps<TData> extends DataTableBaseProps<TData> {
183
+ export interface DataTableServerProps<TData extends RowData> extends DataTableBaseProps<TData> {
183
184
  readonly isLoading: boolean;
184
185
  readonly pagination: ServerPaginationState;
185
186
  }
@@ -224,24 +225,24 @@ export interface FilterCheckboxProps {
224
225
  readonly sheetTitle?: string;
225
226
  readonly modal?: boolean;
226
227
  }
227
- export interface ColumnHeaderProps<TData, TValue> {
228
- readonly column: Column<TData, TValue>;
228
+ export interface ColumnHeaderProps<TData extends RowData, TValue> {
229
+ readonly column: Column<DataTableFeatures, TData, TValue>;
229
230
  readonly title: string;
230
231
  readonly className?: string;
231
232
  }
232
- export interface RowActionsProps<TData> {
233
- readonly row: Row<TData>;
233
+ export interface RowActionsProps<TData extends RowData> {
234
+ readonly row: Row<DataTableFeatures, TData>;
234
235
  readonly actions: readonly ActionItem<TData>[];
235
236
  readonly isLoading?: boolean;
236
237
  readonly className?: string;
237
238
  readonly responsive?: boolean;
238
239
  readonly sheetTitle?: string;
239
240
  }
240
- export interface BulkActionsProps<TData> {
241
+ export interface BulkActionsProps<TData extends RowData> {
241
242
  readonly children: (selectedRows: TData[]) => ReactNode;
242
243
  readonly className?: string;
243
244
  }
244
- export interface ContentProps<TData = unknown> {
245
+ export interface ContentProps<TData extends RowData = Record<string, any>> {
245
246
  readonly emptyMessage?: ReactNode;
246
247
  readonly className?: string;
247
248
  readonly tableClassName?: string;
@@ -249,8 +250,8 @@ export interface ContentProps<TData = unknown> {
249
250
  readonly headerRowClassName?: string;
250
251
  readonly headerCellClassName?: string;
251
252
  readonly bodyClassName?: string;
252
- readonly rowClassName?: string | ((row: Row<TData>) => string);
253
- readonly cellClassName?: string | ((cell: Cell<TData, unknown>) => string);
253
+ readonly rowClassName?: string | ((row: Row<DataTableFeatures, TData>) => string);
254
+ readonly cellClassName?: string | ((cell: Cell<DataTableFeatures, TData, unknown>) => string);
254
255
  }
255
256
  export interface PaginationProps {
256
257
  readonly pageSizes?: readonly number[];
@@ -282,7 +283,7 @@ export interface LoadingProps {
282
283
  readonly className?: string;
283
284
  }
284
285
  export type FilterStrategy = 'checkbox' | 'select' | 'date-gte' | 'date-lte' | FilterFn;
285
- export interface DataTableStoreState<TData> {
286
+ export interface DataTableStoreState<TData extends RowData> {
286
287
  readonly data: TData[];
287
288
  readonly filteredData: TData[];
288
289
  readonly sorting: SortingState;
@@ -299,7 +300,7 @@ export interface DataTableStoreState<TData> {
299
300
  /** Monotonic counter incremented on every state change. Used by table-dependent selectors to detect updates. */
300
301
  readonly _version: number;
301
302
  }
302
- export interface DataTableStore<TData> {
303
+ export interface DataTableStore<TData extends RowData> {
303
304
  readonly getSnapshot: () => DataTableStoreState<TData>;
304
305
  readonly subscribe: (listener: () => void) => () => void;
305
306
  readonly setData: (data: TData[]) => void;
@@ -321,7 +322,7 @@ export interface DataTableStore<TData> {
321
322
  readonly registerInlineContent: (entry: InlineContentEntry<TData>) => void;
322
323
  readonly unregisterInlineContent: (id: string) => void;
323
324
  }
324
- export interface CreateStoreOptions<TData> {
325
+ export interface CreateStoreOptions<TData extends RowData> {
325
326
  readonly data: TData[];
326
327
  readonly mode: 'client' | 'server';
327
328
  readonly defaultSort?: SortingState;
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { DateTimeProps } from './types';
3
+ /**
4
+ * Date display with the shared Datum hover tooltip (UTC, local zone, relative, epoch).
5
+ */
6
+ export declare function DateTime({ date, variant, format, addSuffix, tooltip, timezone, disableTimezone, className, separator, timestamp, children, }: DateTimeProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
@@ -0,0 +1,13 @@
1
+ import type { FormatterOptions } from './types';
2
+ /** e.g. "June 12th at 11:30 AM" — used for absolute / table dates. */
3
+ export declare const DEFAULT_DATE_FORMAT = "MMMM do 'at' h:mm a";
4
+ export declare function getBrowserTimezone(): string;
5
+ export declare function parseDate(date: string | Date): Date | null;
6
+ export declare function formatAbsoluteDate(date: Date, options: FormatterOptions): string;
7
+ export declare function formatRelativeDate(date: Date, options: FormatterOptions): string;
8
+ export declare function getTimezoneAbbreviation(date: Date, timezone: string): string;
9
+ export declare function formatCombinedDate(date: Date, options: FormatterOptions, separator?: string): string;
10
+ export declare function formatUTCDate(date: Date, format?: string): string;
11
+ export declare function formatTimezoneDate(date: Date, timezone: string, format?: string): string;
12
+ /** Microseconds since epoch, matching the Datum DateTime tooltip. */
13
+ export declare function getTimestamp(date: Date): string;
@@ -0,0 +1,3 @@
1
+ export { DateTime } from './date-time';
2
+ export { DEFAULT_DATE_FORMAT, formatAbsoluteDate, formatCombinedDate, formatRelativeDate, formatTimezoneDate, formatUTCDate, getTimestamp, getTimezoneAbbreviation, parseDate, } from './formatters';
3
+ export type { DateTimeProps, DateTimeVariant, FormatterOptions, TooltipMode } from './types';
@@ -0,0 +1,47 @@
1
+ import type { ReactNode } from 'react';
2
+ export type DateTimeVariant = 'absolute' | 'relative' | 'both' | 'detailed';
3
+ export type TooltipMode = boolean | 'auto' | 'timezone' | 'alternate' | 'detailed';
4
+ export interface DateTimeProps {
5
+ /** Date to format — a `Date` or parseable ISO string. */
6
+ date?: string | Date;
7
+ /**
8
+ * `absolute` — formatted date.
9
+ * `relative` — "X ago".
10
+ * `both` — absolute plus relative.
11
+ * `detailed` — absolute in the trigger; tooltip lists UTC, local, relative, and epoch.
12
+ */
13
+ variant?: DateTimeVariant;
14
+ /** date-fns format string for absolute dates. */
15
+ format?: string;
16
+ /** Append "ago" (and similar) to relative dates. Defaults to true. */
17
+ addSuffix?: boolean;
18
+ /**
19
+ * Tooltip behavior:
20
+ * - true/false: show or hide
21
+ * - `auto`: opposite format, or timezone for absolute dates
22
+ * - `timezone`: timezone name and abbreviation
23
+ * - `alternate`: opposite of the visible variant
24
+ * - `detailed`: UTC, local zone, relative, and epoch
25
+ */
26
+ tooltip?: TooltipMode;
27
+ /** IANA timezone. Defaults to the browser timezone. */
28
+ timezone?: string;
29
+ /** Skip timezone conversion and format in the runtime local zone. */
30
+ disableTimezone?: boolean;
31
+ className?: string;
32
+ /** Separator between absolute and relative when `variant="both"`. */
33
+ separator?: string;
34
+ /**
35
+ * Epoch shown on the `detailed` tooltip Timestamp row.
36
+ * Defaults to microseconds derived from the date.
37
+ */
38
+ timestamp?: string;
39
+ /** Replace the formatted trigger. Must be a single element (Tooltip `asChild`). */
40
+ children?: ReactNode;
41
+ }
42
+ export interface FormatterOptions {
43
+ timezone: string;
44
+ disableTimezone: boolean;
45
+ format?: string;
46
+ addSuffix?: boolean;
47
+ }
@@ -1,2 +1,3 @@
1
+ import type { RowData } from '@tanstack/react-table';
1
2
  import type { GroupedTableProps } from './types';
2
- export declare function GroupedTable<TData>(props: GroupedTableProps<TData>): import("react").JSX.Element;
3
+ export declare function GroupedTable<TData extends RowData>(props: GroupedTableProps<TData>): import("react").JSX.Element;
@@ -1,4 +1,5 @@
1
- import type { Row } from '@tanstack/react-table';
1
+ import type { Row, RowData } from '@tanstack/react-table';
2
+ import type { DataTableFeatures } from '../../data-table/core/features';
2
3
  interface GroupLike {
3
4
  id: string;
4
5
  rows: unknown[];
@@ -9,5 +10,5 @@ interface GroupLike {
9
10
  * positions to learn which row id belongs to which group, so bucketing is correct
10
11
  * regardless of a custom getRowId.
11
12
  */
12
- export declare function bucketRows<TData>(groups: GroupLike[], coreRows: Row<TData>[], filteredRows: Row<TData>[]): Map<string, Row<TData>[]>;
13
+ export declare function bucketRows<TData extends RowData>(groups: GroupLike[], coreRows: Row<DataTableFeatures, TData>[], filteredRows: Row<DataTableFeatures, TData>[]): Map<string, Row<DataTableFeatures, TData>[]>;
13
14
  export {};
@@ -1,10 +1,11 @@
1
- import type { ColumnDef } from '@tanstack/react-table';
1
+ import type { ColumnDef, RowData } from '@tanstack/react-table';
2
2
  import type { SelectionColumnOptions } from '../../data-table';
3
+ import type { DataTableFeatures } from '../../data-table/core/features';
3
4
  import type { ActionItem } from '../../more-actions';
4
- export interface ComposeOptions<TData> {
5
+ export interface ComposeOptions<TData extends RowData> {
5
6
  enableRowSelection?: boolean | SelectionColumnOptions<TData>;
6
7
  enableSorting?: boolean;
7
8
  rowActions?: (row: TData) => ActionItem<TData>[];
8
9
  rowActionsSheetTitle?: string;
9
10
  }
10
- export declare function composeColumns<TData>(columns: ColumnDef<TData, unknown>[], options: ComposeOptions<TData>): ColumnDef<TData, unknown>[];
11
+ export declare function composeColumns<TData extends RowData>(columns: ColumnDef<DataTableFeatures, TData, unknown>[], options: ComposeOptions<TData>): ColumnDef<DataTableFeatures, TData, unknown>[];
@@ -1,6 +1,7 @@
1
- import type { Row, SortingState } from '@tanstack/react-table';
1
+ import type { Row, RowData, SortingState } from '@tanstack/react-table';
2
+ import type { DataTableFeatures } from '../../data-table/core/features';
2
3
  /**
3
4
  * Sort a single group's rows by the active sort (first entry; v1 is single-sort).
4
5
  * Returns the same reference when there is no sort, so React can skip re-renders.
5
6
  */
6
- export declare function sortRows<TData>(rows: Row<TData>[], sorting: SortingState): Row<TData>[];
7
+ export declare function sortRows<TData extends RowData>(rows: Row<DataTableFeatures, TData>[], sorting: SortingState): Row<DataTableFeatures, TData>[];
@@ -1,9 +1,10 @@
1
- import type { Cell, ColumnDef, Row, RowSelectionState, SortingState } from '@tanstack/react-table';
1
+ import type { Cell, ColumnDef, Row, RowData, RowSelectionState, SortingState } from '@tanstack/react-table';
2
2
  import type { ReactNode } from 'react';
3
3
  import type { SelectionColumnOptions } from '../data-table';
4
+ import type { DataTableFeatures } from '../data-table/core/features';
4
5
  import type { ActionItem } from '../more-actions';
5
6
  export type DefaultExpanded = 'all' | 'none' | string[];
6
- export interface GroupedTableGroup<TData> {
7
+ export interface GroupedTableGroup<TData extends RowData> {
7
8
  /** Stable key used for expand state. */
8
9
  id: string;
9
10
  /** Group header label. */
@@ -14,9 +15,9 @@ export interface GroupedTableGroup<TData> {
14
15
  /** Per-group override of the table-level default. */
15
16
  defaultOpen?: boolean;
16
17
  }
17
- export interface GroupedTableProps<TData> {
18
+ export interface GroupedTableProps<TData extends RowData> {
18
19
  /** TanStack column defs. `size` (px) drives the shared grid template; unsized columns flex. */
19
- columns: ColumnDef<TData, unknown>[];
20
+ columns: ColumnDef<DataTableFeatures, TData, unknown>[];
20
21
  groups: GroupedTableGroup<TData>[];
21
22
  /** Uncontrolled initial state. Default `'all'`. A string[] opens exactly those ids. */
22
23
  defaultExpanded?: DefaultExpanded;
@@ -67,7 +68,7 @@ export interface GroupedTableProps<TData> {
67
68
  /** Each group's `<tbody>`. */
68
69
  bodyClassName?: string;
69
70
  /** Each data `<tr>`; receives the row for per-row styling. */
70
- rowClassName?: string | ((row: Row<TData>) => string);
71
+ rowClassName?: string | ((row: Row<DataTableFeatures, TData>) => string);
71
72
  /** Each data `<td>`; receives the cell for per-cell styling. */
72
- cellClassName?: string | ((cell: Cell<TData, unknown>) => string);
73
+ cellClassName?: string | ((cell: Cell<DataTableFeatures, TData, unknown>) => string);
73
74
  }
@@ -1,5 +1,6 @@
1
+ import type { RowData } from '@tanstack/react-table';
1
2
  import type { DefaultExpanded, GroupedTableGroup } from './types';
2
- export declare function useGroupedExpansion<TData>(groups: GroupedTableGroup<TData>[], opts: {
3
+ export declare function useGroupedExpansion<TData extends RowData>(groups: GroupedTableGroup<TData>[], opts: {
3
4
  defaultExpanded?: DefaultExpanded;
4
5
  expanded?: string[];
5
6
  onExpandedChange?: (ids: string[]) => void;
@@ -10,6 +10,7 @@ export * from './avatar-stack';
10
10
  export * from './calendar-date-picker';
11
11
  export * from './code-editor';
12
12
  export * from './data-table';
13
+ export * from './date-time';
13
14
  export * from './date-time-picker';
14
15
  export * from './dropdown';
15
16
  export * from './dropzone';
@@ -0,0 +1,3 @@
1
+ export declare function LogsDetail({ className }: {
2
+ className?: string;
3
+ }): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare function LogsExplorer({ className }: {
2
+ className?: string;
3
+ }): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { LogFacet } from '../types';
2
+ export declare function LogsFilterGroup({ facet, defaultOpen, }: {
3
+ facet: LogFacet;
4
+ defaultOpen?: boolean;
5
+ }): import("react").JSX.Element;
6
+ export declare function LogsTimeRangeFilter({ className }: {
7
+ className?: string;
8
+ }): import("react").JSX.Element;
9
+ export declare function LogsFilters({ className }: {
10
+ className?: string;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { LogsRootProps } from '../types';
2
+ export declare function LogsRoot({ entries, facets, timeRange, defaultTimeRange, filters, defaultFilters, search, defaultSearch, live, defaultLive, selectedId, defaultSelectedId, isLoading, error, columns, onTimeRangeChange, onFiltersChange, onSearchChange, onLiveChange, onSelectedIdChange, onRefresh, onExport, className, children, }: LogsRootProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { ParsedLogLine } from '../types';
2
+ export declare function LogsSeverityBadge({ severity }: {
3
+ severity?: string;
4
+ }): import("react").JSX.Element;
5
+ export declare function LogsStatusBadge({ parsed }: {
6
+ parsed: ParsedLogLine;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare function LogsTable({ className }: {
2
+ className?: string;
3
+ }): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function LogsSearch({ placeholder, className, }: {
3
+ placeholder?: string;
4
+ className?: string;
5
+ }): import("react").JSX.Element;
6
+ export declare function LogsLiveToggle({ className }: {
7
+ className?: string;
8
+ }): import("react").JSX.Element;
9
+ export declare function LogsToolbar({ children, className, }: {
10
+ children?: ReactNode;
11
+ className?: string;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { LokiQueryRangeResponse } from '../types';
2
+ export declare const queryRangeFixture: LokiQueryRangeResponse;
@@ -0,0 +1,5 @@
1
+ export declare function useControllableState<T>({ value, defaultValue, onChange, }: {
2
+ value?: T;
3
+ defaultValue: T;
4
+ onChange?: (value: T) => void;
5
+ }): [T, (value: T) => void];
@@ -0,0 +1,3 @@
1
+ import type { LogsContextValue } from '../types';
2
+ export declare const LogsContext: import("react").Context<LogsContextValue | null>;
3
+ export declare function useLogs(): LogsContextValue;
@@ -0,0 +1,4 @@
1
+ export { useLogs } from './hooks/use-logs';
2
+ export { Logs } from './logs';
3
+ export type { BuildLogQLOptions, LogColumnId, LogEntry, LogFacet, LogFacetOption, LogFilters, LogsContextValue, LogsRootProps, LogTimeRange, LokiQueryRangeResponse, LokiStream, ParsedHttpLogLine, ParsedLogLine, ParsedTextLogLine, } from './types';
4
+ export { buildLogQL, facetsFromEntries, filterEntries, flattenLokiStreams, httpStatusBadgeType, httpStatusTextClass, lastThirtyMinutes, logLineDisplay, nsToDate, parseLogLine, severityBadgeType, } from './utils';
@@ -0,0 +1,18 @@
1
+ import { LogsDetail } from './components/detail';
2
+ import { LogsExplorer } from './components/explorer';
3
+ import { LogsFilterGroup, LogsFilters, LogsTimeRangeFilter } from './components/filters';
4
+ import { LogsRoot } from './components/root';
5
+ import { LogsTable } from './components/table';
6
+ import { LogsLiveToggle, LogsSearch, LogsToolbar } from './components/toolbar';
7
+ export declare const Logs: {
8
+ readonly Root: typeof LogsRoot;
9
+ readonly Explorer: typeof LogsExplorer;
10
+ readonly Filters: typeof LogsFilters;
11
+ readonly FilterGroup: typeof LogsFilterGroup;
12
+ readonly TimeRangeFilter: typeof LogsTimeRangeFilter;
13
+ readonly Toolbar: typeof LogsToolbar;
14
+ readonly Search: typeof LogsSearch;
15
+ readonly LiveToggle: typeof LogsLiveToggle;
16
+ readonly Table: typeof LogsTable;
17
+ readonly Detail: typeof LogsDetail;
18
+ };
@@ -0,0 +1,105 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface LokiStream {
3
+ stream: Record<string, string>;
4
+ values: Array<[timestampNs: string, line: string]>;
5
+ }
6
+ export interface LokiQueryRangeResponse {
7
+ status: 'success' | 'error';
8
+ data?: {
9
+ resultType: 'streams' | 'vector';
10
+ result: LokiStream[];
11
+ };
12
+ errorType?: string;
13
+ error?: string;
14
+ }
15
+ export interface LogEntry {
16
+ id: string;
17
+ timestamp: Date;
18
+ timestampNs: string;
19
+ line: string;
20
+ labels: Record<string, string>;
21
+ }
22
+ export interface LogFacetOption {
23
+ value: string;
24
+ count?: number;
25
+ }
26
+ export interface LogFacet {
27
+ name: string;
28
+ label: string;
29
+ options: LogFacetOption[];
30
+ }
31
+ export interface LogTimeRange {
32
+ from: string;
33
+ to: string;
34
+ }
35
+ export type LogFilters = Record<string, string[]>;
36
+ export type LogColumnId = 'time' | 'severity' | 'status' | 'service' | 'resource' | 'path' | 'message';
37
+ export interface ParsedHttpLogLine {
38
+ kind: 'http';
39
+ method: string;
40
+ path: string;
41
+ status: number;
42
+ durationMs: number;
43
+ }
44
+ export interface ParsedTextLogLine {
45
+ kind: 'text';
46
+ line: string;
47
+ }
48
+ export type ParsedLogLine = ParsedHttpLogLine | ParsedTextLogLine;
49
+ export interface BuildLogQLOptions {
50
+ matchers?: LogFilters;
51
+ lineContains?: string;
52
+ }
53
+ export type LogSeverity = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'FATAL' | (string & {});
54
+ export interface LogsRootProps {
55
+ entries: readonly LogEntry[];
56
+ facets?: readonly LogFacet[];
57
+ timeRange?: LogTimeRange;
58
+ defaultTimeRange?: LogTimeRange;
59
+ filters?: LogFilters;
60
+ defaultFilters?: LogFilters;
61
+ search?: string;
62
+ defaultSearch?: string;
63
+ live?: boolean;
64
+ defaultLive?: boolean;
65
+ selectedId?: string | null;
66
+ defaultSelectedId?: string | null;
67
+ isLoading?: boolean;
68
+ error?: ReactNode;
69
+ columns?: readonly LogColumnId[];
70
+ onTimeRangeChange?: (range: LogTimeRange) => void;
71
+ onFiltersChange?: (filters: LogFilters) => void;
72
+ onSearchChange?: (search: string) => void;
73
+ onLiveChange?: (live: boolean) => void;
74
+ onSelectedIdChange?: (id: string | null) => void;
75
+ onRefresh?: () => void;
76
+ onExport?: (entries: readonly LogEntry[]) => void;
77
+ className?: string;
78
+ children: ReactNode;
79
+ }
80
+ export interface LogsContextValue {
81
+ entries: readonly LogEntry[];
82
+ facets: readonly LogFacet[];
83
+ timeRange: LogTimeRange;
84
+ setTimeRange: (range: LogTimeRange) => void;
85
+ filters: LogFilters;
86
+ setFilters: (filters: LogFilters) => void;
87
+ toggleFilterValue: (name: string, value: string) => void;
88
+ resetFilters: () => void;
89
+ search: string;
90
+ setSearch: (search: string) => void;
91
+ live: boolean;
92
+ setLive: (live: boolean) => void;
93
+ selectedId: string | null;
94
+ setSelectedId: (id: string | null) => void;
95
+ selectedEntry: LogEntry | null;
96
+ selectedIndex: number;
97
+ selectPrevious: () => void;
98
+ selectNext: () => void;
99
+ isLoading: boolean;
100
+ error: ReactNode;
101
+ columns: readonly LogColumnId[];
102
+ hasActiveFilters: boolean;
103
+ onRefresh?: () => void;
104
+ onExport?: (entries: readonly LogEntry[]) => void;
105
+ }
@@ -0,0 +1,2 @@
1
+ import type { BuildLogQLOptions } from '../types';
2
+ export declare function buildLogQL({ matchers, lineContains }?: BuildLogQLOptions): string;
@@ -0,0 +1,6 @@
1
+ import type { LogColumnId } from '../types';
2
+ export declare const DEFAULT_LOG_COLUMNS: readonly LogColumnId[];
3
+ export declare const CANONICAL_FACET_NAMES: readonly ["severity", "service_name", "resource_name"];
4
+ export declare const FACET_LABELS: Record<string, string>;
5
+ export declare const SEVERITY_ORDER: readonly ["ERROR", "FATAL", "WARN", "WARNING", "INFO", "DEBUG", "TRACE"];
6
+ export declare const DEFAULT_LOGQL_MATCHER = "{service_name=~\".+\"}";
@@ -0,0 +1,3 @@
1
+ import type { LogEntry, LogFacet, LogFilters } from '../types';
2
+ export declare function facetsFromEntries(entries: readonly LogEntry[], names?: readonly string[]): LogFacet[];
3
+ export declare function filterEntries(entries: readonly LogEntry[], filters: LogFilters, search?: string): LogEntry[];
@@ -0,0 +1,3 @@
1
+ import type { LogEntry, LokiQueryRangeResponse } from '../types';
2
+ export declare function nsToDate(timestampNs: string): Date;
3
+ export declare function flattenLokiStreams(response: LokiQueryRangeResponse): LogEntry[];
@@ -0,0 +1,4 @@
1
+ export declare function formatLogTimestamp(date: Date): string;
2
+ export declare function formatRelativeTimestamp(date: Date, now?: Date): string;
3
+ export declare function formatUtcTimestamp(date: Date): string;
4
+ export declare function formatLocalTimestamp(date: Date): string;
@@ -0,0 +1,8 @@
1
+ export { buildLogQL } from './build-logql';
2
+ export { CANONICAL_FACET_NAMES, DEFAULT_LOG_COLUMNS, DEFAULT_LOGQL_MATCHER, FACET_LABELS, SEVERITY_ORDER, } from './constants';
3
+ export { facetsFromEntries, filterEntries } from './facets';
4
+ export { flattenLokiStreams, nsToDate } from './flatten-loki';
5
+ export { formatLocalTimestamp, formatLogTimestamp, formatRelativeTimestamp, formatUtcTimestamp, } from './format-timestamp';
6
+ export { logLineDisplay, parseLogLine } from './parse-log-line';
7
+ export { httpStatusBadgeType, httpStatusTextClass, severityBadgeType } from './severity';
8
+ export { filtersAreActive, lastThirtyMinutes } from './time-range';
@@ -0,0 +1,7 @@
1
+ import type { ParsedLogLine } from '../types';
2
+ export declare function parseLogLine(line: string): ParsedLogLine;
3
+ export declare function logLineDisplay(line: string): {
4
+ parsed: ParsedLogLine;
5
+ path: string | null;
6
+ message: string;
7
+ };
@@ -0,0 +1,5 @@
1
+ import type { BadgeProps } from '../../../base/badge';
2
+ export type SeverityBadgeType = NonNullable<BadgeProps['type']>;
3
+ export declare function severityBadgeType(severity: string | undefined): SeverityBadgeType;
4
+ export declare function httpStatusBadgeType(status: number): SeverityBadgeType;
5
+ export declare function httpStatusTextClass(status: number): string;
@@ -0,0 +1,3 @@
1
+ import type { LogTimeRange } from '../types';
2
+ export declare function lastThirtyMinutes(now?: Date): LogTimeRange;
3
+ export declare function filtersAreActive(filters: Record<string, string[]>): boolean;
@@ -1,2 +1,2 @@
1
- import { _ as DEFAULT_DEBOUNCE_MS, a as useDataTablePagination, b as DEFAULT_PAGE_SIZES, c as useDataTableSelection, d as resolvePath, f as rowMatchesSearch, g as useNuqsAdapter, h as createSelectionColumn, i as useDataTableLoading, l as useDataTableSorting, m as DataTableColumnHeader, n as useDataTableFilters, o as useDataTableRows, p as DataTableRowActions, r as useDataTableInlineContents, s as useDataTableSearch, t as DataTable, u as createDataTableStore, v as DEFAULT_LOADING_ROWS, y as DEFAULT_PAGE_SIZE } from "../data-table-mByk373T.mjs";
2
- export { DEFAULT_DEBOUNCE_MS, DEFAULT_LOADING_ROWS, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZES, DataTable, DataTableColumnHeader, DataTableRowActions, createDataTableStore, createSelectionColumn, resolvePath, rowMatchesSearch, useDataTableFilters, useDataTableInlineContents, useDataTableLoading, useDataTablePagination, useDataTableRows, useDataTableSearch, useDataTableSelection, useDataTableSorting, useNuqsAdapter };
1
+ import { _ as useNuqsAdapter, a as useDataTablePagination, b as DEFAULT_PAGE_SIZE, c as useDataTableSelection, d as resolvePath, f as rowMatchesSearch, g as createSelectionColumn, h as DataTableColumnHeader, i as useDataTableLoading, l as useDataTableSorting, m as DataTableRowActions, n as useDataTableFilters, o as useDataTableRows, p as dataTableFeatures, r as useDataTableInlineContents, s as useDataTableSearch, t as DataTable, u as createDataTableStore, v as DEFAULT_DEBOUNCE_MS, x as DEFAULT_PAGE_SIZES, y as DEFAULT_LOADING_ROWS } from "../data-table-Du7_FLBi.mjs";
2
+ export { DEFAULT_DEBOUNCE_MS, DEFAULT_LOADING_ROWS, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZES, DataTable, DataTableColumnHeader, DataTableRowActions, createDataTableStore, createSelectionColumn, dataTableFeatures, resolvePath, rowMatchesSearch, useDataTableFilters, useDataTableInlineContents, useDataTableLoading, useDataTablePagination, useDataTableRows, useDataTableSearch, useDataTableSelection, useDataTableSorting, useNuqsAdapter };