|
1 | 1 | # @tailor-platform/app-shell |
2 | 2 |
|
| 3 | +## 1.2.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- 8a09b26: Add `align: "left" | "right"` to `DataTable` `Column`. When set to `"right"`, the header label, body cell, and loading-skeleton bar are right-aligned together — eliminating the inline `<span className="text-right">` wrappers callers were adding inside `render` for numeric columns (Amount, Score, Total). |
| 8 | + |
| 9 | + `align` is **auto-defaulted to `"right"` for `type: "number"` and `type: "money"`** so the common case Just Works without extra config. Other types default to `"left"`. Pass `"left"` explicitly to opt a numeric column out. |
| 10 | + |
| 11 | + ```tsx |
| 12 | + // Auto-aligned right — no `align` needed |
| 13 | + column({ |
| 14 | + label: "Total", |
| 15 | + type: "money", |
| 16 | + accessor: (row) => row.total, |
| 17 | + typeOptions: { currency: "USD" }, |
| 18 | + }); |
| 19 | + |
| 20 | + // Explicit alignment for a custom-render column |
| 21 | + column({ |
| 22 | + label: "Amount", |
| 23 | + align: "right", |
| 24 | + render: (row) => formatMoney(row.amount), |
| 25 | + }); |
| 26 | + ``` |
| 27 | + |
| 28 | +- b644bdb: Add `truncate: boolean` to `DataTable` `Column`. When set, the cell content is truncated with an ellipsis on overflow, and an app-shell `<Tooltip>` is auto-wired to reveal the full value on hover when the cell value is a stringifiable primitive. The tooltip resolves through the same precedence rule the built-in `type` renderers use — `accessor` first, then `row[col.id]` — so `inferColumns` consumers get the tooltip for free without an explicit accessor. Pair `truncate` with `width` on neighboring columns to anchor row width, since truncate cells use `max-w-0` to stay shrinkable. |
| 29 | + |
| 30 | + ```tsx |
| 31 | + column({ |
| 32 | + label: "Description", |
| 33 | + render: (row) => row.description, |
| 34 | + accessor: (row) => row.description, |
| 35 | + truncate: true, |
| 36 | + }); |
| 37 | + |
| 38 | + // Or with `inferColumns`, no explicit `accessor` needed — the inferred |
| 39 | + // column pins `id` to the field name so the tooltip resolves automatically: |
| 40 | + column({ ...infer("description"), truncate: true }); |
| 41 | + ``` |
| 42 | + |
| 43 | + `inferColumns` now also pins `id` to the metadata field name (previously omitted). This makes the cell renderer's `row[col.id]` fallback resolve cleanly and stabilizes the React key / column-visibility identifier across re-renders. |
| 44 | + |
| 45 | +- 4c89923: Add `defaultOpen` and `collapsible` props to `SidebarLayout` for controlling sidebar behavior. |
| 46 | + |
| 47 | + ```tsx |
| 48 | + // Sidebar closed by default on desktop |
| 49 | + <SidebarLayout defaultOpen={false} /> |
| 50 | + |
| 51 | + // Non-collapsible sidebar (always visible, toggle buttons hidden) |
| 52 | + <SidebarLayout collapsible={false} /> |
| 53 | + ``` |
| 54 | + |
| 55 | +- c4fbfa2: Add `type` and `typeOptions` to `DataTable` `Column` for built-in cell rendering. Set `type` to `text`, `number`, `money`, `date`, `badge`, or `link` to skip writing a `render` function for the common cases. `render` stays required for untyped columns and becomes an optional override when `type` is set. |
| 56 | + |
| 57 | + `Column<TRow>` is a discriminated union on `type`, so wrong-shape options are a compile error rather than silently ignored at runtime — and `type: "link"` requires `typeOptions.href`. |
| 58 | + |
| 59 | + ```tsx |
| 60 | + column({ |
| 61 | + label: "Total", |
| 62 | + accessor: (row) => row.total, |
| 63 | + type: "money", |
| 64 | + typeOptions: { currency: "USD" }, |
| 65 | + }); |
| 66 | + |
| 67 | + column({ |
| 68 | + label: "Status", |
| 69 | + accessor: (row) => row.status, |
| 70 | + type: "badge", |
| 71 | + typeOptions: { |
| 72 | + badgeVariantMap: { active: "success", draft: "neutral" }, |
| 73 | + badgeLabelMap: { active: "Active", draft: "Draft" }, |
| 74 | + }, |
| 75 | + }); |
| 76 | + ``` |
| 77 | + |
| 78 | +### Patch Changes |
| 79 | + |
| 80 | +- c4fbfa2: Narrow `Column.accessor`'s return type per built-in `type` so the typed cell renderers reject values they can't display. Returning an array or a plain object from a `text` / `number` / `money` / `date` / `badge` / `link` accessor is now a compile error instead of silently rendering `[object Object]` or a stringified list. `null` and `undefined` are still allowed and continue to render the `—` placeholder. Columns without a `type` retain the loose `unknown` return type — they pair with `render` to draw whatever shape they like. |
| 81 | + |
| 82 | + ```tsx |
| 83 | + column({ |
| 84 | + label: "Tags", |
| 85 | + type: "text", |
| 86 | + // ^ compile error: text accessor cannot return an array. |
| 87 | + accessor: (row) => row.tags, |
| 88 | + }); |
| 89 | + ``` |
| 90 | + |
| 91 | +- eecff8e: Add `subtle-success`, `subtle-warning`, and `subtle-error` badge variants for low-emphasis status labels. |
| 92 | + |
| 93 | + ```tsx |
| 94 | + <Badge variant="subtle-success">Matched</Badge> |
| 95 | + <Badge variant="subtle-warning">Needs Attention</Badge> |
| 96 | + <Badge variant="subtle-error">Needs Review</Badge> |
| 97 | + ``` |
| 98 | + |
3 | 99 | ## 1.1.1 |
4 | 100 |
|
5 | 101 | ### Patch Changes |
|
0 commit comments