@dimaan/ui 0.0.17 → 0.0.19
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/dist/index.cjs +166 -15449
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -4
- package/dist/index.d.ts +60 -4
- package/dist/index.js +73 -15355
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
package/dist/index.d.cts
CHANGED
|
@@ -1468,8 +1468,16 @@ interface TableProps<T> {
|
|
|
1468
1468
|
data: readonly T[];
|
|
1469
1469
|
/** Column definitions. */
|
|
1470
1470
|
columns: ReadonlyArray<Column<T>>;
|
|
1471
|
-
/**
|
|
1472
|
-
|
|
1471
|
+
/**
|
|
1472
|
+
* Stable id for each row. Required for selection; recommended always.
|
|
1473
|
+
*
|
|
1474
|
+
* **Optional with a default**: when omitted, Table reads `row.id` (most
|
|
1475
|
+
* APIs use it) and falls back to the row index. Provide this explicitly
|
|
1476
|
+
* for records that use a different identifier (`_id`, `uuid`) or any
|
|
1477
|
+
* time the list can reorder — index-based ids break selection across
|
|
1478
|
+
* reorders.
|
|
1479
|
+
*/
|
|
1480
|
+
getRowId?: (row: T, index: number) => string;
|
|
1473
1481
|
/**
|
|
1474
1482
|
* Total row count across all pages. Pass this when the parent paginates/sorts
|
|
1475
1483
|
* server-side — Table will skip its local sort + slice.
|
|
@@ -1576,16 +1584,64 @@ interface ListPageProps<T> {
|
|
|
1576
1584
|
actions?: ReactNode;
|
|
1577
1585
|
data: T[];
|
|
1578
1586
|
columns: Column<T>[];
|
|
1579
|
-
|
|
1587
|
+
/**
|
|
1588
|
+
* Stable id for each row. Required for row selection across re-renders and
|
|
1589
|
+
* for stable React keys.
|
|
1590
|
+
*
|
|
1591
|
+
* Defaults to reading `row.id` when present, falling back to the row index.
|
|
1592
|
+
* Provide this explicitly when your records use a different identifier
|
|
1593
|
+
* (e.g. `_id`, `uuid`, a composite key) — index-based ids break selection
|
|
1594
|
+
* when the data list reorders.
|
|
1595
|
+
*/
|
|
1596
|
+
getRowId?: (row: T) => string;
|
|
1580
1597
|
/** Show skeleton rows in the table area while data is fetching. */
|
|
1581
1598
|
isLoading?: boolean;
|
|
1582
1599
|
/** Number of skeleton rows rendered while loading. Defaults to the table page size. */
|
|
1583
1600
|
loadingRowCount?: number;
|
|
1584
1601
|
/** Keys on `T` to search. Search input only renders when this is provided. */
|
|
1585
1602
|
searchKeys?: Array<keyof T>;
|
|
1603
|
+
/**
|
|
1604
|
+
* Controlled search input value. Pair with `onSearchChange` to drive the
|
|
1605
|
+
* search from outside (typical for server-side filtering). When both are
|
|
1606
|
+
* provided, ListPage **stops filtering `data` locally** for search —
|
|
1607
|
+
* `data` is trusted to already match the query.
|
|
1608
|
+
*/
|
|
1609
|
+
searchValue?: string;
|
|
1610
|
+
/** Fires on every search input change. Pair with `searchValue` for controlled mode. */
|
|
1611
|
+
onSearchChange?: (value: string) => void;
|
|
1586
1612
|
filters?: ListPageFilter<T>[];
|
|
1613
|
+
/**
|
|
1614
|
+
* Controlled filter values keyed by `filter.key`. When provided alongside
|
|
1615
|
+
* `onFilterChange`, ListPage **stops filtering `data` locally** — `data`
|
|
1616
|
+
* is trusted to already match the active filter selections.
|
|
1617
|
+
*/
|
|
1618
|
+
filterValues?: Record<string, string>;
|
|
1619
|
+
/** Fires when any filter Select changes. Pair with `filterValues` for controlled mode. */
|
|
1620
|
+
onFilterChange?: (key: string, value: string) => void;
|
|
1587
1621
|
enableRowSelection?: boolean;
|
|
1588
1622
|
bulkActions?: (selected: T[]) => ReactNode;
|
|
1623
|
+
/**
|
|
1624
|
+
* Controlled pagination state. Pair with `onPaginationChange` and `totalCount`
|
|
1625
|
+
* for server-side pagination — the consumer's data-fetching layer becomes
|
|
1626
|
+
* the source of truth for `pageIndex` / `pageSize`.
|
|
1627
|
+
*/
|
|
1628
|
+
pagination?: PaginationState;
|
|
1629
|
+
/** Uncontrolled initial pagination state. Ignored when `pagination` is set. */
|
|
1630
|
+
defaultPagination?: PaginationState;
|
|
1631
|
+
/** Fires when the user changes the page or page size. */
|
|
1632
|
+
onPaginationChange?: (next: PaginationState) => void;
|
|
1633
|
+
/**
|
|
1634
|
+
* Total row count across all pages on the server. Setting this flips the
|
|
1635
|
+
* inner Table into server-side mode — it stops slicing `data` locally and
|
|
1636
|
+
* trusts `data` to be the current page already.
|
|
1637
|
+
*
|
|
1638
|
+
* In server-side mode the consumer also typically skips `searchKeys` /
|
|
1639
|
+
* `filters` (those would filter only the current page) and drives search /
|
|
1640
|
+
* filter from the data-fetching layer instead.
|
|
1641
|
+
*/
|
|
1642
|
+
totalCount?: number;
|
|
1643
|
+
/** Page-size dropdown options. Defaults to `[10, 25, 50]`. */
|
|
1644
|
+
pageSizeOptions?: readonly number[];
|
|
1589
1645
|
/**
|
|
1590
1646
|
* Shown when filters/search are active but match zero rows. Falls back to a
|
|
1591
1647
|
* "No results — try clearing the search or adjusting the filters" prompt
|
|
@@ -1664,7 +1720,7 @@ interface ListPageProps<T> {
|
|
|
1664
1720
|
* />
|
|
1665
1721
|
* ```
|
|
1666
1722
|
*/
|
|
1667
|
-
declare function ListPage<T>({ title, description, bordered, actions, data, columns, getRowId, isLoading, loadingRowCount, searchKeys, filters, enableRowSelection, bulkActions, emptyState, noDataState, labels: labelsProp, className, }: ListPageProps<T>): react_jsx_runtime.JSX.Element;
|
|
1723
|
+
declare function ListPage<T>({ title, description, bordered, actions, data, columns, getRowId, isLoading, loadingRowCount, searchKeys, searchValue: searchValueProp, onSearchChange, filters, filterValues: filterValuesProp, onFilterChange, enableRowSelection, bulkActions, pagination, defaultPagination, onPaginationChange, totalCount, pageSizeOptions, emptyState, noDataState, labels: labelsProp, className, }: ListPageProps<T>): react_jsx_runtime.JSX.Element;
|
|
1668
1724
|
|
|
1669
1725
|
type RadioGroupSize = 'sm' | 'md' | 'lg';
|
|
1670
1726
|
/** Outer circle (radio button itself) — sized + bordered. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1468,8 +1468,16 @@ interface TableProps<T> {
|
|
|
1468
1468
|
data: readonly T[];
|
|
1469
1469
|
/** Column definitions. */
|
|
1470
1470
|
columns: ReadonlyArray<Column<T>>;
|
|
1471
|
-
/**
|
|
1472
|
-
|
|
1471
|
+
/**
|
|
1472
|
+
* Stable id for each row. Required for selection; recommended always.
|
|
1473
|
+
*
|
|
1474
|
+
* **Optional with a default**: when omitted, Table reads `row.id` (most
|
|
1475
|
+
* APIs use it) and falls back to the row index. Provide this explicitly
|
|
1476
|
+
* for records that use a different identifier (`_id`, `uuid`) or any
|
|
1477
|
+
* time the list can reorder — index-based ids break selection across
|
|
1478
|
+
* reorders.
|
|
1479
|
+
*/
|
|
1480
|
+
getRowId?: (row: T, index: number) => string;
|
|
1473
1481
|
/**
|
|
1474
1482
|
* Total row count across all pages. Pass this when the parent paginates/sorts
|
|
1475
1483
|
* server-side — Table will skip its local sort + slice.
|
|
@@ -1576,16 +1584,64 @@ interface ListPageProps<T> {
|
|
|
1576
1584
|
actions?: ReactNode;
|
|
1577
1585
|
data: T[];
|
|
1578
1586
|
columns: Column<T>[];
|
|
1579
|
-
|
|
1587
|
+
/**
|
|
1588
|
+
* Stable id for each row. Required for row selection across re-renders and
|
|
1589
|
+
* for stable React keys.
|
|
1590
|
+
*
|
|
1591
|
+
* Defaults to reading `row.id` when present, falling back to the row index.
|
|
1592
|
+
* Provide this explicitly when your records use a different identifier
|
|
1593
|
+
* (e.g. `_id`, `uuid`, a composite key) — index-based ids break selection
|
|
1594
|
+
* when the data list reorders.
|
|
1595
|
+
*/
|
|
1596
|
+
getRowId?: (row: T) => string;
|
|
1580
1597
|
/** Show skeleton rows in the table area while data is fetching. */
|
|
1581
1598
|
isLoading?: boolean;
|
|
1582
1599
|
/** Number of skeleton rows rendered while loading. Defaults to the table page size. */
|
|
1583
1600
|
loadingRowCount?: number;
|
|
1584
1601
|
/** Keys on `T` to search. Search input only renders when this is provided. */
|
|
1585
1602
|
searchKeys?: Array<keyof T>;
|
|
1603
|
+
/**
|
|
1604
|
+
* Controlled search input value. Pair with `onSearchChange` to drive the
|
|
1605
|
+
* search from outside (typical for server-side filtering). When both are
|
|
1606
|
+
* provided, ListPage **stops filtering `data` locally** for search —
|
|
1607
|
+
* `data` is trusted to already match the query.
|
|
1608
|
+
*/
|
|
1609
|
+
searchValue?: string;
|
|
1610
|
+
/** Fires on every search input change. Pair with `searchValue` for controlled mode. */
|
|
1611
|
+
onSearchChange?: (value: string) => void;
|
|
1586
1612
|
filters?: ListPageFilter<T>[];
|
|
1613
|
+
/**
|
|
1614
|
+
* Controlled filter values keyed by `filter.key`. When provided alongside
|
|
1615
|
+
* `onFilterChange`, ListPage **stops filtering `data` locally** — `data`
|
|
1616
|
+
* is trusted to already match the active filter selections.
|
|
1617
|
+
*/
|
|
1618
|
+
filterValues?: Record<string, string>;
|
|
1619
|
+
/** Fires when any filter Select changes. Pair with `filterValues` for controlled mode. */
|
|
1620
|
+
onFilterChange?: (key: string, value: string) => void;
|
|
1587
1621
|
enableRowSelection?: boolean;
|
|
1588
1622
|
bulkActions?: (selected: T[]) => ReactNode;
|
|
1623
|
+
/**
|
|
1624
|
+
* Controlled pagination state. Pair with `onPaginationChange` and `totalCount`
|
|
1625
|
+
* for server-side pagination — the consumer's data-fetching layer becomes
|
|
1626
|
+
* the source of truth for `pageIndex` / `pageSize`.
|
|
1627
|
+
*/
|
|
1628
|
+
pagination?: PaginationState;
|
|
1629
|
+
/** Uncontrolled initial pagination state. Ignored when `pagination` is set. */
|
|
1630
|
+
defaultPagination?: PaginationState;
|
|
1631
|
+
/** Fires when the user changes the page or page size. */
|
|
1632
|
+
onPaginationChange?: (next: PaginationState) => void;
|
|
1633
|
+
/**
|
|
1634
|
+
* Total row count across all pages on the server. Setting this flips the
|
|
1635
|
+
* inner Table into server-side mode — it stops slicing `data` locally and
|
|
1636
|
+
* trusts `data` to be the current page already.
|
|
1637
|
+
*
|
|
1638
|
+
* In server-side mode the consumer also typically skips `searchKeys` /
|
|
1639
|
+
* `filters` (those would filter only the current page) and drives search /
|
|
1640
|
+
* filter from the data-fetching layer instead.
|
|
1641
|
+
*/
|
|
1642
|
+
totalCount?: number;
|
|
1643
|
+
/** Page-size dropdown options. Defaults to `[10, 25, 50]`. */
|
|
1644
|
+
pageSizeOptions?: readonly number[];
|
|
1589
1645
|
/**
|
|
1590
1646
|
* Shown when filters/search are active but match zero rows. Falls back to a
|
|
1591
1647
|
* "No results — try clearing the search or adjusting the filters" prompt
|
|
@@ -1664,7 +1720,7 @@ interface ListPageProps<T> {
|
|
|
1664
1720
|
* />
|
|
1665
1721
|
* ```
|
|
1666
1722
|
*/
|
|
1667
|
-
declare function ListPage<T>({ title, description, bordered, actions, data, columns, getRowId, isLoading, loadingRowCount, searchKeys, filters, enableRowSelection, bulkActions, emptyState, noDataState, labels: labelsProp, className, }: ListPageProps<T>): react_jsx_runtime.JSX.Element;
|
|
1723
|
+
declare function ListPage<T>({ title, description, bordered, actions, data, columns, getRowId, isLoading, loadingRowCount, searchKeys, searchValue: searchValueProp, onSearchChange, filters, filterValues: filterValuesProp, onFilterChange, enableRowSelection, bulkActions, pagination, defaultPagination, onPaginationChange, totalCount, pageSizeOptions, emptyState, noDataState, labels: labelsProp, className, }: ListPageProps<T>): react_jsx_runtime.JSX.Element;
|
|
1668
1724
|
|
|
1669
1725
|
type RadioGroupSize = 'sm' | 'md' | 'lg';
|
|
1670
1726
|
/** Outer circle (radio button itself) — sized + bordered. */
|