cleanplate 0.3.10 → 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"}
@@ -90,12 +90,14 @@ import { PageHeader, Button } from "cleanplate";
90
90
  ### Custom title (ReactNode)
91
91
 
92
92
  ```jsx
93
+ import { PageHeader, Button, Container, Icon } from "cleanplate";
94
+
93
95
  <PageHeader
94
96
  title={
95
- <span style={{ display: "flex", alignItems: "center", gap: "8px" }}>
96
- <span>📋</span>
97
- Custom title
98
- </span>
97
+ <Container display="flex" align="center" gap="2" padding="0" margin="m-0">
98
+ <Icon name="assignment" size="medium" />
99
+ Custom title with icon
100
+ </Container>
99
101
  }
100
102
  subtitle="Optional subtitle"
101
103
  primaryCta={<Button>Action</Button>}
@@ -121,14 +123,15 @@ import { PageHeader, Button } from "cleanplate";
121
123
  ## Behavior Notes
122
124
 
123
125
  - **Layout:** Root is a `<header>`. Flex row: left (title + subtitle), right (CTA + more trigger). Right column uses margin-left: auto for right alignment.
124
- - **Title / subtitle:** If string, rendered with Typography (h4 / p). If ReactNode, rendered in a div with the same layout class.
125
- - **More menu:** When moreMenuItems is set, renders a Dropdown with an icon Button (more_vert) and a list; each item onClick runs and the dropdown closes. When moreMenuContent is set, that content is shown in the dropdown. Use one or the other.
126
- - **Accessibility:** More trigger has aria-expanded and aria-haspopup; list uses role="menu" and role="menuitem".
126
+ - **Title / subtitle:** Always rendered with Typography (`h4` / `p`); strings and custom ReactNode children share the same heading styles and semantics.
127
+ - **More menu:** When moreMenuItems is set, renders a Dropdown with an icon Button (more_vert) and MenuList; each item onClick runs and the dropdown closes. When moreMenuContent is set, that content is shown in the dropdown. Use one or the other.
128
+ - **Accessibility:** More trigger has aria-expanded, aria-haspopup, and aria-label; menu items use MenuList semantics.
127
129
 
128
130
  ## Related Components / Links
129
131
 
130
132
  - Button (typically for primaryCta)
131
133
  - Typography (used internally for string title and subtitle)
132
134
  - Dropdown (used internally for the more menu)
135
+ - MenuList (used internally for moreMenuItems)
133
136
  - Icon (more_vert trigger)
134
137
  - Container (wrap PageHeader and page content)
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.10",
3
+ "version": "0.3.12",
4
4
  "description": "CleanPlate - A Headless React UI Framework",
5
5
  "files": [
6
6
  "dist",