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.
@@ -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
- interface TableMobileColumns {
66
- title: string; // row key for MediaObject title
67
- description?: string; // row key for description
68
- mediaAvatar?: string; // row key for avatar value
69
- mediaIcon?: string; // static icon name for all rows
70
- mediaImage?: string; // static image URL
71
- className?: string;
72
- margin?: TableMargin;
73
- padding?: string | SpacingOption[];
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
- mediaAvatar: "avatarUrl",
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, the table is replaced by a list of MediaObject items; `title` (and optionally `description`, `mediaAvatar`) are row keys whose values are passed to MediaObject.
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cleanplate",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "CleanPlate - A Headless React UI Framework",
5
5
  "files": [
6
6
  "dist",