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
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ArgTypes } from "@storybook/types";
|
|
2
|
+
/** Storybook argTypes override — docgen shows "union" for TableMobileColumns | null. */
|
|
3
|
+
export declare const tableMobileColumnsArgType: ArgTypes[string];
|
|
4
|
+
export declare const tableDocsArgTypes: ArgTypes;
|
|
5
|
+
//# sourceMappingURL=table-arg-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-arg-types.d.ts","sourceRoot":"","sources":["../../../src/stories/table/table-arg-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAejD,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAWtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAE/B,CAAC"}
|
package/docs/Table.md
CHANGED
|
@@ -61,16 +61,29 @@ interface TableColumn {
|
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
### TableMobileColumns
|
|
64
|
+
Extends static [MediaObject](./MediaObject.md) options (`margin`, `padding`, `descriptionLineClamp`, `className`, and other div attributes except `onClick`). Row-driven slots accept a **row key** or a **per-row resolver**.
|
|
65
|
+
|
|
64
66
|
```typescript
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
type TableMobileColumnKey = string;
|
|
68
|
+
|
|
69
|
+
type TableMobileColumnField<T = React.ReactNode> =
|
|
70
|
+
| TableMobileColumnKey
|
|
71
|
+
| ((row: TableRow) => T | undefined);
|
|
72
|
+
|
|
73
|
+
interface TableMobileColumns
|
|
74
|
+
extends Omit<
|
|
75
|
+
MediaObjectProps,
|
|
76
|
+
| "title" | "subtitle" | "description" | "meta" | "action"
|
|
77
|
+
| "mediaAvatar" | "mediaIcon" | "mediaImage" | "onClick"
|
|
78
|
+
> {
|
|
79
|
+
title: TableMobileColumnKey; // required row key
|
|
80
|
+
subtitle?: TableMobileColumnField;
|
|
81
|
+
description?: TableMobileColumnField;
|
|
82
|
+
meta?: TableMobileColumnField;
|
|
83
|
+
mediaAvatar?: TableMobileColumnKey;
|
|
84
|
+
mediaIcon?: TableMobileColumnField<string>; // static icon, row key, or resolver
|
|
85
|
+
mediaImage?: TableMobileColumnField<string>; // static URL, row key, or resolver
|
|
86
|
+
action?: (row: TableRow) => React.ReactNode;
|
|
74
87
|
}
|
|
75
88
|
```
|
|
76
89
|
|
|
@@ -163,8 +176,12 @@ const columns = [
|
|
|
163
176
|
data={data}
|
|
164
177
|
mobileColumns={{
|
|
165
178
|
title: "name",
|
|
179
|
+
subtitle: "role",
|
|
166
180
|
description: "email",
|
|
167
|
-
|
|
181
|
+
meta: "status",
|
|
182
|
+
mediaAvatar: "name",
|
|
183
|
+
descriptionLineClamp: 2,
|
|
184
|
+
action: (row) => <Badge label={String(row.status)} variant="success" />,
|
|
168
185
|
}}
|
|
169
186
|
/>
|
|
170
187
|
```
|
|
@@ -183,7 +200,7 @@ const columns = [
|
|
|
183
200
|
|
|
184
201
|
- **Required:** `columns` and `data` are required. Each column must have `id` and `title`; row keys should match `id` for default cell display.
|
|
185
202
|
- **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.
|
|
186
|
-
- **Mobile:** When viewport width < 768px and `mobileColumns` is set,
|
|
203
|
+
- **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, or use resolvers / `action` for custom per-row UI. Static MediaObject props (`descriptionLineClamp`, `margin`, `padding`, etc.) pass through unchanged.
|
|
187
204
|
- **customRender:** Receives `(rowData, column)` and returns a React node; use for badges, buttons, or any custom cell content.
|
|
188
205
|
- **Spacing:** `margin` uses the suffix API; the component adds the `m-` prefix via `getSpacingClass`.
|
|
189
206
|
|
package/llms.txt
CHANGED
|
@@ -152,7 +152,7 @@ All component documentation is located in the `docs/` folder. The following docu
|
|
|
152
152
|
- File: `docs/Table.md`
|
|
153
153
|
- Purpose: Displays structured data in a table with configurable columns, optional built-in pagination, and responsive mobile view (MediaObject cards when viewport < 768px and mobileColumns set).
|
|
154
154
|
- Key Features: columns (id, title, textAlign, widthPercentage, customRender), data (TableRow[]), variants (default, compact), mobileColumns, onRowClick, pagination props (totalItems, currentPage, onPageChange, etc.), hidePagination, margin (suffix API)
|
|
155
|
-
- Types: TableProps, TableColumn, TableRow, TableVariant, TableMargin, TableColumnTextAlign, TableMobileColumns, SpacingOption
|
|
155
|
+
- Types: TableProps, TableColumn, TableRow, TableVariant, TableMargin, TableColumnTextAlign, TableMobileColumns, TableMobileColumnKey, TableMobileColumnField, SpacingOption
|
|
156
156
|
- Related Components: Pagination (built-in), MediaObject (mobile view), Typography, Container, Badge (often in customRender)
|
|
157
157
|
|
|
158
158
|
### Badge Component
|