@nanisoft/prism-ui 0.16.1 → 1.0.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.
Files changed (170) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/blocks/activity-feed-01/activity-feed-01.d.ts +120 -190
  3. package/dist/blocks/activity-feed-01/activity-feed-01.d.ts.map +1 -1
  4. package/dist/blocks/activity-feed-01/activity-feed-01.js +107 -97
  5. package/dist/blocks/activity-feed-01/index.d.ts +1 -1
  6. package/dist/blocks/activity-feed-01/index.d.ts.map +1 -1
  7. package/dist/blocks/auth-form-01/auth-form.d.ts +86 -53
  8. package/dist/blocks/auth-form-01/auth-form.d.ts.map +1 -1
  9. package/dist/blocks/auth-form-01/auth-form.js +95 -31
  10. package/dist/blocks/auth-form-01/index.d.ts +1 -1
  11. package/dist/blocks/auth-form-01/index.d.ts.map +1 -1
  12. package/dist/blocks/calendar-01/calendar.d.ts +28 -0
  13. package/dist/blocks/calendar-01/calendar.d.ts.map +1 -1
  14. package/dist/blocks/calendar-01/calendar.js +15 -1
  15. package/dist/blocks/card-index-01/card-index.d.ts +225 -0
  16. package/dist/blocks/card-index-01/card-index.d.ts.map +1 -0
  17. package/dist/blocks/card-index-01/card-index.js +154 -0
  18. package/dist/blocks/card-index-01/index.d.ts +3 -0
  19. package/dist/blocks/card-index-01/index.d.ts.map +1 -0
  20. package/dist/blocks/card-index-01/index.js +1 -0
  21. package/dist/blocks/chart-card-01/chart-card-01.d.ts +23 -21
  22. package/dist/blocks/chart-card-01/chart-card-01.d.ts.map +1 -1
  23. package/dist/blocks/chart-card-01/chart-card-01.js +46 -1
  24. package/dist/blocks/chart-card-01/index.d.ts +1 -1
  25. package/dist/blocks/chart-card-01/index.d.ts.map +1 -1
  26. package/dist/blocks/chart-group-01/chart-group-01.d.ts +3 -3
  27. package/dist/blocks/chart-group-01/chart-group-01.d.ts.map +1 -1
  28. package/dist/blocks/contact-01/contact.d.ts +30 -82
  29. package/dist/blocks/contact-01/contact.d.ts.map +1 -1
  30. package/dist/blocks/contact-01/contact.js +59 -30
  31. package/dist/blocks/contact-01/index.d.ts +1 -1
  32. package/dist/blocks/contact-01/index.d.ts.map +1 -1
  33. package/dist/blocks/dashboard-01/dashboard-01.d.ts +26 -71
  34. package/dist/blocks/dashboard-01/dashboard-01.d.ts.map +1 -1
  35. package/dist/blocks/dashboard-01/dashboard-01.js +34 -23
  36. package/dist/blocks/dashboard-01/index.d.ts +1 -1
  37. package/dist/blocks/dashboard-01/index.d.ts.map +1 -1
  38. package/dist/blocks/data-table-01/data-table.d.ts +276 -59
  39. package/dist/blocks/data-table-01/data-table.d.ts.map +1 -1
  40. package/dist/blocks/data-table-01/data-table.js +217 -35
  41. package/dist/blocks/data-table-01/index.d.ts +1 -1
  42. package/dist/blocks/data-table-01/index.d.ts.map +1 -1
  43. package/dist/blocks/directory-01/directory-01.d.ts +23 -2
  44. package/dist/blocks/directory-01/directory-01.d.ts.map +1 -1
  45. package/dist/blocks/directory-01/directory-01.js +3 -3
  46. package/dist/blocks/empty-state-01/empty-state.d.ts +60 -21
  47. package/dist/blocks/empty-state-01/empty-state.d.ts.map +1 -1
  48. package/dist/blocks/empty-state-01/empty-state.js +52 -17
  49. package/dist/blocks/index-detail-01/index-detail.d.ts +85 -0
  50. package/dist/blocks/index-detail-01/index-detail.d.ts.map +1 -0
  51. package/dist/blocks/index-detail-01/index-detail.js +58 -0
  52. package/dist/blocks/index-detail-01/index.d.ts +3 -0
  53. package/dist/blocks/index-detail-01/index.d.ts.map +1 -0
  54. package/dist/blocks/index-detail-01/index.js +1 -0
  55. package/dist/blocks/index.d.ts +20 -8
  56. package/dist/blocks/index.d.ts.map +1 -1
  57. package/dist/blocks/index.js +7 -0
  58. package/dist/blocks/issue-detail-01/issue-detail.d.ts +18 -0
  59. package/dist/blocks/issue-detail-01/issue-detail.d.ts.map +1 -1
  60. package/dist/blocks/issue-detail-01/issue-detail.js +18 -0
  61. package/dist/blocks/nothing-chosen-01/index.d.ts +3 -0
  62. package/dist/blocks/nothing-chosen-01/index.d.ts.map +1 -0
  63. package/dist/blocks/nothing-chosen-01/index.js +1 -0
  64. package/dist/blocks/nothing-chosen-01/nothing-chosen.d.ts +119 -0
  65. package/dist/blocks/nothing-chosen-01/nothing-chosen.d.ts.map +1 -0
  66. package/dist/blocks/nothing-chosen-01/nothing-chosen.js +79 -0
  67. package/dist/blocks/project-dashboard-01/index.d.ts +1 -1
  68. package/dist/blocks/project-dashboard-01/index.d.ts.map +1 -1
  69. package/dist/blocks/project-dashboard-01/project-dashboard.d.ts +21 -27
  70. package/dist/blocks/project-dashboard-01/project-dashboard.d.ts.map +1 -1
  71. package/dist/blocks/project-dashboard-01/project-dashboard.js +45 -5
  72. package/dist/blocks/provisioning-01/index.d.ts +1 -1
  73. package/dist/blocks/provisioning-01/index.d.ts.map +1 -1
  74. package/dist/blocks/provisioning-01/provisioning.d.ts +9 -97
  75. package/dist/blocks/provisioning-01/provisioning.d.ts.map +1 -1
  76. package/dist/blocks/provisioning-01/provisioning.js +26 -13
  77. package/dist/blocks/record-detail-01/index.d.ts +3 -0
  78. package/dist/blocks/record-detail-01/index.d.ts.map +1 -0
  79. package/dist/blocks/record-detail-01/index.js +1 -0
  80. package/dist/blocks/record-detail-01/record-detail.d.ts +239 -0
  81. package/dist/blocks/record-detail-01/record-detail.d.ts.map +1 -0
  82. package/dist/blocks/record-detail-01/record-detail.js +150 -0
  83. package/dist/blocks/record-form-01/index.d.ts +3 -0
  84. package/dist/blocks/record-form-01/index.d.ts.map +1 -0
  85. package/dist/blocks/record-form-01/index.js +1 -0
  86. package/dist/blocks/record-form-01/record-form.d.ts +148 -0
  87. package/dist/blocks/record-form-01/record-form.d.ts.map +1 -0
  88. package/dist/blocks/record-form-01/record-form.js +107 -0
  89. package/dist/blocks/record-grid-01/index.d.ts +3 -0
  90. package/dist/blocks/record-grid-01/index.d.ts.map +1 -0
  91. package/dist/blocks/record-grid-01/index.js +1 -0
  92. package/dist/blocks/record-grid-01/record-grid.d.ts +145 -0
  93. package/dist/blocks/record-grid-01/record-grid.d.ts.map +1 -0
  94. package/dist/blocks/record-grid-01/record-grid.js +114 -0
  95. package/dist/blocks/record-wizard-01/index.d.ts +3 -0
  96. package/dist/blocks/record-wizard-01/index.d.ts.map +1 -0
  97. package/dist/blocks/record-wizard-01/index.js +1 -0
  98. package/dist/blocks/record-wizard-01/record-wizard.d.ts +152 -0
  99. package/dist/blocks/record-wizard-01/record-wizard.d.ts.map +1 -0
  100. package/dist/blocks/record-wizard-01/record-wizard.js +144 -0
  101. package/dist/blocks/settings-members-01/settings-members.d.ts +2 -1
  102. package/dist/blocks/settings-members-01/settings-members.d.ts.map +1 -1
  103. package/dist/blocks/settings-panel-01/index.d.ts +1 -1
  104. package/dist/blocks/settings-panel-01/index.d.ts.map +1 -1
  105. package/dist/blocks/settings-panel-01/settings-panel.d.ts +165 -67
  106. package/dist/blocks/settings-panel-01/settings-panel.d.ts.map +1 -1
  107. package/dist/blocks/settings-panel-01/settings-panel.js +92 -33
  108. package/dist/blocks/signup-01/index.d.ts +1 -1
  109. package/dist/blocks/signup-01/index.d.ts.map +1 -1
  110. package/dist/blocks/signup-01/signup-01.d.ts +10 -84
  111. package/dist/blocks/signup-01/signup-01.d.ts.map +1 -1
  112. package/dist/blocks/signup-01/signup-01.js +41 -23
  113. package/dist/blocks/stats-01/index.d.ts +5 -5
  114. package/dist/blocks/stats-01/index.d.ts.map +1 -1
  115. package/dist/blocks/stats-01/index.js +4 -4
  116. package/dist/blocks/stats-01/stats.d.ts +49 -14
  117. package/dist/blocks/stats-01/stats.d.ts.map +1 -1
  118. package/dist/blocks/stats-01/stats.js +65 -15
  119. package/dist/blocks/trend-01/index.d.ts +1 -1
  120. package/dist/blocks/trend-01/index.d.ts.map +1 -1
  121. package/dist/blocks/trend-01/trend.d.ts +26 -73
  122. package/dist/blocks/trend-01/trend.d.ts.map +1 -1
  123. package/dist/blocks/trend-01/trend.js +47 -30
  124. package/dist/catalog.d.ts.map +1 -1
  125. package/dist/catalog.js +93 -3
  126. package/dist/components/ui/metric.d.ts +4 -2
  127. package/dist/components/ui/metric.d.ts.map +1 -1
  128. package/dist/index.d.ts +10 -0
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +6 -0
  131. package/dist/lib/field-render.d.ts +107 -0
  132. package/dist/lib/field-render.d.ts.map +1 -0
  133. package/dist/lib/field-render.js +251 -0
  134. package/dist/lib/spec.d.ts +609 -0
  135. package/dist/lib/spec.d.ts.map +1 -0
  136. package/dist/lib/spec.js +1 -0
  137. package/dist/live/index.d.ts +2 -0
  138. package/dist/live/index.d.ts.map +1 -1
  139. package/dist/live/index.js +6 -0
  140. package/dist/live/message-thread-01/index.d.ts +3 -0
  141. package/dist/live/message-thread-01/index.d.ts.map +1 -0
  142. package/dist/live/message-thread-01/index.js +1 -0
  143. package/dist/live/message-thread-01/message-thread.d.ts +282 -0
  144. package/dist/live/message-thread-01/message-thread.d.ts.map +1 -0
  145. package/dist/live/message-thread-01/message-thread.js +221 -0
  146. package/dist/live/run-stream-01/run-stream.d.ts +2 -1
  147. package/dist/live/run-stream-01/run-stream.d.ts.map +1 -1
  148. package/dist/live/run-stream-01/run-stream.js +1 -7
  149. package/dist/live/status.d.ts +27 -0
  150. package/dist/live/status.d.ts.map +1 -0
  151. package/dist/live/status.js +15 -0
  152. package/dist/live/tool-call-row.d.ts +26 -0
  153. package/dist/live/tool-call-row.d.ts.map +1 -0
  154. package/dist/live/tool-call-row.js +60 -0
  155. package/dist/live/tool-ledger-01/tool-ledger.d.ts.map +1 -1
  156. package/dist/live/tool-ledger-01/tool-ledger.js +2 -42
  157. package/dist/pages/contact-page/index.d.ts +7 -7
  158. package/dist/pages/contact-page/index.d.ts.map +1 -1
  159. package/dist/pages/contact-page/index.js +17 -5
  160. package/dist/pages/document-page/document-page.d.ts +146 -0
  161. package/dist/pages/document-page/document-page.d.ts.map +1 -0
  162. package/dist/pages/document-page/document-page.js +80 -0
  163. package/dist/pages/document-page/index.d.ts +3 -0
  164. package/dist/pages/document-page/index.d.ts.map +1 -0
  165. package/dist/pages/document-page/index.js +1 -0
  166. package/dist/pages/index.d.ts +2 -0
  167. package/dist/pages/index.d.ts.map +1 -1
  168. package/dist/pages/index.js +6 -0
  169. package/dist/styles.css +35 -3
  170. package/package.json +7 -2
@@ -1,19 +1,9 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type HeadingLevel } from '../../components/ui/section.js';
3
+ import { type TableSortDirection } from '../../components/ui/table-sort.js';
4
+ import type { ColumnSpec } from '../../lib/spec.js';
3
5
  /** One row of data. Identity comes from `getRowId`, not from the shape. */
4
6
  export type DataTableRow = Record<string, unknown>;
5
- export type DataTableColumn = {
6
- /** Stable identifier, used for keys and the visibility menu. */
7
- id: string;
8
- /** The column heading. */
9
- header: ReactNode;
10
- /** Renders the cell for one row. */
11
- cell: (row: DataTableRow) => ReactNode;
12
- /** A plain-text name for the visibility menu. Falls back to `id`. */
13
- label?: string;
14
- /** Layout classes, for alignment or a fixed width. */
15
- className?: string;
16
- };
17
7
  export type DataTableFilterOption = {
18
8
  label: string;
19
9
  value: string;
@@ -23,15 +13,25 @@ export type DataTableFilter = {
23
13
  label: string;
24
14
  options: DataTableFilterOption[];
25
15
  };
26
- export type DataTableRowAction = {
27
- label: string;
28
- variant?: 'default' | 'destructive';
29
- onSelect?: () => void;
16
+ /**
17
+ * The one column the block orders its rows by, or `null` for the caller's own order.
18
+ *
19
+ * One column and one direction, because two headers each reporting an order is a
20
+ * table claiming to be sorted two ways at once. The value is reported through
21
+ * `onSortChange` and never derived: the block does not sort, because it cannot know
22
+ * whether a column is a number, a date or a name, and it never reorders the rows it
23
+ * was handed.
24
+ */
25
+ export type DataTableSort = {
26
+ /** The `key` of the column that is ordered. */
27
+ column: string;
28
+ /** Which way it is ordered. */
29
+ direction: TableSortDirection;
30
30
  };
31
31
  /**
32
32
  * Every string the block renders. Required because the block ships no copy of
33
- * its own: a control hint, a selection summary and an empty-state line are the
34
- * consumer's to write.
33
+ * its own: a control hint, a selection summary, a per row name and an
34
+ * empty-state line are the consumer's to write.
35
35
  */
36
36
  export type DataTable01Labels = {
37
37
  /** Search field placeholder and accessible name. */
@@ -43,53 +43,153 @@ export type DataTable01Labels = {
43
43
  /** Headings for the column chooser. */
44
44
  columns: string;
45
45
  viewColumns: string;
46
+ /** The header's selection control, naming the page it covers. */
46
47
  selectAll: string;
47
- selectRow: string;
48
+ /**
49
+ * The name of one row's selection control, in the caller's words.
50
+ *
51
+ * A function of the row rather than a string, because a checkbox announced as
52
+ * "Select row" on all forty rows is a checkbox no reader can tell from the one
53
+ * below it. The name must name the record this checkbox ticks.
54
+ */
55
+ selectRow: (row: DataTableRow) => string;
56
+ /** The trailing cell's accessible name, when per-row actions are supplied. */
48
57
  rowActions: string;
58
+ /** The words read for what pressing a sortable header will do. */
59
+ sort: (column: string, direction: TableSortDirection) => string;
60
+ /**
61
+ * The selection summary and the announced number for the page scope.
62
+ *
63
+ * It should say the page, in the caller's words, because "24 selected" over a
64
+ * table of twenty four rows is true and says nothing about whether there are
65
+ * more: the page is the one population this Block can count for itself.
66
+ */
67
+ selectedCount: (count: number) => string;
68
+ /**
69
+ * The selection summary and the announced number for the filter scope.
70
+ *
71
+ * Used when the caller reports that the whole matching population is selected
72
+ * through `selectionScope`, and it takes the caller's own `count` rather than
73
+ * the number of rows on screen. It should announce the scope in words, because
74
+ * the population is one this Block never fetched: a summary reading "12
75
+ * selected" over a table of twelve rows and four thousand matching is a number
76
+ * that is false, and neither a sighted reader nor a screen reader can detect it.
77
+ */
78
+ selectedAllMatching: (count: number) => string;
79
+ /**
80
+ * The sentence spoken when the selection empties.
81
+ *
82
+ * Not a count of zero: "0 selected" is a number the reader already heard and says
83
+ * nothing about why the batch bar has gone. The emptying is its own sentence.
84
+ */
85
+ clearedSelection: string;
86
+ /** The accessible name of the batch bar's dismiss control. */
87
+ dismissSelection: string;
49
88
  previous: string;
50
89
  next: string;
51
90
  /** Accessible name for one page control. */
52
91
  page: (page: number) => string;
53
- /** The selection summary. */
54
- selectedCount: (count: number) => string;
55
92
  /** Shown in the body when `rows` is empty and `emptyMessage` is not set. */
56
93
  empty: string;
57
94
  };
58
- export type DataTable01Props = {
95
+ /**
96
+ * Grouping, expressed as a key on a row rather than as a second arrangement.
97
+ *
98
+ * A body is flat unless the caller asks otherwise, and the caller asks in one
99
+ * line: `groupBy` takes a row and returns the key it belongs to, and the block
100
+ * draws a heading in the same body above each run of rows that shares a key. It
101
+ * never reorders the rows it was handed, so contiguous rows with one key are one
102
+ * group and the caller's order is the only order. A row whose key is `undefined`
103
+ * is ungrouped and draws no heading.
104
+ *
105
+ * `groupLabel` is required wherever `groupBy` is set, because a heading with no
106
+ * words is a blank row; it is the one thing the block cannot compose, in the same
107
+ * way a per-row checkbox name is.
108
+ *
109
+ * **A heading is not a record, and the two facts follow from that.** A heading is
110
+ * a row in the same body as any other, so it is content rather than a second
111
+ * region, and it is never in the selection set, never in the count and never what
112
+ * the header's page scope counts: a body of forty headings over four hundred rows
113
+ * selects four hundred records and says so. The header's control is built from
114
+ * `rows` and `getRowId` alone, so it reaches a heading in no arrangement.
115
+ */
116
+ type DataTable01GroupingProps = {
117
+ /** Absent for an index that draws a flat body. */
118
+ groupBy?: undefined;
119
+ /** Absent for an index that draws a flat body. */
120
+ groupLabel?: never;
121
+ } | {
122
+ /**
123
+ * The key a row belongs to, or `undefined` for a row with no group.
124
+ *
125
+ * It is a key rather than a heading so that the block stays out of the
126
+ * caller's copy and out of its ordering, and so that a heading and the rows
127
+ * under it can never disagree about which group a record is in.
128
+ */
129
+ groupBy: (row: DataTableRow) => string | undefined;
130
+ /** The heading for one group key, drawn in a full-width row above the group. */
131
+ groupLabel: (key: string) => ReactNode;
132
+ };
133
+ /**
134
+ * Which population the current selection covers, because the two are announced
135
+ * differently.
136
+ *
137
+ * A selection of everything on the page is one the block can count, so the page
138
+ * arm needs nothing beyond the selection set and the block announces
139
+ * `labels.selectedCount`. A selection of everything matching the current filter
140
+ * is a population the block never fetched, so the filter arm carries the number
141
+ * from the caller and the block announces `labels.selectedAllMatching` instead of
142
+ * printing the page as if it were the total. The filter arm's `count` is
143
+ * required, because the one thing the summary must never do is derive a total
144
+ * from the rows on screen.
145
+ *
146
+ * It is a fact about the selection rather than a rule the block evaluates: the
147
+ * caller selects the population in its own store, reports it here and passes the
148
+ * number it already holds.
149
+ */
150
+ export type DataTable01SelectionScope = {
151
+ scope: 'page';
152
+ } | {
153
+ scope: 'filter';
154
+ /**
155
+ * How many records match the current filter, in the caller's own count.
156
+ *
157
+ * Required, and never derived from the rows: the block holds one page and a
158
+ * count over that page says nothing about the population the reader asked
159
+ * for.
160
+ */
161
+ count: number;
162
+ };
163
+ /** The props every arm of the block shares, selection aside. */
164
+ type DataTable01SharedProps = {
59
165
  title?: ReactNode;
60
166
  description?: ReactNode;
61
- columns: DataTableColumn[];
62
- /** The rows for the current page. The block renders them; it never fetches. */
63
- rows: DataTableRow[];
64
- /** Returns a stable identity for a row. */
65
- getRowId: (row: DataTableRow) => string;
66
- /** Names the table for assistive technology when no heading does. */
67
- caption?: ReactNode;
68
167
  /**
69
- * Heading level for the table's own heading. @defaultValue 'h2'
168
+ * The columns, as typed data from the shared column specification.
70
169
  *
71
- * A prop for the reason every Block's is: the surrounding document decides where
72
- * this lands in the outline, not the Block. The heading was a hard-coded `<h2>`,
73
- * and this is a Block that a product puts inside a settings page or a drawer as
74
- * readily as it puts at the top of a page, where a fixed level makes the table a
75
- * sibling of the section it belongs to.
170
+ * `key`, `header` and `kind` are required on each one, and the whole list is
171
+ * drawn in the order it is written. The block never reorders, hides or drops a
172
+ * column the caller did not hide through the column chooser.
173
+ */
174
+ columns: readonly ColumnSpec[];
175
+ /** The rows for the current page. The block renders them; it never fetches. */
176
+ rows: readonly DataTableRow[];
177
+ /**
178
+ * Returns a stable identity for a row.
76
179
  *
77
- * It decides the size as well as the tag, because the Block asks
78
- * `headingSizeClass` for it rather than naming a step. It wrote `text-lg` here,
79
- * so a table composed as a page's `h2` and one composed as an `h3` drew their
80
- * titles at the same size, which is the one-size defect inside a single Block:
81
- * forwarding the level changed nothing a reader could see. The other two halves
82
- * of the heading come with it, because the ladder states weight, tracking and
83
- * balance as one package and `SectionHeading` carries all three at every rung: a
84
- * title that moved from 18 pixels to 36 is worse unwrapped than the 18 pixel one
85
- * it replaced.
180
+ * Required rather than optional, because sorting, filtering, paging and deleting
181
+ * all move a row's index, so an index-keyed selection silently changes which
182
+ * records a batch action acts on.
86
183
  */
184
+ getRowId: (row: DataTableRow) => string;
185
+ /** Names the table for assistive technology when no heading does. */
186
+ caption?: ReactNode;
187
+ /** Heading level for the table's own heading. @defaultValue 'h2' */
87
188
  headingLevel?: HeadingLevel;
88
- /** Adds the selection column and the selection summary. */
89
- selectable?: boolean;
90
- selectedIds?: string[];
91
- defaultSelectedIds?: string[];
92
- onSelectedIdsChange?: (ids: string[]) => void;
189
+ /** The column and direction the caller wants ordered, or `null` for no order. */
190
+ sort?: DataTableSort | null;
191
+ /** Called with the next order when a sortable header is pressed. */
192
+ onSortChange?: (sort: DataTableSort | null) => void;
93
193
  searchValue?: string;
94
194
  onSearchChange?: (value: string) => void;
95
195
  filters?: DataTableFilter[];
@@ -101,23 +201,140 @@ export type DataTable01Props = {
101
201
  /** How many pages exist. At least 1. */
102
202
  pageCount: number;
103
203
  onPageChange?: (page: number) => void;
104
- /** The per-row action menu. Return an empty array to omit the menu. */
105
- rowActions?: (row: DataTableRow) => DataTableRowAction[];
204
+ /**
205
+ * The caller's own node for one row's trailing cell.
206
+ *
207
+ * A node per row rather than a declared action list, because a block ships no
208
+ * behaviour and a row that looks like a command but carries none is a control a
209
+ * reader can focus and cannot act on. The caller composes `OverflowActions`,
210
+ * `DropdownMenu` or `CtaLink`, and the block draws the cell and nothing inside it.
211
+ */
212
+ renderRowActions?: (row: DataTableRow) => ReactNode;
106
213
  /** Controls rendered at the end of the toolbar, e.g. a create Button. */
107
214
  toolbarActions?: ReactNode;
108
215
  /** Replaces the fallback empty line. */
109
216
  emptyMessage?: ReactNode;
110
217
  labels: DataTable01Labels;
111
- };
218
+ } & DataTable01GroupingProps;
112
219
  /**
113
- * A table section with a toolbar, filters, row selection and pagination.
220
+ * The record index, which owns a set of row keys and reports every change.
221
+ *
222
+ * The two arms make the contract the type's: a selectable index must be handed the
223
+ * callback that reports a change and the node the batch bar holds, and a plain table
224
+ * may be handed neither, because a tick with nowhere to report is a checkbox that
225
+ * changes nothing a caller can hear.
226
+ */
227
+ export type DataTable01Props = (DataTable01SharedProps & {
228
+ selectable?: false;
229
+ selectedIds?: never;
230
+ defaultSelectedIds?: never;
231
+ onSelectedIdsChange?: never;
232
+ batchActions?: never;
233
+ selectionScope?: never;
234
+ }) | (DataTable01SharedProps & {
235
+ selectable: true;
236
+ /** The selected keys, controlled. Omit it and the block holds the set. */
237
+ selectedIds?: readonly string[];
238
+ /** The selected keys the in-heart set starts from. */
239
+ defaultSelectedIds?: readonly string[];
240
+ /**
241
+ * Called with the whole set after every change, whether or not the caller is
242
+ * listening, so mirroring it costs one line and ignoring it costs zero.
243
+ */
244
+ onSelectedIdsChange: (ids: string[]) => void;
245
+ /**
246
+ * The caller's own controls for the batch bar, mounted only while a selection
247
+ * exists. The block draws the frame, the count and the dismiss and places this
248
+ * node; it never draws a command of its own.
249
+ */
250
+ batchActions: ReactNode;
251
+ /**
252
+ * Which population the selection covers. Absent means the page.
253
+ *
254
+ * The caller reports it when its own selection is the whole matching
255
+ * population rather than the rows on screen, and passes that population's
256
+ * count on the filter arm. The block owns no control that selects it: it
257
+ * holds one page and cannot reach the rest, so the caller selects in its own
258
+ * store and tells the block what it selected.
259
+ */
260
+ selectionScope?: DataTable01SelectionScope;
261
+ });
262
+ /**
263
+ * The record index: a table of rows a reader scans and acts on.
264
+ *
265
+ * It draws the page of rows it was handed for the page it was told about, and it
266
+ * fetches nothing, sorts nothing, filters nothing and slices nothing. `columns` is
267
+ * the shared `ColumnSpec` typed data rather than a render function per column, so
268
+ * alignment, width, the header and the sort affordance are drawn once for every
269
+ * consumer. `getRowId` is required, because a row's position moves under sorting,
270
+ * filtering and paging and an index-keyed selection would act on the wrong records.
271
+ *
272
+ * **It is also the log and the event stream, drawing event rows from the shared event
273
+ * specification.** A consumer composing a delivery log or a console events screen
274
+ * passes the same `EventSpec` values an activity trail takes, and draws columns from
275
+ * them: the sending process in `actor`, the event type in `action`, the endpoint in
276
+ * `target`, the payload in a `CodeBlock` cell the caller composes, and the response
277
+ * status in a `Status` cell the caller composes rather than declared as a member,
278
+ * because the event specification has no kind and no severity. A log is a different
279
+ * job from the trail on the arrangement signal: it gains a filter region the trail
280
+ * does not draw, a second axis on which entries are compared, and a page boundary in
281
+ * place of a silent limit, and every one of those belongs to this Block rather than
282
+ * to a rail. So a screen that wants the events of one record composes
283
+ * `ActivityFeed01`, a screen that wants to find one entry among many composes this
284
+ * Block, and there is no second log Item beside it.
285
+ *
286
+ * **The Block composes no disclosure.** Seeing one entry in full is a destination the
287
+ * caller names with its required words, expanding a payload in place is the caller's
288
+ * own `Collapsible` placed in a `slot` cell, and taking an identifier away is the
289
+ * caller's own control composed beside a code block. A control whose handler arrives
290
+ * through a spread of unknown shape reads as carrying no handler, so the escape for a
291
+ * per-entry action is the `renderRowActions` node rather than a spread.
292
+ *
293
+ * **It draws no retention window, no archive, no purge, no legal hold and no export**,
294
+ * and no immutability mark, no time axis, no live tail, no aggregate over the
295
+ * population and no command of its own. A filter is a narrowing the caller passed and
296
+ * the Block states nothing about what is behind it. Row selection exists so the caller
297
+ * can drive a command against its own store.
298
+ *
299
+ * **It holds the selection set it was given, and reports every change.** This is the
300
+ * one piece of state a block in this repository keeps, and it is scoped by what the
301
+ * state is: a set of keys the caller passed for the page about to be drawn. Nothing
302
+ * in the block fetches, derives from application state or decides. A consumer that
303
+ * wants the set mirrored passes `selectedIds` and writes one line in
304
+ * `onSelectedIdsChange`; a consumer that wants nothing passes neither and the block
305
+ * still draws the tick, the header's three-state control, the count, the batch bar
306
+ * and the announcement.
307
+ *
308
+ * **The count is announced once, politely.** One `LiveRegion` at `polite` carries the
309
+ * count and is never assertive, and it is mounted while there is an announcement
310
+ * rather than always, so its appearance is the first thing spoken rather than a
311
+ * silent mutation of a node that was always there. It announces the count and never
312
+ * a list of labels, because each row's own checkbox already names its record. When
313
+ * the set empties, the region speaks its own sentence rather than a count of zero.
314
+ * The visible summary in the footer and the announced count are the same string.
315
+ *
316
+ * **The batch bar is the block's region and the caller's controls.** It mounts only
317
+ * while the set is non-empty, displaces the filter controls rather than sitting
318
+ * beside them, and holds one required `batchActions` node the caller wrote plus the
319
+ * block's own dismiss. The dismiss is the only control the block draws, and its whole
320
+ * body is the same report every tick makes with an empty set.
321
+ *
322
+ * **Per-row actions are a node per row.** The block draws the trailing cell and
323
+ * places `renderRowActions(row)` inside it, so a row that navigates and a row that is
324
+ * ticked are two separately reachable targets and the block owns no command.
325
+ *
326
+ * **Grouping is a key on a row, not a second arrangement.** `groupBy` returns the key
327
+ * a row belongs to and the block draws `groupLabel(key)` in a full-width row above
328
+ * each run of rows that shares one, in the caller's own order. A heading is a row in
329
+ * the same body as any other and it is not a record: it is never in the selection
330
+ * set, never in the count and never what the header's page scope counts.
114
331
  *
115
- * The block renders exactly the rows it is given for the current page and
116
- * reports every interaction through a callback. It performs no filtering,
117
- * sorting or fetching of its own: the page, the search text, the filter values
118
- * and the selection are the consumer's state, so a server-rendered page and a
119
- * client data layer can each drive it. Every label is a prop.
332
+ * **The two selection scopes are announced differently.** A page-wide selection is
333
+ * one the block can count, so it speaks `labels.selectedCount`. A filter-wide
334
+ * selection is a population the block never fetched, so the caller reports it
335
+ * through `selectionScope` and the block speaks `labels.selectedAllMatching` with the
336
+ * caller's own number rather than printing the page as if it were the total.
120
337
  */
121
- export declare function DataTable01({ title, description, columns, rows, getRowId, caption, selectable, selectedIds, defaultSelectedIds, onSelectedIdsChange, searchValue, onSearchChange, filters, filterValues, onFilterChange, page: pageProp, defaultPage, pageCount, onPageChange, rowActions, toolbarActions, emptyMessage, labels, headingLevel, }: DataTable01Props): import("react").JSX.Element;
338
+ export declare function DataTable01(props: DataTable01Props): import("react").JSX.Element;
122
339
  export default DataTable01;
123
340
  //# sourceMappingURL=data-table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../../src/blocks/data-table-01/data-table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAgBjE,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAWjF,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAA;IACV,0BAA0B;IAC1B,MAAM,EAAE,SAAS,CAAA;IACjB,oCAAoC;IACpC,IAAI,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,SAAS,CAAA;IACtC,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpE,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,qBAAqB,EAAE,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;I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CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACjD,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAA;IAChE,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,kBAAkB,EAAE,CAAA;IACxD,yEAAyE;IACzE,cAAc,CAAC,EAAE,SAAS,CAAA;IAC1B,wCAAwC;IACxC,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,MAAM,EAAE,iBAAiB,CAAA;CAC1B,CAAA;AAmDD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,WAAW,EACX,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,UAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,OAAO,EACP,YAAY,EACZ,cAAc,EACd,IAAI,EAAE,QAAQ,EACd,WAAe,EACf,SAAS,EACT,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,MAAM,EACN,YAAmB,GACpB,EAAE,gBAAgB,+BAkUlB;AAED,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../../src/blocks/data-table-01/data-table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAqE,KAAK,SAAS,EAAE,MAAM,OAAO,CAA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