@gravitee/graphene-core 2.43.0 → 2.44.0-renovate-dompurify-3-x.a3dfda5
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/USAGE_GUIDE.md +166 -0
- package/dist/composed/DataTable/DataTable.d.ts +33 -4
- package/dist/composed/DataTable/DataTable.d.ts.map +1 -1
- package/dist/composed/DataTable/cells.d.ts +38 -0
- package/dist/composed/DataTable/cells.d.ts.map +1 -0
- package/dist/composed/DataTable/index.d.ts +3 -1
- package/dist/composed/DataTable/index.d.ts.map +1 -1
- package/dist/composed/DataTableEmptyState/DataTableEmptyState.d.ts +33 -0
- package/dist/composed/DataTableEmptyState/DataTableEmptyState.d.ts.map +1 -0
- package/dist/composed/DataTableEmptyState/index.d.ts +3 -0
- package/dist/composed/DataTableEmptyState/index.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1176 -938
- package/dist/styles/globals.css +1 -1
- package/package.json +2 -1
- package/snippets/data-table-list-page.tsx +321 -0
package/USAGE_GUIDE.md
CHANGED
|
@@ -314,6 +314,172 @@ With `useLayoutConfig` (module federation), a nested page can set `contentVarian
|
|
|
314
314
|
useLayoutConfig({ contentVariant: 'full-bleed' }, []);
|
|
315
315
|
```
|
|
316
316
|
|
|
317
|
+
### Data table (entity list pages)
|
|
318
|
+
|
|
319
|
+
Use `DataTable` for any entity list — whether the data is fetched page-by-page from an API or loaded in full on the client. The component provides sorting, filtering, pagination, column visibility, row selection, and bulk actions through a composable slot API.
|
|
320
|
+
|
|
321
|
+
**To implement:** copy the snippet from `snippets/data-table-list-page.tsx` and replace the entity type, column definitions, and fetch function with your data. See Storybook **Patterns/Data Table → ApiList** for the full interactive example.
|
|
322
|
+
|
|
323
|
+
#### When to use DataTable vs raw Table
|
|
324
|
+
|
|
325
|
+
| Use `DataTable` | Use raw `Table` |
|
|
326
|
+
|---|---|
|
|
327
|
+
| Any list that could exceed 5 rows | Key-value detail panels |
|
|
328
|
+
| Needs sorting, filtering, or actions | Static configuration displays |
|
|
329
|
+
| Data from an API (server-side) | Inline form grids with <5 fixed rows |
|
|
330
|
+
| Static arrays with >10 items (client-side) | |
|
|
331
|
+
|
|
332
|
+
#### Server-side vs client-side
|
|
333
|
+
|
|
334
|
+
`DataTable` works in two modes:
|
|
335
|
+
|
|
336
|
+
| | Server-side (`serverSide` prop) | Client-side (default) |
|
|
337
|
+
|---|---|---|
|
|
338
|
+
| **When** | Data fetched page-by-page from an API | All data loaded at once |
|
|
339
|
+
| **Sorting** | Pass `sorting` + `onSortingChange`, refetch on change | Automatic (TanStack `getSortedRowModel`) |
|
|
340
|
+
| **Filtering** | Refetch with filter params | Automatic (TanStack `getFilteredRowModel`) |
|
|
341
|
+
| **Pagination** | Pass current page slice to `data` | Pass full array; TanStack paginates |
|
|
342
|
+
| **`data` prop** | Current page only (e.g. 10 rows) | Entire dataset |
|
|
343
|
+
|
|
344
|
+
**Never** mix modes: client-side sort on server-paginated data only sorts the visible page.
|
|
345
|
+
|
|
346
|
+
#### Pagination
|
|
347
|
+
|
|
348
|
+
- Default page size: **10** (standard lists), **25** (high-density: catalog).
|
|
349
|
+
- Page size options: `[10, 25, 50, 100]`.
|
|
350
|
+
- **Recommended:** Use the `pagination` prop for standard pagination (both server-side and client-side):
|
|
351
|
+
|
|
352
|
+
```tsx
|
|
353
|
+
<DataTable
|
|
354
|
+
pagination={{
|
|
355
|
+
page,
|
|
356
|
+
pageSize,
|
|
357
|
+
totalCount,
|
|
358
|
+
onPageChange: setPage,
|
|
359
|
+
onPageSizeChange: (size) => { setPageSize(size); setPage(1); },
|
|
360
|
+
pageSizeOptions: [10, 25, 50, 100],
|
|
361
|
+
}}
|
|
362
|
+
/>
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
- The `footer` slot is still available for custom content (rendered above pagination when both are set).
|
|
366
|
+
- Reset to page 1 when search/filter/sort criteria change.
|
|
367
|
+
- Works for both **server-side** (pass current page of data) and **client-side** (slice data yourself) pagination.
|
|
368
|
+
|
|
369
|
+
#### Search and filters
|
|
370
|
+
|
|
371
|
+
- Search and filters live in the DataTable `toolbar` slot.
|
|
372
|
+
- Search field: `h-8 w-64` consistent sizing. Debounce: **300ms** for server-side search.
|
|
373
|
+
- **Do NOT add a search field to a server-paginated table unless the backend endpoint supports a text search parameter** (`query`, `q`, or equivalent). Client-side search on a single page of server-paginated data is misleading — users will miss matches on other pages. If the backend does not support search, either request the backend change or omit the search field entirely.
|
|
374
|
+
- Use `FacetedFilter` for multi-select categorical filters.
|
|
375
|
+
- Show a "Reset" button when any filter is active.
|
|
376
|
+
|
|
377
|
+
#### Row navigation
|
|
378
|
+
|
|
379
|
+
Use **name-column-as-link**: the primary identifier column (always leftmost) is a clickable link with `font-medium hover:underline`. No full-row-click.
|
|
380
|
+
|
|
381
|
+
#### Actions column
|
|
382
|
+
|
|
383
|
+
- Always the rightmost column. `enableSorting: false`, `enableHiding: false`.
|
|
384
|
+
- Header: `<span className="sr-only">Actions</span>`.
|
|
385
|
+
- **Always use the three-dot menu** (`MoreVerticalIcon` + `DropdownMenu`) — never a horizontal row of inline icon buttons. This applies even for 2 actions.
|
|
386
|
+
- **Single-action exception:** exactly 1 action may render as a lone icon button without a dropdown.
|
|
387
|
+
- **Quick-action escape hatch:** one high-discoverability action (e.g. "Deploy") may appear as an inline icon *alongside* the dropdown, but the dropdown must still exist.
|
|
388
|
+
- Use `MoreVerticalIcon` (⋮) for table rows. Do not use `MoreHorizontalIcon` — the horizontal variant is for toolbars and card headers.
|
|
389
|
+
- Destructive actions go last in the menu, after a `DropdownMenuSeparator`.
|
|
390
|
+
|
|
391
|
+
#### Column ordering
|
|
392
|
+
|
|
393
|
+
1. Checkbox (if `selectionMode="multi"`) — auto-prepended
|
|
394
|
+
2. Name/primary identifier (link)
|
|
395
|
+
3. Status badge
|
|
396
|
+
4. Category/type badges
|
|
397
|
+
5. Dates (relative format)
|
|
398
|
+
6. Owner/actor
|
|
399
|
+
7. Actions (rightmost)
|
|
400
|
+
|
|
401
|
+
**Minimum 3 data columns** (excluding actions). If an entity has fewer than 3 meaningful attributes, use a simpler component (Item list, card grid) instead of DataTable.
|
|
402
|
+
|
|
403
|
+
Target **4-7 visible columns**. More than 7 → enable column visibility and hide low-priority columns by default. Do NOT show raw entity IDs as visible columns.
|
|
404
|
+
|
|
405
|
+
#### Cell renderers
|
|
406
|
+
|
|
407
|
+
Import from `@gravitee/graphene-core/composed/DataTable` (or the main package):
|
|
408
|
+
|
|
409
|
+
| Renderer | Use for | Behavior |
|
|
410
|
+
|---|---|---|
|
|
411
|
+
| `DateCell` | Timestamps | Relative format ("2h ago") + full date tooltip |
|
|
412
|
+
| `BadgeCell` | Status/category | Truncation-safe badge with variant support |
|
|
413
|
+
| `MonoCell` | IDs, paths, tokens | Monospace, character-limit truncation + tooltip |
|
|
414
|
+
| `CopyableCell` | API keys, IDs | Mono text + copy button on hover |
|
|
415
|
+
| `TruncatedCell` | Long text | Max-width constraint + tooltip on overflow |
|
|
416
|
+
|
|
417
|
+
#### Empty states
|
|
418
|
+
|
|
419
|
+
Use `DataTableEmptyState` — it enforces the correct structure for both scenarios:
|
|
420
|
+
|
|
421
|
+
**`variant="first-use"`** — collection is genuinely empty (user has never created entities)
|
|
422
|
+
- Render **instead of** `DataTable` (no table chrome needed)
|
|
423
|
+
- Wrap in `<div className="rounded-lg border">` for containment
|
|
424
|
+
- Props: `icon`, `title`, `description`, `primaryAction`, optional `secondaryAction`, optional `children` for educational content (flow diagrams, feature pillars)
|
|
425
|
+
- Decision: `totalCount === 0 && !hasActiveFilters`
|
|
426
|
+
|
|
427
|
+
**`variant="no-results"`** — active filters/search returned zero matches
|
|
428
|
+
- Render **inside** `DataTable` as the `emptyMessage` prop (keep toolbar visible)
|
|
429
|
+
- Props: `icon` (use `SearchIcon`), `title`, `description`, `action` (e.g. "Clear filters")
|
|
430
|
+
- Decision: `filteredCount === 0 && hasActiveFilters`
|
|
431
|
+
|
|
432
|
+
```tsx
|
|
433
|
+
// Page-level decision pattern
|
|
434
|
+
{isFirstUse ? (
|
|
435
|
+
<div className="rounded-lg border">
|
|
436
|
+
<DataTableEmptyState variant="first-use" icon={<GlobeIcon />} title="No APIs yet" ... />
|
|
437
|
+
</div>
|
|
438
|
+
) : (
|
|
439
|
+
<DataTable
|
|
440
|
+
emptyMessage={<DataTableEmptyState variant="no-results" icon={<SearchIcon />} ... />}
|
|
441
|
+
...
|
|
442
|
+
/>
|
|
443
|
+
)}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
See Storybook **Composed/DataTableEmptyState → Integration** for the full interactive example.
|
|
447
|
+
|
|
448
|
+
#### Header button coordination
|
|
449
|
+
|
|
450
|
+
Pages with a primary "Add Entity" button in the header follow one rule: **the header button only appears when data exists**. During first-use, the empty state owns the primary CTA.
|
|
451
|
+
|
|
452
|
+
| State | Header button | Content area |
|
|
453
|
+
|---|---|---|
|
|
454
|
+
| **First-use** (`totalCount === 0 && !hasFilters`) | Hidden | `DataTableEmptyState variant="first-use"` with primary CTA |
|
|
455
|
+
| **Has data** (`totalCount > 0`) | Primary `+ Add Entity` | DataTable |
|
|
456
|
+
| **No results** (filters active, zero matches) | Primary `+ Add Entity` | `DataTableEmptyState variant="no-results"` with "Clear filters" |
|
|
457
|
+
|
|
458
|
+
Both the header button and the empty state CTA trigger the same creation flow. No visual downgrade (both are primary variant buttons). No transition animation between states.
|
|
459
|
+
|
|
460
|
+
```tsx
|
|
461
|
+
<div className="flex items-center justify-between">
|
|
462
|
+
<div>
|
|
463
|
+
<h2 className="text-lg font-semibold">Entities</h2>
|
|
464
|
+
<p className="text-sm text-muted-foreground">Manage your entity catalog.</p>
|
|
465
|
+
</div>
|
|
466
|
+
{!isFirstUse && (
|
|
467
|
+
<Button size="sm"><PlusIcon /> Add entity</Button>
|
|
468
|
+
)}
|
|
469
|
+
</div>
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
#### Loading state
|
|
473
|
+
|
|
474
|
+
- Pass `skeletonCount={pageSize}` to prevent layout shift.
|
|
475
|
+
- `loadingDelay={200}` (default) prevents flash on fast responses.
|
|
476
|
+
|
|
477
|
+
#### `serverSide` prop
|
|
478
|
+
|
|
479
|
+
Set `serverSide` when data is fetched page-by-page from an API. It disables TanStack's built-in sort/filter/pagination models so you control everything via your fetch logic.
|
|
480
|
+
|
|
481
|
+
When `serverSide` is **not set** (default), pass the entire dataset to `data` and TanStack handles sorting and filtering automatically. For pagination, slice the array yourself and pass the current page via `data`, using the `pagination` prop to render controls.
|
|
482
|
+
|
|
317
483
|
### Context sidebar (resource detail pages)
|
|
318
484
|
|
|
319
485
|
Use `ContextSidebar` when a user **drills down from a list into a single resource** (API, Agent, Application…) that has multiple sub-sections. It provides secondary navigation scoped to that entity — set `viewMode: 'context'` on `AppLayout` and wire `ContextToggleButton` in the `leading` slot of `ContentHeader`.
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { ColumnDef, OnChangeFn, SortingState, TableOptions } from '@tanstack/react-table';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
interface DataTablePaginationConfig {
|
|
4
|
+
readonly page: number;
|
|
5
|
+
readonly pageSize: number;
|
|
6
|
+
readonly totalCount: number;
|
|
7
|
+
readonly onPageChange: (page: number) => void;
|
|
8
|
+
readonly onPageSizeChange?: (pageSize: number) => void;
|
|
9
|
+
/** @default [10, 25, 50, 100] */
|
|
10
|
+
readonly pageSizeOptions?: number[];
|
|
11
|
+
}
|
|
3
12
|
interface DataTableProps<TData> {
|
|
4
13
|
readonly columns: ColumnDef<TData, unknown>[];
|
|
5
14
|
readonly data: TData[];
|
|
@@ -7,8 +16,9 @@ interface DataTableProps<TData> {
|
|
|
7
16
|
readonly onSelectionChange?: (rows: TData[]) => void;
|
|
8
17
|
/** Slot rendered next to column visibility toggle. Automatically disabled when no rows are selected. */
|
|
9
18
|
readonly bulkActions?: ReactNode;
|
|
10
|
-
/** Controlled sorting state. When set without `onSortingChange`, sorting
|
|
19
|
+
/** Controlled sorting state. Required for `serverSide` mode. When set without `onSortingChange`, sorting is read-only. */
|
|
11
20
|
readonly sorting?: SortingState;
|
|
21
|
+
/** Called when the user clicks a sortable column header. Use to trigger a server re-fetch with the new sort params. */
|
|
12
22
|
readonly onSortingChange?: OnChangeFn<SortingState>;
|
|
13
23
|
readonly emptyMessage?: ReactNode;
|
|
14
24
|
readonly enableColumnVisibility?: boolean;
|
|
@@ -22,15 +32,34 @@ interface DataTableProps<TData> {
|
|
|
22
32
|
/** Number of skeleton rows shown during initial load. @default 5 */
|
|
23
33
|
readonly skeletonCount?: number;
|
|
24
34
|
readonly className?: string;
|
|
35
|
+
/** Accessible label for the table region. Falls back to a generic default for screen readers. */
|
|
36
|
+
readonly 'aria-label'?: string;
|
|
25
37
|
/** Toolbar area above the table (search, filters, etc.). */
|
|
26
38
|
readonly toolbar?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Pagination config. When set, DataTable renders `DataTablePagination` in the footer.
|
|
41
|
+
* In `serverSide` mode, `totalCount` drives page count; in client-side mode it reflects `data.length`.
|
|
42
|
+
*/
|
|
43
|
+
readonly pagination?: DataTablePaginationConfig;
|
|
44
|
+
/** Custom footer content. Renders above pagination when both are set. Use `pagination` prop for standard pagination. */
|
|
27
45
|
readonly footer?: ReactNode;
|
|
28
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Disables client-side sorting, filtering, and pagination. Use when `data` is fetched from a server.
|
|
48
|
+
*
|
|
49
|
+
* **Consumer responsibilities when `serverSide` is true:**
|
|
50
|
+
* - Pass `sorting` + `onSortingChange` to control sort state and re-fetch on change.
|
|
51
|
+
* - Pass `pagination` with server-provided `totalCount` and handle `onPageChange`/`onPageSizeChange` to re-fetch the correct page.
|
|
52
|
+
* - Pass pre-sorted, pre-filtered `data` for the current page only (not the full dataset).
|
|
53
|
+
* - Set `loading` to `true` while fetching so skeletons/overlay display correctly.
|
|
54
|
+
*
|
|
55
|
+
* DataTable still renders headers, selection, column visibility, and the pagination UI;
|
|
56
|
+
* it simply delegates the data-processing logic to the consumer's fetch layer.
|
|
57
|
+
*/
|
|
29
58
|
readonly serverSide?: boolean;
|
|
30
59
|
/** Escape hatch for advanced `@tanstack/react-table` options (e.g. `meta`, `initialState`). */
|
|
31
60
|
readonly tableOptions?: Partial<TableOptions<TData>>;
|
|
32
61
|
}
|
|
33
|
-
declare function DataTable<TData>({ columns: userColumns, data, selectionMode, onSelectionChange, bulkActions, sorting: sortingProp, onSortingChange: onSortingChangeProp, emptyMessage, enableColumnVisibility, enableColumnResizing, stickyHeader, loading: loadingProp, loadingDelay, skeletonCount, className, toolbar, footer, serverSide, tableOptions, }: DataTableProps<TData>): import("react").JSX.Element;
|
|
62
|
+
declare function DataTable<TData>({ columns: userColumns, data, selectionMode, onSelectionChange, bulkActions, sorting: sortingProp, onSortingChange: onSortingChangeProp, emptyMessage, enableColumnVisibility, enableColumnResizing, stickyHeader, loading: loadingProp, loadingDelay, skeletonCount, className, 'aria-label': ariaLabel, toolbar, pagination, footer, serverSide, tableOptions, }: DataTableProps<TData>): import("react").JSX.Element;
|
|
34
63
|
export { DataTable };
|
|
35
|
-
export type { DataTableProps };
|
|
64
|
+
export type { DataTablePaginationConfig, DataTableProps };
|
|
36
65
|
//# sourceMappingURL=DataTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/composed/DataTable/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAMd,KAAK,UAAU,EAGf,KAAK,YAAY,EACjB,KAAK,YAAY,EAGlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/composed/DataTable/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAMd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
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Shared cell renderers for DataTable columns.
|
|
4
|
+
* Use these in `ColumnDef.cell` to maintain consistent column styling across all tables.
|
|
5
|
+
*/
|
|
6
|
+
interface DateCellProps {
|
|
7
|
+
/** ISO date string or Date object */
|
|
8
|
+
readonly value: string | Date | null | undefined;
|
|
9
|
+
/** Display format: 'relative' shows "2h ago", 'absolute' shows full date. @default 'relative' */
|
|
10
|
+
readonly format?: 'relative' | 'absolute';
|
|
11
|
+
}
|
|
12
|
+
declare function DateCell({ value, format }: DateCellProps): import("react").JSX.Element;
|
|
13
|
+
interface BadgeCellProps {
|
|
14
|
+
readonly value: string | null | undefined;
|
|
15
|
+
readonly variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'highlight';
|
|
16
|
+
readonly icon?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
declare function BadgeCell({ value, variant, icon }: BadgeCellProps): import("react").JSX.Element;
|
|
19
|
+
interface MonoCellProps {
|
|
20
|
+
readonly value: string | null | undefined;
|
|
21
|
+
/** Maximum visible characters before truncation. @default 32 */
|
|
22
|
+
readonly maxLength?: number;
|
|
23
|
+
}
|
|
24
|
+
declare function MonoCell({ value, maxLength }: MonoCellProps): import("react").JSX.Element;
|
|
25
|
+
interface CopyableCellProps {
|
|
26
|
+
readonly value: string | null | undefined;
|
|
27
|
+
/** Maximum visible characters before truncation. @default 24 */
|
|
28
|
+
readonly maxLength?: number;
|
|
29
|
+
}
|
|
30
|
+
declare function CopyableCell({ value, maxLength }: CopyableCellProps): import("react").JSX.Element;
|
|
31
|
+
interface TruncatedCellProps {
|
|
32
|
+
readonly value: string | null | undefined;
|
|
33
|
+
readonly className?: string;
|
|
34
|
+
}
|
|
35
|
+
declare function TruncatedCell({ value, className }: TruncatedCellProps): import("react").JSX.Element;
|
|
36
|
+
export { BadgeCell, CopyableCell, DateCell, MonoCell, TruncatedCell };
|
|
37
|
+
export type { BadgeCellProps, CopyableCellProps, DateCellProps, MonoCellProps, TruncatedCellProps };
|
|
38
|
+
//# sourceMappingURL=cells.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cells.d.ts","sourceRoot":"","sources":["../../../src/composed/DataTable/cells.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC;;;GAGG;AAIH,UAAU,aAAa;IACrB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,iGAAiG;IACjG,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAC3C;AA2BD,iBAAS,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAmB,EAAE,EAAE,aAAa,+BAqB9D;AAID,UAAU,cAAc;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAC7G,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,iBAAS,SAAS,CAAC,EAAE,KAAK,EAAE,OAAmB,EAAE,IAAI,EAAE,EAAE,cAAc,+BAwBtE;AAID,UAAU,aAAa;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,gEAAgE;IAChE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,iBAAS,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAc,EAAE,EAAE,aAAa,+BAsBzD;AAID,UAAU,iBAAiB;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,gEAAgE;IAChE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,iBAAS,YAAY,CAAC,EAAE,KAAK,EAAE,SAAc,EAAE,EAAE,iBAAiB,+BA0CjE;AAID,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,iBAAS,aAAa,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,kBAAkB,+BAiB9D;AAED,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { DataTable } from './DataTable';
|
|
2
|
-
export type { DataTableProps } from './DataTable';
|
|
2
|
+
export type { DataTablePaginationConfig, DataTableProps } from './DataTable';
|
|
3
3
|
export { DataTableColumnHeader } from './DataTableColumnHeader';
|
|
4
4
|
export type { DataTableColumnHeaderProps } from './DataTableColumnHeader';
|
|
5
5
|
export { DataTableViewOptions } from './DataTableViewOptions';
|
|
6
|
+
export { BadgeCell, CopyableCell, DateCell, MonoCell, TruncatedCell } from './cells';
|
|
7
|
+
export type { BadgeCellProps, CopyableCellProps, DateCellProps, MonoCellProps, TruncatedCellProps } from './cells';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composed/DataTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composed/DataTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface DataTableEmptyStateBaseProps {
|
|
3
|
+
/** Contextual icon (from Lucide or similar). Rendered inside EmptyMedia. */
|
|
4
|
+
readonly icon?: ReactNode;
|
|
5
|
+
readonly title: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly className?: string;
|
|
8
|
+
}
|
|
9
|
+
interface DataTableEmptyStateFirstUseProps extends DataTableEmptyStateBaseProps {
|
|
10
|
+
readonly variant: 'first-use';
|
|
11
|
+
/** Primary CTA (e.g. "Create API" button). */
|
|
12
|
+
readonly primaryAction?: ReactNode;
|
|
13
|
+
/** Secondary action (e.g. link to docs or import flow). */
|
|
14
|
+
readonly secondaryAction?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Rich educational content rendered between the description and actions.
|
|
17
|
+
* Use for feature pillars, flow diagrams, before/after comparisons, etc.
|
|
18
|
+
*/
|
|
19
|
+
readonly children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
interface DataTableEmptyStateNoResultsProps extends DataTableEmptyStateBaseProps {
|
|
22
|
+
readonly variant: 'no-results';
|
|
23
|
+
/** Recovery action (e.g. "Clear filters" button). */
|
|
24
|
+
readonly action?: ReactNode;
|
|
25
|
+
readonly children?: never;
|
|
26
|
+
readonly primaryAction?: never;
|
|
27
|
+
readonly secondaryAction?: never;
|
|
28
|
+
}
|
|
29
|
+
type DataTableEmptyStateProps = DataTableEmptyStateFirstUseProps | DataTableEmptyStateNoResultsProps;
|
|
30
|
+
declare function DataTableEmptyState(props: DataTableEmptyStateProps): import("react").JSX.Element;
|
|
31
|
+
export { DataTableEmptyState };
|
|
32
|
+
export type { DataTableEmptyStateProps };
|
|
33
|
+
//# sourceMappingURL=DataTableEmptyState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTableEmptyState.d.ts","sourceRoot":"","sources":["../../../src/composed/DataTableEmptyState/DataTableEmptyState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWvC,UAAU,4BAA4B;IACpC,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,UAAU,gCAAiC,SAAQ,4BAA4B;IAC7E,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,8CAA8C;IAC9C,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC;IACnC,2DAA2D;IAC3D,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED,UAAU,iCAAkC,SAAQ,4BAA4B;IAC9E,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,qDAAqD;IACrD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;IAC/B,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC;CAClC;AAED,KAAK,wBAAwB,GAAG,gCAAgC,GAAG,iCAAiC,CAAC;AAErG,iBAAS,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,+BAuC3D;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,YAAY,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composed/DataTableEmptyState/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export * from './composed/ContentHeader';
|
|
|
55
55
|
export * from './composed/CopyableText';
|
|
56
56
|
export { buildLinearBreadcrumbs, type LinearBreadcrumbNavigate, type LinearBreadcrumbSegment, } from './lib/breadcrumbs/buildLinearBreadcrumbs';
|
|
57
57
|
export * from './composed/DataTable';
|
|
58
|
+
export * from './composed/DataTableEmptyState';
|
|
58
59
|
export * from './composed/DataTablePagination';
|
|
59
60
|
export * from './composed/DatePicker';
|
|
60
61
|
export * from './composed/FacetedFilter';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAG3F,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CA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