@dloizides/ui-tables 1.18.1 → 1.19.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 +12 -0
- package/dist/index.js +41 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.19.0
|
|
4
|
+
|
|
5
|
+
**Every pressable renders a 44x44 hit box (SHOWCASE-1 "Publish the UI showcase at ui.dloizides.com").**
|
|
6
|
+
|
|
7
|
+
Live QA on ui.dloizides.com/tables at 360x640 measured switches at 40x20, page-size buttons at
|
|
8
|
+
32-39x30 and pager buttons 31px tall. `hitSlop` is inert on react-native-web, so the rendered box
|
|
9
|
+
is the target. Pager buttons, page-size pills, the dropdown trigger and its options, filter action
|
|
10
|
+
buttons, the select checkbox (gutter now 44px wide) and the select-all banner action now carry
|
|
11
|
+
`minHeight`/`minWidth` of `MIN_TARGET_PX` (44). The filter `Switch` keeps its 40x20 track inside a
|
|
12
|
+
44x44 `Pressable` (`-switch-hit` test id); the inner Switch keeps focus and the switch role.
|
|
13
|
+
The inert `hitSlop` props were removed.
|
|
14
|
+
|
|
3
15
|
## 1.18.0
|
|
4
16
|
|
|
5
17
|
**`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,6 +270,7 @@ 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({
|
|
@@ -279,19 +285,19 @@ var chromeStyles = reactNative.StyleSheet.create({
|
|
|
279
285
|
/** Mixed-case "Rows" caption for the dropdown variant (v1's muted `.hint` label — no uppercase transform). */
|
|
280
286
|
pagerRowsLabelPlain: { fontSize: HEAD_FONT, letterSpacing: LABEL_LETTER_SPACING },
|
|
281
287
|
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 },
|
|
288
|
+
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
289
|
controlText: { fontSize: CONTROL_FONT, fontWeight: "600" },
|
|
284
|
-
sizePill: { paddingHorizontal: CONTROL_PAD_H, paddingVertical: CONTROL_PAD_V, borderRadius: PILL_RADIUS, borderWidth: BORDER_WIDTH },
|
|
290
|
+
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
291
|
sizePillText: { fontSize: HEAD_FONT, fontWeight: "600", fontVariant: ["tabular-nums"] },
|
|
286
292
|
/** Dropdown variant: relatively-positioned wrapper holding the trigger + the anchored popover. */
|
|
287
293
|
sizeAnchor: { position: "relative" },
|
|
288
294
|
/** 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 },
|
|
295
|
+
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
296
|
sizeTriggerText: { fontSize: CONTROL_FONT, fontWeight: "600", fontVariant: ["tabular-nums"] },
|
|
291
297
|
sizeChevron: { fontSize: CHEVRON_FONT },
|
|
292
298
|
/** Dropdown variant: the anchored popover listing the rows-per-page options. */
|
|
293
299
|
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 },
|
|
300
|
+
sizeOption: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: CONTROL_PAD_H, paddingVertical: MENU_OPT_PAD_V },
|
|
295
301
|
sizeOptionText: { fontSize: CONTROL_FONT, fontVariant: ["tabular-nums"] }
|
|
296
302
|
});
|
|
297
303
|
function cellContent(column, row, textColor, overrides) {
|
|
@@ -363,7 +369,6 @@ function RowCells({
|
|
|
363
369
|
}
|
|
364
370
|
var CHECK_GLYPH = "\u2713";
|
|
365
371
|
var MIXED_GLYPH = "\u2013";
|
|
366
|
-
var CHECKBOX_HIT_SLOP = { top: 12, bottom: 12, left: 12, right: 12 };
|
|
367
372
|
var TRANSPARENT = "transparent";
|
|
368
373
|
function toCheckedValue(state) {
|
|
369
374
|
if (state === "all" /* All */) return true;
|
|
@@ -394,7 +399,6 @@ function SelectionCheckbox({
|
|
|
394
399
|
accessibilityRole: "checkbox",
|
|
395
400
|
accessibilityState: { checked },
|
|
396
401
|
"aria-checked": checked,
|
|
397
|
-
hitSlop: CHECKBOX_HIT_SLOP,
|
|
398
402
|
style: selectionStyles.checkboxHit,
|
|
399
403
|
testID,
|
|
400
404
|
onPress: onToggle,
|
|
@@ -583,6 +587,7 @@ function SelectAllBanner({
|
|
|
583
587
|
accessibilityRole: "button",
|
|
584
588
|
testID: actionTestID,
|
|
585
589
|
onPress: onAction,
|
|
590
|
+
style: selectionStyles.bannerHit,
|
|
586
591
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [selectionStyles.bannerAction, { color: palette.primary["500"] }], children: actionLabel })
|
|
587
592
|
}
|
|
588
593
|
)
|
|
@@ -1165,7 +1170,6 @@ var FIRST_PAGE = 1;
|
|
|
1165
1170
|
var DISABLED_OPACITY = 0.4;
|
|
1166
1171
|
var FULL_OPACITY = 1;
|
|
1167
1172
|
var TRANSPARENT2 = "transparent";
|
|
1168
|
-
var PAGER_HIT_SLOP = { top: 10, bottom: 10 };
|
|
1169
1173
|
function NavButton({ label, hint, disabled, onPress, color, border, testID, styleOverrides: o }) {
|
|
1170
1174
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1171
1175
|
reactNative.Pressable,
|
|
@@ -1176,7 +1180,6 @@ function NavButton({ label, hint, disabled, onPress, color, border, testID, styl
|
|
|
1176
1180
|
accessibilityHint: hint,
|
|
1177
1181
|
accessibilityState: { disabled },
|
|
1178
1182
|
disabled,
|
|
1179
|
-
hitSlop: PAGER_HIT_SLOP,
|
|
1180
1183
|
onPress,
|
|
1181
1184
|
style: [chromeStyles.control, { borderColor: border, opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }, o?.control],
|
|
1182
1185
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [chromeStyles.controlText, { color }, o?.controlText], children: label })
|
|
@@ -1226,7 +1229,6 @@ function RowsControl({ pageSize, pageSizeOptions, onPageSizeChange, isDropdown,
|
|
|
1226
1229
|
accessibilityLabel: rowsOptionLabel(t, size),
|
|
1227
1230
|
accessibilityHint: t(TABLE_I18N.pagerRowsOptionHint),
|
|
1228
1231
|
accessibilityState: { selected: active },
|
|
1229
|
-
hitSlop: PAGER_HIT_SLOP,
|
|
1230
1232
|
onPress: () => onPageSizeChange(size),
|
|
1231
1233
|
style: [chromeStyles.sizePill, { borderColor: active ? brand : colors.border, backgroundColor: active ? brand : TRANSPARENT2 }, o?.sizePill],
|
|
1232
1234
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [chromeStyles.sizePillText, { color: active ? colors.surface : colors.textSecondary }, o?.sizePillText], children: size })
|
|
@@ -1403,11 +1405,14 @@ var filterStyles = reactNative.StyleSheet.create({
|
|
|
1403
1405
|
* six live portals, which this wave must not make.
|
|
1404
1406
|
*/
|
|
1405
1407
|
fieldInBar: { marginBottom: NO_FORM_RHYTHM },
|
|
1406
|
-
switchRow: { flexDirection: "row", alignItems: "center", gap: SWITCH_ROW_GAP, paddingVertical: FIELD_GAP },
|
|
1407
|
-
|
|
1408
|
+
switchRow: { minHeight: MIN_TARGET_PX, flexDirection: "row", alignItems: "center", gap: SWITCH_ROW_GAP, paddingVertical: FIELD_GAP },
|
|
1409
|
+
/** A 44x44 pressable around the switch: RN-web draws the Switch at 40x20 and that box IS its hit target. */
|
|
1410
|
+
switchHit: { minWidth: MIN_TARGET_PX, minHeight: MIN_TARGET_PX, alignItems: "center", justifyContent: "center" },
|
|
1411
|
+
/** The inner Switch takes no pointer events, so one tap toggles once (via `switchHit`), not twice. */
|
|
1412
|
+
switchInert: { pointerEvents: "none" },
|
|
1413
|
+
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
1414
|
actionText: { fontSize: ACTION_FONT, fontWeight: "600" }
|
|
1409
1415
|
});
|
|
1410
|
-
var FILTER_HIT_SLOP = { top: 8, bottom: 8 };
|
|
1411
1416
|
var DISABLED_OPACITY2 = 0.4;
|
|
1412
1417
|
var FULL_OPACITY2 = 1;
|
|
1413
1418
|
var TRANSPARENT3 = "transparent";
|
|
@@ -1424,7 +1429,6 @@ function ActionButton({ label, hint, tone, disabled = false, onPress, testID })
|
|
|
1424
1429
|
accessibilityHint: hint,
|
|
1425
1430
|
accessibilityState: { disabled },
|
|
1426
1431
|
disabled,
|
|
1427
|
-
hitSlop: FILTER_HIT_SLOP,
|
|
1428
1432
|
onPress,
|
|
1429
1433
|
style: [
|
|
1430
1434
|
filterStyles.action,
|
|
@@ -1476,17 +1480,28 @@ function BooleanField({ field, barTestID, value, onChange }) {
|
|
|
1476
1480
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: filterStyles.switchRow, testID, children: [
|
|
1477
1481
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [uiForms.controlStyles.subLabel, { color: colors.text }], children: field.label }),
|
|
1478
1482
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1479
|
-
reactNative.
|
|
1483
|
+
reactNative.Pressable,
|
|
1480
1484
|
{
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1485
|
+
accessible: false,
|
|
1486
|
+
focusable: false,
|
|
1487
|
+
onPress: () => onChange(!value),
|
|
1488
|
+
style: filterStyles.switchHit,
|
|
1489
|
+
testID: `${testID}-switch-hit`,
|
|
1490
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1491
|
+
reactNative.Switch,
|
|
1492
|
+
{
|
|
1493
|
+
accessibilityLabel: field.label,
|
|
1494
|
+
accessibilityHint: field.accessibilityHint,
|
|
1495
|
+
accessibilityRole: "switch",
|
|
1496
|
+
accessibilityState: { checked: value },
|
|
1497
|
+
trackColor: { false: colors.border, true: palette.primary["500"] },
|
|
1498
|
+
thumbColor: colors.surface,
|
|
1499
|
+
value,
|
|
1500
|
+
onValueChange: onChange,
|
|
1501
|
+
style: filterStyles.switchInert,
|
|
1502
|
+
testID: `${testID}-switch`
|
|
1503
|
+
}
|
|
1504
|
+
)
|
|
1490
1505
|
}
|
|
1491
1506
|
)
|
|
1492
1507
|
] });
|