cleanplate 0.3.11 → 0.3.12
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/components/table/Table.d.ts +35 -9
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/index.es.js +4 -4
- package/dist/index.js +4 -4
- package/dist/stories/table/table-arg-types.d.ts +5 -0
- package/dist/stories/table/table-arg-types.d.ts.map +1 -0
- package/docs/Table.md +28 -11
- package/llms.txt +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SPACING_OPTIONS } from "../../constants/common";
|
|
3
|
+
import type { MediaObjectProps } from "../media-object";
|
|
3
4
|
import type { PaginationRowsPerPageOption } from "../pagination";
|
|
4
5
|
export type SpacingOption = (typeof SPACING_OPTIONS)[number];
|
|
5
6
|
export type TableMargin = string | SpacingOption[];
|
|
@@ -13,15 +14,36 @@ export interface TableColumn {
|
|
|
13
14
|
customRender?: (rowData: TableRow, column: TableColumn) => React.ReactNode;
|
|
14
15
|
widthPercentage?: string;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
/** Row key used to read a value from each `TableRow`. */
|
|
18
|
+
export type TableMobileColumnKey = string;
|
|
19
|
+
/**
|
|
20
|
+
* Row key, static value, or per-row resolver.
|
|
21
|
+
* For `mediaIcon` / `mediaImage` strings: if the string is a key on the row, the row value wins;
|
|
22
|
+
* otherwise the string is treated as a static icon name or image URL.
|
|
23
|
+
*/
|
|
24
|
+
export type TableMobileColumnField<T = React.ReactNode> = TableMobileColumnKey | ((row: TableRow) => T | undefined);
|
|
25
|
+
/**
|
|
26
|
+
* Maps table rows to {@link MediaObject} on viewports under 768px.
|
|
27
|
+
* Inherits static MediaObject options (`margin`, `padding`, `descriptionLineClamp`, etc.).
|
|
28
|
+
* Text and media slots accept row keys or resolvers; `action` is always a per-row render function.
|
|
29
|
+
*/
|
|
30
|
+
export interface TableMobileColumns extends Omit<MediaObjectProps, "title" | "subtitle" | "description" | "meta" | "action" | "mediaAvatar" | "mediaIcon" | "mediaImage" | "onClick"> {
|
|
31
|
+
/** Row key for MediaObject `title` (required) */
|
|
32
|
+
title: TableMobileColumnKey;
|
|
33
|
+
/** Row key or per-row resolver for `subtitle` */
|
|
34
|
+
subtitle?: TableMobileColumnField<React.ReactNode>;
|
|
35
|
+
/** Row key or per-row resolver for `description` */
|
|
36
|
+
description?: TableMobileColumnField<React.ReactNode>;
|
|
37
|
+
/** Row key or per-row resolver for `meta` */
|
|
38
|
+
meta?: TableMobileColumnField<React.ReactNode>;
|
|
39
|
+
/** Row key for `mediaAvatar` */
|
|
40
|
+
mediaAvatar?: TableMobileColumnKey;
|
|
41
|
+
/** Static icon name, row key, or per-row resolver for `mediaIcon` */
|
|
42
|
+
mediaIcon?: TableMobileColumnField<MediaObjectProps["mediaIcon"]>;
|
|
43
|
+
/** Static image URL, row key, or per-row resolver for `mediaImage` */
|
|
44
|
+
mediaImage?: TableMobileColumnField<string>;
|
|
45
|
+
/** Per-row `action` slot; use `stopPropagation` on interactive children when the row is clickable */
|
|
46
|
+
action?: (row: TableRow) => React.ReactNode;
|
|
25
47
|
}
|
|
26
48
|
export interface TableProps {
|
|
27
49
|
variant?: TableVariant;
|
|
@@ -38,6 +60,10 @@ export interface TableProps {
|
|
|
38
60
|
onPageChange?: (page: number, rowsPerPage: number) => void;
|
|
39
61
|
onRowsPerPageChange?: (rowsPerPage: number) => void;
|
|
40
62
|
hidePagination?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* When set and viewport width is under 768px, each row renders as a MediaObject.
|
|
65
|
+
* See {@link TableMobileColumns}.
|
|
66
|
+
*/
|
|
41
67
|
mobileColumns?: TableMobileColumns | null;
|
|
42
68
|
}
|
|
43
69
|
declare const Table: React.FC<TableProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAMzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAEjE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,aAAa,EAAE,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjD,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/C,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,YAAY,CAAC,EAAE,CACb,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,WAAW,KAChB,KAAK,CAAC,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAMzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAEjE,MAAM,MAAM,aA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|
1
1
|
export { default } from "./Table";
|
|
2
|
-
export type { TableProps, TableColumn, TableRow, TableVariant, TableMargin, TableColumnTextAlign, TableMobileColumns, SpacingOption, } from "./Table";
|
|
2
|
+
export type { TableProps, TableColumn, TableRow, TableVariant, TableMargin, TableColumnTextAlign, TableMobileColumns, TableMobileColumnKey, TableMobileColumnField, SpacingOption, } from "./Table";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,YAAY,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,GACd,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,YAAY,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,GACd,MAAM,SAAS,CAAC"}
|