@dloizides/ui-tables 1.18.1 → 1.19.1
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 +22 -0
- package/dist/index.js +49 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
**The `Filters` / `FilterBar` actions cluster wraps (TABLES-MOBILE-1 "Filter bar and pager overflow at 360").**
|
|
6
|
+
|
|
7
|
+
Visual QA of aml-v2 `/app/leaders` at 360 measured the actions row (Reset, Export CSV/PDF, Apply)
|
|
8
|
+
at 431px inside a 255px bar: a nowrap row is one unbreakable flex item, so Apply rendered at x=373,
|
|
9
|
+
off-screen. `filtersActions` now has `flexWrap: 'wrap'`, `flexShrink: 1` and `maxWidth: '100%'`,
|
|
10
|
+
so the cluster fits its line and its buttons break onto further lines. Desktop is unchanged: where
|
|
11
|
+
the row fits, nothing wraps. The 44px Apply / pager hit boxes shipped in 1.19.0.
|
|
12
|
+
|
|
13
|
+
## 1.19.0
|
|
14
|
+
|
|
15
|
+
**Every pressable renders a 44x44 hit box (SHOWCASE-1 "Publish the UI showcase at ui.dloizides.com").**
|
|
16
|
+
|
|
17
|
+
Live QA on ui.dloizides.com/tables at 360x640 measured switches at 40x20, page-size buttons at
|
|
18
|
+
32-39x30 and pager buttons 31px tall. `hitSlop` is inert on react-native-web, so the rendered box
|
|
19
|
+
is the target. Pager buttons, page-size pills, the dropdown trigger and its options, filter action
|
|
20
|
+
buttons, the select checkbox (gutter now 44px wide) and the select-all banner action now carry
|
|
21
|
+
`minHeight`/`minWidth` of `MIN_TARGET_PX` (44). The filter `Switch` keeps its 40x20 track inside a
|
|
22
|
+
44x44 `Pressable` (`-switch-hit` test id); the inner Switch keeps focus and the switch role.
|
|
23
|
+
The inert `hitSlop` props were removed.
|
|
24
|
+
|
|
3
25
|
## 1.18.0
|
|
4
26
|
|
|
5
27
|
**`DataTable` rows now fade in on load — the Ant-design-like list entrance — via `@dloizides/ui-motion`.**
|
package/dist/index.js
CHANGED
|
@@ -151,6 +151,11 @@ var StatCard = React2.memo(({ label, value, testID }) => {
|
|
|
151
151
|
);
|
|
152
152
|
});
|
|
153
153
|
StatCard.displayName = "StatCard";
|
|
154
|
+
|
|
155
|
+
// src/minTarget.ts
|
|
156
|
+
var MIN_TARGET_PX = 44;
|
|
157
|
+
|
|
158
|
+
// src/DataTable/styles.ts
|
|
154
159
|
var BORDER_WIDTH = 1;
|
|
155
160
|
var BORDER_RADIUS = 12;
|
|
156
161
|
var COLUMN_GAP = 16;
|
|
@@ -182,7 +187,7 @@ var HEAD_LETTER_SPACING = 0.4;
|
|
|
182
187
|
var LABEL_LETTER_SPACING = 0.3;
|
|
183
188
|
var STICKY_Z = 2;
|
|
184
189
|
var FULL_WIDTH = "100%";
|
|
185
|
-
var SELECT_COL_WIDTH =
|
|
190
|
+
var SELECT_COL_WIDTH = MIN_TARGET_PX;
|
|
186
191
|
var CHECKBOX_SIZE = 18;
|
|
187
192
|
var CHECKBOX_RADIUS = 4;
|
|
188
193
|
var CHECKBOX_GLYPH_FONT = 11;
|
|
@@ -236,8 +241,8 @@ var tableStyles = reactNative.StyleSheet.create({
|
|
|
236
241
|
var selectionStyles = reactNative.StyleSheet.create({
|
|
237
242
|
/** The fixed-width gutter holding the checkbox, in both the header and every row. */
|
|
238
243
|
selectCell: { width: SELECT_COL_WIDTH, alignItems: "flex-start", justifyContent: "center" },
|
|
239
|
-
/** The checkbox's pressable area
|
|
240
|
-
checkboxHit: { alignItems: "center", justifyContent: "center" },
|
|
244
|
+
/** The checkbox's pressable area — a full 44x44 box around the 18px visual square. */
|
|
245
|
+
checkboxHit: { minWidth: MIN_TARGET_PX, minHeight: MIN_TARGET_PX, alignItems: "center", justifyContent: "center" },
|
|
241
246
|
checkbox: {
|
|
242
247
|
width: CHECKBOX_SIZE,
|
|
243
248
|
height: CHECKBOX_SIZE,
|
|
@@ -265,13 +270,21 @@ var selectionStyles = reactNative.StyleSheet.create({
|
|
|
265
270
|
paddingVertical: BANNER_PAD_V
|
|
266
271
|
},
|
|
267
272
|
bannerText: { fontSize: BANNER_FONT },
|
|
273
|
+
bannerHit: { minHeight: MIN_TARGET_PX, justifyContent: "center" },
|
|
268
274
|
bannerAction: { fontSize: BANNER_FONT, fontWeight: "700", textDecorationLine: "underline" }
|
|
269
275
|
});
|
|
270
276
|
var chromeStyles = reactNative.StyleSheet.create({
|
|
271
277
|
filters: { flexDirection: "row", flexWrap: "wrap", alignItems: "flex-end", columnGap: COLUMN_GAP, rowGap: PAGER_GAP, borderWidth: BORDER_WIDTH, borderRadius: BORDER_RADIUS, paddingHorizontal: ROW_PAD_H, paddingVertical: ROW_PAD_V },
|
|
272
278
|
filtersSpacer: { flexGrow: 1 },
|
|
273
279
|
results: { fontSize: RESULTS_FONT },
|
|
274
|
-
|
|
280
|
+
/**
|
|
281
|
+
* The actions cluster WRAPS and is capped at the bar's width (TABLES-MOBILE-1 "Filter bar and
|
|
282
|
+
* pager overflow at 360"). A nowrap row is one unbreakable flex item: at 360 on aml-v2 Leaders
|
|
283
|
+
* it measured 431px inside a 255px bar and pushed Apply off-screen. `maxWidth: 100%` +
|
|
284
|
+
* `flexShrink` fit the cluster to its line; its own `flexWrap` then breaks the buttons onto
|
|
285
|
+
* further lines instead of overflowing (flex-shrink alone cannot: it never wraps a line).
|
|
286
|
+
*/
|
|
287
|
+
filtersActions: { flexDirection: "row", flexWrap: "wrap", flexShrink: 1, maxWidth: "100%", rowGap: PAGER_GAP, columnGap: PAGER_SIZE_GAP, alignItems: "center" },
|
|
275
288
|
pager: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", justifyContent: "space-between", gap: PAGER_GAP },
|
|
276
289
|
pagerInfo: { fontSize: CONTROL_FONT, fontVariant: ["tabular-nums"] },
|
|
277
290
|
pagerNav: { flexDirection: "row", alignItems: "center", gap: PAGER_SIZE_GAP, flexWrap: "wrap" },
|
|
@@ -279,19 +292,19 @@ var chromeStyles = reactNative.StyleSheet.create({
|
|
|
279
292
|
/** Mixed-case "Rows" caption for the dropdown variant (v1's muted `.hint` label — no uppercase transform). */
|
|
280
293
|
pagerRowsLabelPlain: { fontSize: HEAD_FONT, letterSpacing: LABEL_LETTER_SPACING },
|
|
281
294
|
sizeGroup: { flexDirection: "row", gap: PAGER_SIZE_GAP, alignItems: "center" },
|
|
282
|
-
control: { paddingHorizontal: CONTROL_PAD_H, paddingVertical: CONTROL_PAD_V, borderRadius: BORDER_RADIUS, borderWidth: BORDER_WIDTH },
|
|
295
|
+
control: { minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, alignItems: "center", justifyContent: "center", paddingHorizontal: CONTROL_PAD_H, paddingVertical: CONTROL_PAD_V, borderRadius: BORDER_RADIUS, borderWidth: BORDER_WIDTH },
|
|
283
296
|
controlText: { fontSize: CONTROL_FONT, fontWeight: "600" },
|
|
284
|
-
sizePill: { paddingHorizontal: CONTROL_PAD_H, paddingVertical: CONTROL_PAD_V, borderRadius: PILL_RADIUS, borderWidth: BORDER_WIDTH },
|
|
297
|
+
sizePill: { minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, alignItems: "center", justifyContent: "center", paddingHorizontal: CONTROL_PAD_H, paddingVertical: CONTROL_PAD_V, borderRadius: PILL_RADIUS, borderWidth: BORDER_WIDTH },
|
|
285
298
|
sizePillText: { fontSize: HEAD_FONT, fontWeight: "600", fontVariant: ["tabular-nums"] },
|
|
286
299
|
/** Dropdown variant: relatively-positioned wrapper holding the trigger + the anchored popover. */
|
|
287
300
|
sizeAnchor: { position: "relative" },
|
|
288
301
|
/** Dropdown variant: the compact `<select>`-like trigger (bordered ghost look, height-matched to Prev/Next) + chevron. */
|
|
289
|
-
sizeTrigger: { flexDirection: "row", alignItems: "center", gap: PAGER_SIZE_GAP, paddingHorizontal: CONTROL_PAD_H, paddingVertical: CONTROL_PAD_V, borderRadius: BORDER_RADIUS, borderWidth: BORDER_WIDTH },
|
|
302
|
+
sizeTrigger: { minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, flexDirection: "row", alignItems: "center", justifyContent: "center", gap: PAGER_SIZE_GAP, paddingHorizontal: CONTROL_PAD_H, paddingVertical: CONTROL_PAD_V, borderRadius: BORDER_RADIUS, borderWidth: BORDER_WIDTH },
|
|
290
303
|
sizeTriggerText: { fontSize: CONTROL_FONT, fontWeight: "600", fontVariant: ["tabular-nums"] },
|
|
291
304
|
sizeChevron: { fontSize: CHEVRON_FONT },
|
|
292
305
|
/** Dropdown variant: the anchored popover listing the rows-per-page options. */
|
|
293
306
|
sizeMenu: { position: "absolute", top: "100%", right: 0, marginTop: MENU_TOP_GAP, minWidth: MENU_MIN_WIDTH, borderWidth: BORDER_WIDTH, borderRadius: BORDER_RADIUS, paddingVertical: MENU_PAD_V, zIndex: MENU_Z_INDEX, boxShadow: MENU_BOX_SHADOW, elevation: MENU_ELEVATION },
|
|
294
|
-
sizeOption: { paddingHorizontal: CONTROL_PAD_H, paddingVertical: MENU_OPT_PAD_V },
|
|
307
|
+
sizeOption: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: CONTROL_PAD_H, paddingVertical: MENU_OPT_PAD_V },
|
|
295
308
|
sizeOptionText: { fontSize: CONTROL_FONT, fontVariant: ["tabular-nums"] }
|
|
296
309
|
});
|
|
297
310
|
function cellContent(column, row, textColor, overrides) {
|
|
@@ -363,7 +376,6 @@ function RowCells({
|
|
|
363
376
|
}
|
|
364
377
|
var CHECK_GLYPH = "\u2713";
|
|
365
378
|
var MIXED_GLYPH = "\u2013";
|
|
366
|
-
var CHECKBOX_HIT_SLOP = { top: 12, bottom: 12, left: 12, right: 12 };
|
|
367
379
|
var TRANSPARENT = "transparent";
|
|
368
380
|
function toCheckedValue(state) {
|
|
369
381
|
if (state === "all" /* All */) return true;
|
|
@@ -394,7 +406,6 @@ function SelectionCheckbox({
|
|
|
394
406
|
accessibilityRole: "checkbox",
|
|
395
407
|
accessibilityState: { checked },
|
|
396
408
|
"aria-checked": checked,
|
|
397
|
-
hitSlop: CHECKBOX_HIT_SLOP,
|
|
398
409
|
style: selectionStyles.checkboxHit,
|
|
399
410
|
testID,
|
|
400
411
|
onPress: onToggle,
|
|
@@ -583,6 +594,7 @@ function SelectAllBanner({
|
|
|
583
594
|
accessibilityRole: "button",
|
|
584
595
|
testID: actionTestID,
|
|
585
596
|
onPress: onAction,
|
|
597
|
+
style: selectionStyles.bannerHit,
|
|
586
598
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [selectionStyles.bannerAction, { color: palette.primary["500"] }], children: actionLabel })
|
|
587
599
|
}
|
|
588
600
|
)
|
|
@@ -1165,7 +1177,6 @@ var FIRST_PAGE = 1;
|
|
|
1165
1177
|
var DISABLED_OPACITY = 0.4;
|
|
1166
1178
|
var FULL_OPACITY = 1;
|
|
1167
1179
|
var TRANSPARENT2 = "transparent";
|
|
1168
|
-
var PAGER_HIT_SLOP = { top: 10, bottom: 10 };
|
|
1169
1180
|
function NavButton({ label, hint, disabled, onPress, color, border, testID, styleOverrides: o }) {
|
|
1170
1181
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1171
1182
|
reactNative.Pressable,
|
|
@@ -1176,7 +1187,6 @@ function NavButton({ label, hint, disabled, onPress, color, border, testID, styl
|
|
|
1176
1187
|
accessibilityHint: hint,
|
|
1177
1188
|
accessibilityState: { disabled },
|
|
1178
1189
|
disabled,
|
|
1179
|
-
hitSlop: PAGER_HIT_SLOP,
|
|
1180
1190
|
onPress,
|
|
1181
1191
|
style: [chromeStyles.control, { borderColor: border, opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }, o?.control],
|
|
1182
1192
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [chromeStyles.controlText, { color }, o?.controlText], children: label })
|
|
@@ -1226,7 +1236,6 @@ function RowsControl({ pageSize, pageSizeOptions, onPageSizeChange, isDropdown,
|
|
|
1226
1236
|
accessibilityLabel: rowsOptionLabel(t, size),
|
|
1227
1237
|
accessibilityHint: t(TABLE_I18N.pagerRowsOptionHint),
|
|
1228
1238
|
accessibilityState: { selected: active },
|
|
1229
|
-
hitSlop: PAGER_HIT_SLOP,
|
|
1230
1239
|
onPress: () => onPageSizeChange(size),
|
|
1231
1240
|
style: [chromeStyles.sizePill, { borderColor: active ? brand : colors.border, backgroundColor: active ? brand : TRANSPARENT2 }, o?.sizePill],
|
|
1232
1241
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [chromeStyles.sizePillText, { color: active ? colors.surface : colors.textSecondary }, o?.sizePillText], children: size })
|
|
@@ -1403,11 +1412,14 @@ var filterStyles = reactNative.StyleSheet.create({
|
|
|
1403
1412
|
* six live portals, which this wave must not make.
|
|
1404
1413
|
*/
|
|
1405
1414
|
fieldInBar: { marginBottom: NO_FORM_RHYTHM },
|
|
1406
|
-
switchRow: { flexDirection: "row", alignItems: "center", gap: SWITCH_ROW_GAP, paddingVertical: FIELD_GAP },
|
|
1407
|
-
|
|
1415
|
+
switchRow: { minHeight: MIN_TARGET_PX, flexDirection: "row", alignItems: "center", gap: SWITCH_ROW_GAP, paddingVertical: FIELD_GAP },
|
|
1416
|
+
/** A 44x44 pressable around the switch: RN-web draws the Switch at 40x20 and that box IS its hit target. */
|
|
1417
|
+
switchHit: { minWidth: MIN_TARGET_PX, minHeight: MIN_TARGET_PX, alignItems: "center", justifyContent: "center" },
|
|
1418
|
+
/** The inner Switch takes no pointer events, so one tap toggles once (via `switchHit`), not twice. */
|
|
1419
|
+
switchInert: { pointerEvents: "none" },
|
|
1420
|
+
action: { minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, alignItems: "center", justifyContent: "center", paddingHorizontal: ACTION_PAD_H, paddingVertical: ACTION_PAD_V, borderRadius: ACTION_RADIUS, borderWidth: ACTION_BORDER },
|
|
1408
1421
|
actionText: { fontSize: ACTION_FONT, fontWeight: "600" }
|
|
1409
1422
|
});
|
|
1410
|
-
var FILTER_HIT_SLOP = { top: 8, bottom: 8 };
|
|
1411
1423
|
var DISABLED_OPACITY2 = 0.4;
|
|
1412
1424
|
var FULL_OPACITY2 = 1;
|
|
1413
1425
|
var TRANSPARENT3 = "transparent";
|
|
@@ -1424,7 +1436,6 @@ function ActionButton({ label, hint, tone, disabled = false, onPress, testID })
|
|
|
1424
1436
|
accessibilityHint: hint,
|
|
1425
1437
|
accessibilityState: { disabled },
|
|
1426
1438
|
disabled,
|
|
1427
|
-
hitSlop: FILTER_HIT_SLOP,
|
|
1428
1439
|
onPress,
|
|
1429
1440
|
style: [
|
|
1430
1441
|
filterStyles.action,
|
|
@@ -1476,17 +1487,28 @@ function BooleanField({ field, barTestID, value, onChange }) {
|
|
|
1476
1487
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: filterStyles.switchRow, testID, children: [
|
|
1477
1488
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [uiForms.controlStyles.subLabel, { color: colors.text }], children: field.label }),
|
|
1478
1489
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1479
|
-
reactNative.
|
|
1490
|
+
reactNative.Pressable,
|
|
1480
1491
|
{
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1492
|
+
accessible: false,
|
|
1493
|
+
focusable: false,
|
|
1494
|
+
onPress: () => onChange(!value),
|
|
1495
|
+
style: filterStyles.switchHit,
|
|
1496
|
+
testID: `${testID}-switch-hit`,
|
|
1497
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1498
|
+
reactNative.Switch,
|
|
1499
|
+
{
|
|
1500
|
+
accessibilityLabel: field.label,
|
|
1501
|
+
accessibilityHint: field.accessibilityHint,
|
|
1502
|
+
accessibilityRole: "switch",
|
|
1503
|
+
accessibilityState: { checked: value },
|
|
1504
|
+
trackColor: { false: colors.border, true: palette.primary["500"] },
|
|
1505
|
+
thumbColor: colors.surface,
|
|
1506
|
+
value,
|
|
1507
|
+
onValueChange: onChange,
|
|
1508
|
+
style: filterStyles.switchInert,
|
|
1509
|
+
testID: `${testID}-switch`
|
|
1510
|
+
}
|
|
1511
|
+
)
|
|
1490
1512
|
}
|
|
1491
1513
|
)
|
|
1492
1514
|
] });
|