cleanplate 0.3.24 → 0.3.27

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/docs/Table.md CHANGED
@@ -6,10 +6,11 @@ Purpose: Displays structured data in a table with configurable columns, optional
6
6
 
7
7
  | Prop | Type | Required | Default | Description |
8
8
  | --- | --- | --- | --- | --- |
9
- | columns | TableColumn[] | yes | — | Column definitions (id, title, textAlign?, widthPercentage?, customRender?). |
9
+ | columns | TableColumn[] | yes | — | Column definitions (id, title, textAlign?, verticalAlign?, widthPercentage?, customRender?). |
10
10
  | data | TableRow[] | yes | — | Array of row objects; keys should match column `id`s. |
11
11
  | variant | "default" \| "compact" | no | "default" | Visual variant. |
12
12
  | margin | string \| SpacingOption[] | no | "0" | Margin spacing. Suffix or array of spacing suffixes; component adds `m-` prefix. |
13
+ | padding | string \| SpacingOption[] | no | "4" | Root padding. Suffix or array of spacing suffixes; component adds `p-` prefix. |
13
14
  | className | string | no | "" | Additional class names for the root element. |
14
15
  | onRowClick | (rowData: TableRow) => void | no | — | Called when a row is clicked; receives the row object. |
15
16
  | totalItems | number | no | 0 | Total item count for built-in Pagination; 0 or omitted hides pagination. |
@@ -20,6 +21,7 @@ Purpose: Displays structured data in a table with configurable columns, optional
20
21
  | onPageChange | (page, rowsPerPage) => void | no | — | Called when page changes; receives (page, rowsPerPage). |
21
22
  | onRowsPerPageChange | (rowsPerPage: number) => void | no | — | Called when rows per page changes. |
22
23
  | hidePagination | boolean | no | false | If true, hides the built-in pagination bar even when totalItems > 0. |
24
+ | cellVerticalAlign | "top" \| "middle" \| "bottom" | no | "top" | Default vertical alignment for header and body cells. |
23
25
  | mobileColumns | TableMobileColumns \| null | no | null | When set and viewport < 768px, rows render as MediaObjects; keys map row keys to title, description, media. |
24
26
 
25
27
  ## Types
@@ -39,11 +41,21 @@ type TableVariant = "default" | "compact";
39
41
  type TableMargin = string | SpacingOption[];
40
42
  ```
41
43
 
44
+ ### TablePadding
45
+ ```typescript
46
+ type TablePadding = string | SpacingOption[];
47
+ ```
48
+
42
49
  ### TableColumnTextAlign
43
50
  ```typescript
44
51
  type TableColumnTextAlign = "left" | "center" | "right";
45
52
  ```
46
53
 
54
+ ### TableColumnVerticalAlign
55
+ ```typescript
56
+ type TableColumnVerticalAlign = "top" | "middle" | "bottom";
57
+ ```
58
+
47
59
  ### TableRow
48
60
  ```typescript
49
61
  type TableRow = Record<string, unknown>;
@@ -55,6 +67,7 @@ interface TableColumn {
55
67
  id: string;
56
68
  title: string;
57
69
  textAlign?: TableColumnTextAlign;
70
+ verticalAlign?: TableColumnVerticalAlign;
58
71
  customRender?: (rowData: TableRow, column: TableColumn) => React.ReactNode;
59
72
  widthPercentage?: string;
60
73
  }
@@ -93,6 +106,7 @@ interface TableMobileColumns
93
106
  interface TableProps {
94
107
  variant?: TableVariant;
95
108
  margin?: TableMargin;
109
+ padding?: TablePadding;
96
110
  className?: string;
97
111
  columns: TableColumn[];
98
112
  data: TableRow[];
@@ -105,6 +119,7 @@ interface TableProps {
105
119
  onPageChange?: (page: number, rowsPerPage: number) => void;
106
120
  onRowsPerPageChange?: (rowsPerPage: number) => void;
107
121
  hidePagination?: boolean;
122
+ cellVerticalAlign?: TableColumnVerticalAlign;
108
123
  mobileColumns?: TableMobileColumns | null;
109
124
  }
110
125
  ```
@@ -203,8 +218,9 @@ const columns = [
203
218
  - **Required:** `columns` and `data` are required. Each column must have `id` and `title`; row keys should match `id` for default cell display.
204
219
  - **Pagination:** Built-in Pagination is shown when `totalItems` > 0 and `hidePagination` is false. Pass `onPageChange` and optionally `onRowsPerPageChange`; keep `currentPage` and `rowsPerPage` in parent state.
205
220
  - **Mobile:** When viewport width < 768px and `mobileColumns` is set, each row renders as a `MediaObject`. Map row keys to `title`, `subtitle`, `description`, `meta`, and media fields (`mediaAvatar`, `mediaAvatarCodeText`, `mediaIcon`, `mediaImage`), or use resolvers / `action` for custom per-row UI. Static MediaObject props (`descriptionLineClamp`, `margin`, `padding`, etc.) pass through unchanged.
221
+ - **Column alignment:** `textAlign` controls horizontal alignment per column. `cellVerticalAlign` sets the table default for vertical alignment; override per column with `verticalAlign` on `TableColumn`.
206
222
  - **customRender:** Receives `(rowData, column)` and returns a React node; use for badges, buttons, or any custom cell content.
207
- - **Spacing:** `margin` uses the suffix API; the component adds the `m-` prefix via `getSpacingClass`.
223
+ - **Spacing:** `margin` and `padding` use the suffix API; the component adds the `m-` and `p-` prefixes via `getSpacingClass`.
208
224
 
209
225
  ## Related Components / Links
210
226
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cleanplate",
3
- "version": "0.3.24",
3
+ "version": "0.3.27",
4
4
  "description": "CleanPlate - A Headless React UI Framework",
5
5
  "files": [
6
6
  "dist",