@jirawatpyk/aura-tokens 5.4.0 → 5.5.0

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/aura-tailwind.css CHANGED
@@ -1,4 +1,4 @@
1
- /* AURA v5.4.0 — Tailwind v4 theme. GENERATED by scripts/build-tokens.mts from tokens.json. Do not edit by hand.
1
+ /* AURA v5.5.0 — Tailwind v4 theme. GENERATED by scripts/build-tokens.mts from tokens.json. Do not edit by hand.
2
2
  * @import "tailwindcss";
3
3
  * @import "@jirawatpyk/aura-tokens/tailwind.css";
4
4
  * Gives bg-bg-surface, text-fg-primary, border-border-strong, p-aura-6, rounded-aura-xl, shadow-aura-overlay,
@@ -1,4 +1,4 @@
1
- /* AURA v5.4.0 — Tailwind v4 theme with aura- prefixed names. GENERATED by scripts/build-tokens.mts. Do not edit by hand.
1
+ /* AURA v5.5.0 — Tailwind v4 theme with aura- prefixed names. GENERATED by scripts/build-tokens.mts. Do not edit by hand.
2
2
  * For apps that already have a Tailwind theme (shadcn): nothing here redefines an existing name.
3
3
  * @layer aura-tokens, theme, base, aura, components, utilities;
4
4
  * @import "tailwindcss";
package/aura.css CHANGED
@@ -1,4 +1,4 @@
1
- /* AURA v5.4.0 — GENERATED by scripts/build-tokens.mts from tokens.json. Do not edit by hand. */
1
+ /* AURA v5.5.0 — GENERATED by scripts/build-tokens.mts from tokens.json. Do not edit by hand. */
2
2
  /* Fonts: load aura-fonts.css (or the <link> tags in README) separately, so a blocked Google Fonts never breaks this file. */
3
3
 
4
4
  :root, [data-theme="light"] {
@@ -68,7 +68,7 @@ window.Aura = (() => {
68
68
  Combobox: () => Combobox,
69
69
  Command: () => Command,
70
70
  Container: () => Container,
71
- DataTable: () => DataTable,
71
+ DataTable: () => DataTable2,
72
72
  DatePicker: () => DatePicker,
73
73
  DateRangePicker: () => DateRangePicker,
74
74
  Dialog: () => Dialog,
@@ -3982,7 +3982,7 @@ window.Aura = (() => {
3982
3982
  var ROW_H_DEFAULT = 48;
3983
3983
  var OVERSCAN = 8;
3984
3984
  var FLEX_MIN = 160;
3985
- var DataTable = React28.forwardRef(function DataTable2(props, ref) {
3985
+ var DataTableImpl = React28.forwardRef(function DataTable(props, ref) {
3986
3986
  const t = useStrings();
3987
3987
  const columns = props.columns || DEFAULT_COLUMNS;
3988
3988
  const byKey = {};
@@ -5217,6 +5217,7 @@ window.Aura = (() => {
5217
5217
  }
5218
5218
  return /* @__PURE__ */ React28.createElement("div", { ref, className: cx("aura-table-box", props.className) }, out);
5219
5219
  });
5220
+ var DataTable2 = DataTableImpl;
5220
5221
 
5221
5222
  // src/Card.tsx
5222
5223
  var React29 = __toESM(require_react(), 1);
@@ -46,12 +46,18 @@ export interface DataTableState {
46
46
  sort: DataTableSort | null;
47
47
  page: number;
48
48
  }
49
- /** A callback that gets one row. Written with your own row type (`(r: Order) => …`) it still fits (5.4):
50
- * the row is checked the way method parameters are, so no cast from `Record<string, any>` is needed. */
51
- export type RowCallback<R> = {
52
- bivarianceHack(row: Record<string, any>): R;
49
+ /** Internal helper (exported only because the declarations reference it): `T` as written, but never inferred from
50
+ * this position (works before TypeScript 5.4's own `NoInfer`), so a table's row type comes from its `rows`. */
51
+ export type NoInferRow<T> = [
52
+ T
53
+ ][T extends any ? 0 : never];
54
+ /** A callback that gets one row of type `Row` and returns `T`. Checked the way method parameters are, so a callback
55
+ * written for a narrower or wider row type still fits; one written for an unrelated type is an error (5.5). */
56
+ export type RowCallback<T, Row = Record<string, any>> = {
57
+ bivarianceHack(row: NoInferRow<Row>): T;
53
58
  }["bivarianceHack"];
54
- export interface DataTableColumn {
59
+ /** One column. `Row` is the table's row type (5.5): `DataTableColumn<Order>` types `render` and `sortValue`. */
60
+ export interface DataTableColumn<Row extends Record<string, any> = Record<string, any>> {
55
61
  /** Key into each row object. */
56
62
  key: string;
57
63
  /** Header label (source style: UPPERCASE). */
@@ -67,9 +73,9 @@ export interface DataTableColumn {
67
73
  /** Header becomes a button cycling asc → desc → unsorted. */
68
74
  sortable?: boolean | undefined;
69
75
  /** Value to sort by, when not the cell value (dates, amounts). */
70
- sortValue?: RowCallback<string | number | null> | undefined;
76
+ sortValue?: RowCallback<string | number | null, Row> | undefined;
71
77
  /** Custom cell content. */
72
- render?: RowCallback<React$1.ReactNode> | undefined;
78
+ render?: RowCallback<React$1.ReactNode, Row> | undefined;
73
79
  /** Set false to keep a sized column fixed when the table is `resizable`. */
74
80
  resizable?: boolean | undefined;
75
81
  /** Resize limits in px. Defaults 64 / 480. For the flexible column, minWidth defaults to 160. */
@@ -99,13 +105,14 @@ export interface DataTableEmpty {
99
105
  /** One action, usually a secondary Button. */
100
106
  action?: React$1.ReactNode | undefined;
101
107
  }
102
- /** Enterprise data table: 48px rows, hairline dividers, mono header band. */
103
- export interface DataTableProps {
108
+ /** Enterprise data table: 48px rows, hairline dividers, mono header band. Generic over the row type (5.5): with
109
+ * `rows={orders}` every `render`, `sortValue`, `getRowHref` and `onRowActivate` gets an `Order`. */
110
+ export interface DataTableProps<Row extends Record<string, any> = Record<string, any>> {
104
111
  /** Defaults to ID · NAME · STATUS · OWNER (96 / 160 / 112 / auto px). */
105
- columns?: DataTableColumn[] | undefined;
106
- /** Row objects. Any typed interface works (5.4: before, `interface Order {…}` rows needed a cast); cells show
107
- * the value at each column's key unless the column has `render`. */
108
- rows: ReadonlyArray<Record<string, any>>;
112
+ columns?: DataTableColumn<Row>[] | undefined;
113
+ /** Row objects, of any interface; their type is the table's row type. Cells show the value at each column's key
114
+ * unless the column has `render`. */
115
+ rows: ReadonlyArray<Row>;
109
116
  /** Column key giving each row a unique React key. Default: the first column's key. */
110
117
  rowKey?: string | undefined;
111
118
  /** Accessible name for the table. */
@@ -152,7 +159,7 @@ export interface DataTableProps {
152
159
  totalRows?: number | undefined;
153
160
  /** Makes each row a link: the first column's content renders as the provider's linkComponent (or `<a>`), and a click
154
161
  * or Enter anywhere on the row follows it. Ctrl/⌘-click opens a new tab as usual. */
155
- getRowHref?: RowCallback<string> | undefined;
162
+ getRowHref?: RowCallback<string, Row> | undefined;
156
163
  /** Pager arrows become links to these URLs (search-param paging). Without onPageChange the link navigates. */
157
164
  getPageHref?: ((page: number) => string) | undefined;
158
165
  /** Router link for getRowHref / getPageHref. Default: AuraProvider's linkComponent, else `<a>`. */
@@ -160,7 +167,7 @@ export interface DataTableProps {
160
167
  /** Skeleton row count when there is no pageSize. Default 5. */
161
168
  skeletonRows?: number | undefined;
162
169
  /** Called on row click or Enter. */
163
- onRowActivate?: RowCallback<void> | undefined;
170
+ onRowActivate?: RowCallback<void, Row> | undefined;
164
171
  /** Fixed height in px: sticky header, and only the rows in view are rendered. */
165
172
  height?: number | undefined;
166
173
  /** Column menu on every header, drag-to-reorder, and the show/hide columns button. */
@@ -1290,8 +1297,15 @@ export declare const Tooltip: React$1.ForwardRefExoticComponent<TooltipProps & R
1290
1297
  export declare const Dialog: React$1.ForwardRefExoticComponent<DialogProps & React$1.RefAttributes<HTMLDivElement>>;
1291
1298
  /** Side panel over the page: record detail, filters, mobile navigation. Modal (focus trap, scroll lock, focus restore). */
1292
1299
  export declare const Drawer: React$1.ForwardRefExoticComponent<DrawerProps & React$1.RefAttributes<HTMLDivElement>>;
1293
- /** Enterprise data table: 48px rows, hairline dividers, mono header band. */
1294
- export declare const DataTable: React$1.ForwardRefExoticComponent<DataTableProps & React$1.RefAttributes<HTMLDivElement>>;
1300
+ /** Enterprise data table: 48px rows, hairline dividers, mono header band. Generic over the row type (5.5): the
1301
+ * type of `rows` types every `render`, `sortValue`, `getRowHref` and `onRowActivate`. */
1302
+ export declare const DataTable: {
1303
+ (props: DataTableProps & {
1304
+ rows: readonly never[];
1305
+ } & React$1.RefAttributes<HTMLDivElement>): React$1.ReactElement | null;
1306
+ <Row extends Record<string, any> = Record<string, any>>(props: DataTableProps<Row> & React$1.RefAttributes<HTMLDivElement>): React$1.ReactElement | null;
1307
+ displayName?: string | undefined;
1308
+ };
1295
1309
  export declare const Card: React$1.ForwardRefExoticComponent<CardProps & React$1.RefAttributes<HTMLElement>>;
1296
1310
  export declare const Tabs: React$1.ForwardRefExoticComponent<TabsProps & React$1.RefAttributes<HTMLDivElement>>;
1297
1311
  /** Side navigation: sections of links or buttons, collapsible groups, counts and badges. Arrow keys move between items. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jirawatpyk/aura-tokens",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "AURA Design System — tokens (CSS variables, Tailwind preset, Figma variables), theme contrast checks and token lint.",
5
5
  "main": "tailwind.tokens.cjs",
6
6
  "types": "components/index.d.ts",
package/tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.4.0",
2
+ "version": "5.5.0",
3
3
  "meta": {
4
4
  "name": "AURA Design System",
5
5
  "tier": "3-tier",