@dloizides/ui-tables 1.3.1 → 1.4.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/CHANGELOG.md +18 -0
- package/README.md +32 -0
- package/dist/index.d.mts +107 -4
- package/dist/index.d.ts +107 -4
- package/dist/index.js +91 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -74
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- **Pixel-perfect overrides** (additive, backward-compatible). The kit's defaults are
|
|
6
|
+
opinionated but never mandatory — a consumer that must match an existing look can now
|
|
7
|
+
do so without forking:
|
|
8
|
+
- `DataTable` gains `styleOverrides?: DataTableStyleOverrides` (slots: `wrap`, `headRow`,
|
|
9
|
+
`headCell`, `row`, `cell`, `numCell`, `state`, `stateText`, `rowDetail`, `card`,
|
|
10
|
+
`cardLine`, `cardLabel`, `cardValue`).
|
|
11
|
+
- `Pager` gains `styleOverrides?: PagerStyleOverrides` (slots: `pager`, `pagerInfo`,
|
|
12
|
+
`pagerNav`, `pagerRowsLabel`, `sizeGroup`, `control`, `controlText`, `sizePill`,
|
|
13
|
+
`sizePillText`).
|
|
14
|
+
- `FilterBar` gains `styleOverrides?: FilterBarStyleOverrides` (slots: `filters`,
|
|
15
|
+
`filtersSpacer`, `results`, `filtersActions`).
|
|
16
|
+
- Each slot is merged **LAST** into its style array, so an override beats the base
|
|
17
|
+
StyleSheet **and** the inline colour the component applies from `useUi().theme`
|
|
18
|
+
(colours are never in the StyleSheet in this kit).
|
|
19
|
+
- Documented: `stackBreakpoint={0}` disables the responsive card-stack (`width < 0` is
|
|
20
|
+
never true), for surfaces that never had one.
|
|
21
|
+
- Omit `styleOverrides` and every render is byte-identical to before (verified by test).
|
|
22
|
+
|
|
5
23
|
- `DataTable` — **expandable rows** (additive, backward-compatible). Two new optional props:
|
|
6
24
|
- `renderRowDetail?: (row: T) => React.ReactNode` — renders a full-width detail panel
|
|
7
25
|
(spanning every column) directly beneath a row, between it and the next row. Works in
|
package/README.md
CHANGED
|
@@ -57,6 +57,38 @@ with the exported `rowDetailTestID(tableTestID, key)` (rows: `rowTestID(tableTes
|
|
|
57
57
|
exposed to assistive tech as a labelled region (provide the `uiTables.rowDetail` key), and the row
|
|
58
58
|
reports `aria-expanded`. Omit both props and nothing about the table changes.
|
|
59
59
|
|
|
60
|
+
#### Pixel-perfect overrides (optional)
|
|
61
|
+
|
|
62
|
+
**The defaults are opinionated but never mandatory.** When a surface must match an existing
|
|
63
|
+
look exactly, pass `styleOverrides` — a per-slot map that is merged **LAST** into each slot's
|
|
64
|
+
style array, so it beats both the base StyleSheet **and** the inline theme colours (this kit
|
|
65
|
+
keeps colours out of the StyleSheet and applies them from `useUi().theme` at render time, so
|
|
66
|
+
an override that only beat the base would still lose to the theme).
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import type { DataTableStyleOverrides } from '@dloizides/ui-tables';
|
|
70
|
+
|
|
71
|
+
const overrides: DataTableStyleOverrides = {
|
|
72
|
+
wrap: { borderRadius: 10 }, // beats the kit's 12 (base StyleSheet)
|
|
73
|
+
headRow: { backgroundColor: theme.surfaceMuted }, // beats theme.colors.background (INLINE colour)
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
<DataTable columns={columns} rows={rows} keyExtractor={(r) => r.id}
|
|
77
|
+
stackBreakpoint={0} // ← keeps the desktop grid at EVERY width (no card-stack)
|
|
78
|
+
styleOverrides={overrides} />
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
| Component | Type | Slots |
|
|
82
|
+
|-----------|------|-------|
|
|
83
|
+
| `DataTable` | `DataTableStyleOverrides` | `wrap`, `headRow`, `headCell`, `row`, `cell`, `numCell`, `state`, `stateText`, `rowDetail`, `card`, `cardLine`, `cardLabel`, `cardValue` |
|
|
84
|
+
| `Pager` | `PagerStyleOverrides` | `pager`, `pagerInfo`, `pagerNav`, `pagerRowsLabel`, `sizeGroup`, `control`, `controlText`, `sizePill`, `sizePillText` |
|
|
85
|
+
| `FilterBar` | `FilterBarStyleOverrides` | `filters`, `filtersSpacer`, `results`, `filtersActions` |
|
|
86
|
+
|
|
87
|
+
**Disabling the card-stack**: the label:value card-stack renders when `width < stackBreakpoint`,
|
|
88
|
+
so `stackBreakpoint={0}` (never true) keeps the desktop grid at every width — the opt-out for a
|
|
89
|
+
consumer whose table never had a card-stack. Omit `styleOverrides` entirely and every component
|
|
90
|
+
renders exactly as it always has.
|
|
91
|
+
|
|
60
92
|
Colours come entirely from `useUi().theme` (drive it with `@dloizides/design-tokens` via `tokensToUiTheme`), so the grid re-themes per tenant. Every component-authored string is routed through the UiProvider `t` — provide the `uiTables.*` keys (see `TABLE_I18N`) in your locale files; a caller may also pass already-translated `loadingLabel` / `emptyLabel` / `resultsLabel` directly.
|
|
61
93
|
|
|
62
94
|
## Install
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* StatCard — a single labelled metric tile (label + formatted numeric value).
|
|
@@ -18,6 +19,43 @@ declare const StatCard: React.MemoExoticComponent<({ label, value, testID }: Sta
|
|
|
18
19
|
* UiProvider `t` inside the components — no literals baked into the render.
|
|
19
20
|
*/
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Per-slot style overrides for the DataTable, merged **LAST** into each slot's style
|
|
24
|
+
* array so the consumer always wins — over the base StyleSheet AND over the inline
|
|
25
|
+
* colour the component applies from `useUi().theme` (the kit keeps colours out of the
|
|
26
|
+
* StyleSheet, so an override that only beat the base would still lose to the theme).
|
|
27
|
+
*
|
|
28
|
+
* The shared defaults are opinionated but never mandatory: omit `styleOverrides` and
|
|
29
|
+
* the table renders exactly as it always has.
|
|
30
|
+
*/
|
|
31
|
+
interface DataTableStyleOverrides {
|
|
32
|
+
/** The bordered, rounded table frame (border radius / border colour / surface). */
|
|
33
|
+
wrap?: StyleProp<ViewStyle>;
|
|
34
|
+
/** The desktop header row (its background comes from `theme.colors.background`). */
|
|
35
|
+
headRow?: StyleProp<ViewStyle>;
|
|
36
|
+
/** A desktop header cell. */
|
|
37
|
+
headCell?: StyleProp<TextStyle>;
|
|
38
|
+
/** A desktop body row. */
|
|
39
|
+
row?: StyleProp<ViewStyle>;
|
|
40
|
+
/** The `<Text>` of a cell whose column renders a string/number (both branches). */
|
|
41
|
+
cell?: StyleProp<TextStyle>;
|
|
42
|
+
/** Extra layer applied to numeric cells, after `cell`. */
|
|
43
|
+
numCell?: StyleProp<TextStyle>;
|
|
44
|
+
/** The loading / empty state container. */
|
|
45
|
+
state?: StyleProp<ViewStyle>;
|
|
46
|
+
/** The loading / empty state text. */
|
|
47
|
+
stateText?: StyleProp<TextStyle>;
|
|
48
|
+
/** The full-width detail panel under an expanded row. */
|
|
49
|
+
rowDetail?: StyleProp<ViewStyle>;
|
|
50
|
+
/** A card in the responsive card-stack (below `stackBreakpoint`). */
|
|
51
|
+
card?: StyleProp<ViewStyle>;
|
|
52
|
+
/** One label:value line inside a card. */
|
|
53
|
+
cardLine?: StyleProp<ViewStyle>;
|
|
54
|
+
/** The label of a card line. */
|
|
55
|
+
cardLabel?: StyleProp<TextStyle>;
|
|
56
|
+
/** The value container of a card line. */
|
|
57
|
+
cardValue?: StyleProp<ViewStyle>;
|
|
58
|
+
}
|
|
21
59
|
interface DataTableColumn<T> {
|
|
22
60
|
/** Stable column id (used for React keys + per-cell test ids). */
|
|
23
61
|
key: string;
|
|
@@ -62,8 +100,19 @@ interface DataTableProps<T> {
|
|
|
62
100
|
loadingLabel?: string;
|
|
63
101
|
/** Empty text (already translated). Falls back to the kit's `empty` translation. */
|
|
64
102
|
emptyLabel?: string;
|
|
65
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Below this width (px) rows collapse to a label:value card. Default 640.
|
|
105
|
+
*
|
|
106
|
+
* **Opt out of the card-stack entirely with `stackBreakpoint={0}`**: the stack is
|
|
107
|
+
* chosen by `width < stackBreakpoint`, which is never true for 0, so the desktop
|
|
108
|
+
* grid renders at every width. Use it when your surface never had a card-stack.
|
|
109
|
+
*/
|
|
66
110
|
stackBreakpoint?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Per-slot style overrides, merged LAST so the consumer always wins — including over
|
|
113
|
+
* the inline colours taken from `useUi().theme`. Omit for the shared defaults.
|
|
114
|
+
*/
|
|
115
|
+
styleOverrides?: DataTableStyleOverrides;
|
|
67
116
|
testID?: string;
|
|
68
117
|
}
|
|
69
118
|
|
|
@@ -76,11 +125,15 @@ interface DataTableProps<T> {
|
|
|
76
125
|
* - sticky header (`stickyHeader`), zebra striping (`zebra`), per-row tint.
|
|
77
126
|
* - a responsive label:value **card-stack** below `stackBreakpoint` via
|
|
78
127
|
* `useWindowDimensions` (the CSS `data-label` card-stack does not port).
|
|
128
|
+
* Pass `stackBreakpoint={0}` to keep the desktop grid at every width.
|
|
79
129
|
* - per-row `testID` + `accessibilityLabel`/`accessibilityHint` (kit standard).
|
|
80
130
|
* - optional CONTROLLED expandable rows: `renderRowDetail` + `expandedRowKeys`
|
|
81
131
|
* render a full-width detail panel between an expanded row and the next
|
|
82
132
|
* (desktop and card-stack alike). Omit both and the table renders exactly as
|
|
83
133
|
* it did before the feature existed.
|
|
134
|
+
* - optional per-slot `styleOverrides`, merged LAST so a consumer that needs to be
|
|
135
|
+
* pixel-perfect beats both the base StyleSheet and the inline theme colour. The
|
|
136
|
+
* shared defaults never change for anyone who does not opt in.
|
|
84
137
|
* - every colour from `useUi().theme`; every component-authored string via `t`.
|
|
85
138
|
*/
|
|
86
139
|
|
|
@@ -94,6 +147,21 @@ declare function DataTable<T>(props: DataTableProps<T>): React.ReactElement;
|
|
|
94
147
|
* ui-forms), keeping this reusable across every grid rather than coverage-specific.
|
|
95
148
|
*/
|
|
96
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Per-slot style overrides for the FilterBar, merged **LAST** into each slot's style
|
|
152
|
+
* array so the consumer always wins — over the base StyleSheet AND over the inline
|
|
153
|
+
* colours taken from `useUi().theme`. Omit for the shared defaults (nothing changes).
|
|
154
|
+
*/
|
|
155
|
+
interface FilterBarStyleOverrides {
|
|
156
|
+
/** The bordered, rounded filter shell. */
|
|
157
|
+
filters?: StyleProp<ViewStyle>;
|
|
158
|
+
/** The flex spacer that pushes the count + actions right. */
|
|
159
|
+
filtersSpacer?: StyleProp<ViewStyle>;
|
|
160
|
+
/** The `<b>N</b> results` count line. */
|
|
161
|
+
results?: StyleProp<TextStyle>;
|
|
162
|
+
/** The right-aligned actions cluster. */
|
|
163
|
+
filtersActions?: StyleProp<ViewStyle>;
|
|
164
|
+
}
|
|
97
165
|
interface FilterBarProps {
|
|
98
166
|
/** The filter fields (labels + inputs), supplied by the app / ui-forms. */
|
|
99
167
|
children?: React.ReactNode;
|
|
@@ -103,9 +171,14 @@ interface FilterBarProps {
|
|
|
103
171
|
resultsLabel?: string;
|
|
104
172
|
/** Right-aligned action buttons (Apply, Export CSV, …). */
|
|
105
173
|
actions?: React.ReactNode;
|
|
174
|
+
/**
|
|
175
|
+
* Per-slot style overrides, merged LAST so the consumer always wins — including over
|
|
176
|
+
* the inline theme colours. Omit for the shared defaults.
|
|
177
|
+
*/
|
|
178
|
+
styleOverrides?: FilterBarStyleOverrides;
|
|
106
179
|
testID?: string;
|
|
107
180
|
}
|
|
108
|
-
declare function FilterBar({ children, resultsCount, resultsLabel, actions, testID, }: FilterBarProps): React.ReactElement;
|
|
181
|
+
declare function FilterBar({ children, resultsCount, resultsLabel, actions, styleOverrides: o, testID, }: FilterBarProps): React.ReactElement;
|
|
109
182
|
|
|
110
183
|
/**
|
|
111
184
|
* Pager — the shared pagination control from GRID.md (`.ui-pager`): page-info on
|
|
@@ -115,6 +188,31 @@ declare function FilterBar({ children, resultsCount, resultsLabel, actions, test
|
|
|
115
188
|
* everything is themed from `useUi().theme` and labelled via the UiProvider `t`.
|
|
116
189
|
*/
|
|
117
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Per-slot style overrides for the Pager, merged **LAST** into each slot's style array
|
|
193
|
+
* so the consumer always wins — over the base StyleSheet AND over the inline colours
|
|
194
|
+
* taken from `useUi().theme`. Omit for the shared defaults (nothing changes).
|
|
195
|
+
*/
|
|
196
|
+
interface PagerStyleOverrides {
|
|
197
|
+
/** The outer pager row. */
|
|
198
|
+
pager?: StyleProp<ViewStyle>;
|
|
199
|
+
/** The `from–to of N` count line. */
|
|
200
|
+
pagerInfo?: StyleProp<TextStyle>;
|
|
201
|
+
/** The right-hand nav cluster (rows-per-page + Prev/Next). */
|
|
202
|
+
pagerNav?: StyleProp<ViewStyle>;
|
|
203
|
+
/** The "Rows" caption before the size pills. */
|
|
204
|
+
pagerRowsLabel?: StyleProp<TextStyle>;
|
|
205
|
+
/** The rows-per-page pill group. */
|
|
206
|
+
sizeGroup?: StyleProp<ViewStyle>;
|
|
207
|
+
/** A Prev/Next button. */
|
|
208
|
+
control?: StyleProp<ViewStyle>;
|
|
209
|
+
/** A Prev/Next button's label. */
|
|
210
|
+
controlText?: StyleProp<TextStyle>;
|
|
211
|
+
/** A rows-per-page pill. */
|
|
212
|
+
sizePill?: StyleProp<ViewStyle>;
|
|
213
|
+
/** A rows-per-page pill's label. */
|
|
214
|
+
sizePillText?: StyleProp<TextStyle>;
|
|
215
|
+
}
|
|
118
216
|
interface PagerProps {
|
|
119
217
|
/** 1-based current page. */
|
|
120
218
|
page: number;
|
|
@@ -132,9 +230,14 @@ interface PagerProps {
|
|
|
132
230
|
* count line stays the generic `from–to of N` (byte-identical to prior behaviour).
|
|
133
231
|
*/
|
|
134
232
|
unitLabel?: string;
|
|
233
|
+
/**
|
|
234
|
+
* Per-slot style overrides, merged LAST so the consumer always wins — including over
|
|
235
|
+
* the inline theme colours. Omit for the shared defaults.
|
|
236
|
+
*/
|
|
237
|
+
styleOverrides?: PagerStyleOverrides;
|
|
135
238
|
testID?: string;
|
|
136
239
|
}
|
|
137
|
-
declare function Pager({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizeOptions, unitLabel, testID, }: PagerProps): React.ReactElement;
|
|
240
|
+
declare function Pager({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizeOptions, unitLabel, styleOverrides: o, testID, }: PagerProps): React.ReactElement;
|
|
138
241
|
|
|
139
242
|
/**
|
|
140
243
|
* Shared constants for the DataTable family (DataTable / FilterBar / Pager).
|
|
@@ -190,4 +293,4 @@ declare const TABLE_I18N: {
|
|
|
190
293
|
readonly pagerRowsOptionHint: "uiTables.pager.rowsOptionHint";
|
|
191
294
|
};
|
|
192
295
|
|
|
193
|
-
export { CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, FilterBar, type FilterBarProps, Pager, type PagerProps, StatCard, type StatCardProps, TABLE_I18N, TABLE_TEST_IDS, rowDetailTestID, rowTestID };
|
|
296
|
+
export { CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableStyleOverrides, FilterBar, type FilterBarProps, type FilterBarStyleOverrides, Pager, type PagerProps, type PagerStyleOverrides, StatCard, type StatCardProps, TABLE_I18N, TABLE_TEST_IDS, rowDetailTestID, rowTestID };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* StatCard — a single labelled metric tile (label + formatted numeric value).
|
|
@@ -18,6 +19,43 @@ declare const StatCard: React.MemoExoticComponent<({ label, value, testID }: Sta
|
|
|
18
19
|
* UiProvider `t` inside the components — no literals baked into the render.
|
|
19
20
|
*/
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Per-slot style overrides for the DataTable, merged **LAST** into each slot's style
|
|
24
|
+
* array so the consumer always wins — over the base StyleSheet AND over the inline
|
|
25
|
+
* colour the component applies from `useUi().theme` (the kit keeps colours out of the
|
|
26
|
+
* StyleSheet, so an override that only beat the base would still lose to the theme).
|
|
27
|
+
*
|
|
28
|
+
* The shared defaults are opinionated but never mandatory: omit `styleOverrides` and
|
|
29
|
+
* the table renders exactly as it always has.
|
|
30
|
+
*/
|
|
31
|
+
interface DataTableStyleOverrides {
|
|
32
|
+
/** The bordered, rounded table frame (border radius / border colour / surface). */
|
|
33
|
+
wrap?: StyleProp<ViewStyle>;
|
|
34
|
+
/** The desktop header row (its background comes from `theme.colors.background`). */
|
|
35
|
+
headRow?: StyleProp<ViewStyle>;
|
|
36
|
+
/** A desktop header cell. */
|
|
37
|
+
headCell?: StyleProp<TextStyle>;
|
|
38
|
+
/** A desktop body row. */
|
|
39
|
+
row?: StyleProp<ViewStyle>;
|
|
40
|
+
/** The `<Text>` of a cell whose column renders a string/number (both branches). */
|
|
41
|
+
cell?: StyleProp<TextStyle>;
|
|
42
|
+
/** Extra layer applied to numeric cells, after `cell`. */
|
|
43
|
+
numCell?: StyleProp<TextStyle>;
|
|
44
|
+
/** The loading / empty state container. */
|
|
45
|
+
state?: StyleProp<ViewStyle>;
|
|
46
|
+
/** The loading / empty state text. */
|
|
47
|
+
stateText?: StyleProp<TextStyle>;
|
|
48
|
+
/** The full-width detail panel under an expanded row. */
|
|
49
|
+
rowDetail?: StyleProp<ViewStyle>;
|
|
50
|
+
/** A card in the responsive card-stack (below `stackBreakpoint`). */
|
|
51
|
+
card?: StyleProp<ViewStyle>;
|
|
52
|
+
/** One label:value line inside a card. */
|
|
53
|
+
cardLine?: StyleProp<ViewStyle>;
|
|
54
|
+
/** The label of a card line. */
|
|
55
|
+
cardLabel?: StyleProp<TextStyle>;
|
|
56
|
+
/** The value container of a card line. */
|
|
57
|
+
cardValue?: StyleProp<ViewStyle>;
|
|
58
|
+
}
|
|
21
59
|
interface DataTableColumn<T> {
|
|
22
60
|
/** Stable column id (used for React keys + per-cell test ids). */
|
|
23
61
|
key: string;
|
|
@@ -62,8 +100,19 @@ interface DataTableProps<T> {
|
|
|
62
100
|
loadingLabel?: string;
|
|
63
101
|
/** Empty text (already translated). Falls back to the kit's `empty` translation. */
|
|
64
102
|
emptyLabel?: string;
|
|
65
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Below this width (px) rows collapse to a label:value card. Default 640.
|
|
105
|
+
*
|
|
106
|
+
* **Opt out of the card-stack entirely with `stackBreakpoint={0}`**: the stack is
|
|
107
|
+
* chosen by `width < stackBreakpoint`, which is never true for 0, so the desktop
|
|
108
|
+
* grid renders at every width. Use it when your surface never had a card-stack.
|
|
109
|
+
*/
|
|
66
110
|
stackBreakpoint?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Per-slot style overrides, merged LAST so the consumer always wins — including over
|
|
113
|
+
* the inline colours taken from `useUi().theme`. Omit for the shared defaults.
|
|
114
|
+
*/
|
|
115
|
+
styleOverrides?: DataTableStyleOverrides;
|
|
67
116
|
testID?: string;
|
|
68
117
|
}
|
|
69
118
|
|
|
@@ -76,11 +125,15 @@ interface DataTableProps<T> {
|
|
|
76
125
|
* - sticky header (`stickyHeader`), zebra striping (`zebra`), per-row tint.
|
|
77
126
|
* - a responsive label:value **card-stack** below `stackBreakpoint` via
|
|
78
127
|
* `useWindowDimensions` (the CSS `data-label` card-stack does not port).
|
|
128
|
+
* Pass `stackBreakpoint={0}` to keep the desktop grid at every width.
|
|
79
129
|
* - per-row `testID` + `accessibilityLabel`/`accessibilityHint` (kit standard).
|
|
80
130
|
* - optional CONTROLLED expandable rows: `renderRowDetail` + `expandedRowKeys`
|
|
81
131
|
* render a full-width detail panel between an expanded row and the next
|
|
82
132
|
* (desktop and card-stack alike). Omit both and the table renders exactly as
|
|
83
133
|
* it did before the feature existed.
|
|
134
|
+
* - optional per-slot `styleOverrides`, merged LAST so a consumer that needs to be
|
|
135
|
+
* pixel-perfect beats both the base StyleSheet and the inline theme colour. The
|
|
136
|
+
* shared defaults never change for anyone who does not opt in.
|
|
84
137
|
* - every colour from `useUi().theme`; every component-authored string via `t`.
|
|
85
138
|
*/
|
|
86
139
|
|
|
@@ -94,6 +147,21 @@ declare function DataTable<T>(props: DataTableProps<T>): React.ReactElement;
|
|
|
94
147
|
* ui-forms), keeping this reusable across every grid rather than coverage-specific.
|
|
95
148
|
*/
|
|
96
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Per-slot style overrides for the FilterBar, merged **LAST** into each slot's style
|
|
152
|
+
* array so the consumer always wins — over the base StyleSheet AND over the inline
|
|
153
|
+
* colours taken from `useUi().theme`. Omit for the shared defaults (nothing changes).
|
|
154
|
+
*/
|
|
155
|
+
interface FilterBarStyleOverrides {
|
|
156
|
+
/** The bordered, rounded filter shell. */
|
|
157
|
+
filters?: StyleProp<ViewStyle>;
|
|
158
|
+
/** The flex spacer that pushes the count + actions right. */
|
|
159
|
+
filtersSpacer?: StyleProp<ViewStyle>;
|
|
160
|
+
/** The `<b>N</b> results` count line. */
|
|
161
|
+
results?: StyleProp<TextStyle>;
|
|
162
|
+
/** The right-aligned actions cluster. */
|
|
163
|
+
filtersActions?: StyleProp<ViewStyle>;
|
|
164
|
+
}
|
|
97
165
|
interface FilterBarProps {
|
|
98
166
|
/** The filter fields (labels + inputs), supplied by the app / ui-forms. */
|
|
99
167
|
children?: React.ReactNode;
|
|
@@ -103,9 +171,14 @@ interface FilterBarProps {
|
|
|
103
171
|
resultsLabel?: string;
|
|
104
172
|
/** Right-aligned action buttons (Apply, Export CSV, …). */
|
|
105
173
|
actions?: React.ReactNode;
|
|
174
|
+
/**
|
|
175
|
+
* Per-slot style overrides, merged LAST so the consumer always wins — including over
|
|
176
|
+
* the inline theme colours. Omit for the shared defaults.
|
|
177
|
+
*/
|
|
178
|
+
styleOverrides?: FilterBarStyleOverrides;
|
|
106
179
|
testID?: string;
|
|
107
180
|
}
|
|
108
|
-
declare function FilterBar({ children, resultsCount, resultsLabel, actions, testID, }: FilterBarProps): React.ReactElement;
|
|
181
|
+
declare function FilterBar({ children, resultsCount, resultsLabel, actions, styleOverrides: o, testID, }: FilterBarProps): React.ReactElement;
|
|
109
182
|
|
|
110
183
|
/**
|
|
111
184
|
* Pager — the shared pagination control from GRID.md (`.ui-pager`): page-info on
|
|
@@ -115,6 +188,31 @@ declare function FilterBar({ children, resultsCount, resultsLabel, actions, test
|
|
|
115
188
|
* everything is themed from `useUi().theme` and labelled via the UiProvider `t`.
|
|
116
189
|
*/
|
|
117
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Per-slot style overrides for the Pager, merged **LAST** into each slot's style array
|
|
193
|
+
* so the consumer always wins — over the base StyleSheet AND over the inline colours
|
|
194
|
+
* taken from `useUi().theme`. Omit for the shared defaults (nothing changes).
|
|
195
|
+
*/
|
|
196
|
+
interface PagerStyleOverrides {
|
|
197
|
+
/** The outer pager row. */
|
|
198
|
+
pager?: StyleProp<ViewStyle>;
|
|
199
|
+
/** The `from–to of N` count line. */
|
|
200
|
+
pagerInfo?: StyleProp<TextStyle>;
|
|
201
|
+
/** The right-hand nav cluster (rows-per-page + Prev/Next). */
|
|
202
|
+
pagerNav?: StyleProp<ViewStyle>;
|
|
203
|
+
/** The "Rows" caption before the size pills. */
|
|
204
|
+
pagerRowsLabel?: StyleProp<TextStyle>;
|
|
205
|
+
/** The rows-per-page pill group. */
|
|
206
|
+
sizeGroup?: StyleProp<ViewStyle>;
|
|
207
|
+
/** A Prev/Next button. */
|
|
208
|
+
control?: StyleProp<ViewStyle>;
|
|
209
|
+
/** A Prev/Next button's label. */
|
|
210
|
+
controlText?: StyleProp<TextStyle>;
|
|
211
|
+
/** A rows-per-page pill. */
|
|
212
|
+
sizePill?: StyleProp<ViewStyle>;
|
|
213
|
+
/** A rows-per-page pill's label. */
|
|
214
|
+
sizePillText?: StyleProp<TextStyle>;
|
|
215
|
+
}
|
|
118
216
|
interface PagerProps {
|
|
119
217
|
/** 1-based current page. */
|
|
120
218
|
page: number;
|
|
@@ -132,9 +230,14 @@ interface PagerProps {
|
|
|
132
230
|
* count line stays the generic `from–to of N` (byte-identical to prior behaviour).
|
|
133
231
|
*/
|
|
134
232
|
unitLabel?: string;
|
|
233
|
+
/**
|
|
234
|
+
* Per-slot style overrides, merged LAST so the consumer always wins — including over
|
|
235
|
+
* the inline theme colours. Omit for the shared defaults.
|
|
236
|
+
*/
|
|
237
|
+
styleOverrides?: PagerStyleOverrides;
|
|
135
238
|
testID?: string;
|
|
136
239
|
}
|
|
137
|
-
declare function Pager({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizeOptions, unitLabel, testID, }: PagerProps): React.ReactElement;
|
|
240
|
+
declare function Pager({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizeOptions, unitLabel, styleOverrides: o, testID, }: PagerProps): React.ReactElement;
|
|
138
241
|
|
|
139
242
|
/**
|
|
140
243
|
* Shared constants for the DataTable family (DataTable / FilterBar / Pager).
|
|
@@ -190,4 +293,4 @@ declare const TABLE_I18N: {
|
|
|
190
293
|
readonly pagerRowsOptionHint: "uiTables.pager.rowsOptionHint";
|
|
191
294
|
};
|
|
192
295
|
|
|
193
|
-
export { CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, FilterBar, type FilterBarProps, Pager, type PagerProps, StatCard, type StatCardProps, TABLE_I18N, TABLE_TEST_IDS, rowDetailTestID, rowTestID };
|
|
296
|
+
export { CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableStyleOverrides, FilterBar, type FilterBarProps, type FilterBarStyleOverrides, Pager, type PagerProps, type PagerStyleOverrides, StatCard, type StatCardProps, TABLE_I18N, TABLE_TEST_IDS, rowDetailTestID, rowTestID };
|