@dloizides/ui-forms 1.16.0 → 1.18.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/dist/index.d.mts CHANGED
@@ -939,7 +939,10 @@ declare const controlStyles: {
939
939
  elevation: number;
940
940
  overflow: "hidden";
941
941
  };
942
+ /** A menu option is a tap target, so it carries the kit floor (SHOWCASE-1). */
942
943
  option: {
944
+ minHeight: number;
945
+ justifyContent: "center";
943
946
  paddingHorizontal: number;
944
947
  paddingVertical: number;
945
948
  };
package/dist/index.d.ts CHANGED
@@ -939,7 +939,10 @@ declare const controlStyles: {
939
939
  elevation: number;
940
940
  overflow: "hidden";
941
941
  };
942
+ /** A menu option is a tap target, so it carries the kit floor (SHOWCASE-1). */
942
943
  option: {
944
+ minHeight: number;
945
+ justifyContent: "center";
943
946
  paddingHorizontal: number;
944
947
  paddingVertical: number;
945
948
  };
package/dist/index.js CHANGED
@@ -460,7 +460,13 @@ var controlStyles = reactNative.StyleSheet.create({
460
460
  elevation: MENU_ELEVATION,
461
461
  overflow: "hidden"
462
462
  },
463
- option: { paddingHorizontal: MENU_OPT_PAD_H, paddingVertical: MENU_OPT_PAD_V },
463
+ /** A menu option is a tap target, so it carries the kit floor (SHOWCASE-1). */
464
+ option: {
465
+ minHeight: a11y.MIN_TOUCH_TARGET_PX,
466
+ justifyContent: "center",
467
+ paddingHorizontal: MENU_OPT_PAD_H,
468
+ paddingVertical: MENU_OPT_PAD_V
469
+ },
464
470
  optionText: { fontSize: OPTION_FONT },
465
471
  error: { fontSize: ERROR_FONT, marginTop: ERROR_GAP }
466
472
  });
@@ -964,10 +970,13 @@ var OUTLINE_PAD_H = 12;
964
970
  var OUTLINE_PAD_V = 5;
965
971
  var OUTLINE_FONT_SIZE = 13;
966
972
  var CHIP_ICON_GAP = 6;
973
+ var MIN_TARGET_PX = 44;
967
974
  var chipStyles = reactNative.StyleSheet.create({
968
975
  chip: {
969
976
  paddingHorizontal: 12,
970
977
  paddingVertical: 6,
978
+ minHeight: MIN_TARGET_PX,
979
+ justifyContent: "center",
971
980
  borderRadius: SOLID_RADIUS,
972
981
  backgroundColor: TRANSPARENT_COLOR,
973
982
  borderWidth: 1
@@ -975,6 +984,8 @@ var chipStyles = reactNative.StyleSheet.create({
975
984
  chipOutline: {
976
985
  paddingHorizontal: OUTLINE_PAD_H,
977
986
  paddingVertical: OUTLINE_PAD_V,
987
+ minHeight: MIN_TARGET_PX,
988
+ justifyContent: "center",
978
989
  borderRadius: OUTLINE_RADIUS,
979
990
  borderWidth: 1
980
991
  },
@@ -1257,7 +1268,10 @@ var styles6 = reactNative.StyleSheet.create({
1257
1268
  flexDirection: "row",
1258
1269
  justifyContent: "space-between",
1259
1270
  alignItems: "center",
1260
- marginBottom: 12
1271
+ marginBottom: 12,
1272
+ // The ROW is the hit box (SHOWCASE-1): RN-web renders Switch as a 40x20 box and ignores
1273
+ // `hitSlop`, so a pointer target smaller than the floor cannot be widened any other way.
1274
+ minHeight: a11y.MIN_TOUCH_TARGET_PX
1261
1275
  },
1262
1276
  textColumn: {
1263
1277
  flex: 1
@@ -1281,6 +1295,9 @@ var FormSwitch = ({
1281
1295
  accessibilityHint
1282
1296
  }) => {
1283
1297
  const { theme } = uiFeedback.useUi();
1298
+ const toggle = React2__default.default.useCallback(() => {
1299
+ if (!disabled) onValueChange(!value);
1300
+ }, [disabled, onValueChange, value]);
1284
1301
  const { colors } = theme;
1285
1302
  const hasDescription = typeof description === "string" && description !== "";
1286
1303
  const themeStyles = React2__default.default.useMemo(() => {
@@ -1288,32 +1305,42 @@ var FormSwitch = ({
1288
1305
  const descriptionStyle = { color: colors.textSecondary };
1289
1306
  return { label: labelStyle, description: descriptionStyle };
1290
1307
  }, [colors.text, colors.textSecondary]);
1291
- return /* @__PURE__ */ jsxRuntime.jsxs(
1292
- reactNative.View,
1293
- {
1294
- style: [
1295
- styles6.container,
1296
- containerStyle
1297
- ],
1298
- children: [
1299
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.textColumn, children: [
1300
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.label, themeStyles.label], children: label }),
1301
- hasDescription ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.description, themeStyles.description], children: description }) : null
1302
- ] }),
1303
- /* @__PURE__ */ jsxRuntime.jsx(
1304
- reactNative.Switch,
1305
- {
1306
- accessibilityHint: accessibilityHint ?? label,
1307
- accessibilityLabel: label,
1308
- accessibilityState: { checked: value, disabled },
1309
- disabled,
1310
- testID,
1311
- value,
1312
- onValueChange
1313
- }
1314
- )
1315
- ]
1316
- }
1308
+ return (
1309
+ /*
1310
+ Pointer target only: the whole row toggles on press. It is NOT an a11y element and NOT a tab
1311
+ stop (`accessible` / `focusable` false) so the native input below stays the ONE switch. The
1312
+ Switch sits under `pointerEvents="none"`, so a tap on it reaches this row exactly once
1313
+ instead of toggling twice; keyboard focus + Space still reach the input directly.
1314
+ */
1315
+ /* @__PURE__ */ jsxRuntime.jsxs(
1316
+ reactNative.Pressable,
1317
+ {
1318
+ accessible: false,
1319
+ disabled,
1320
+ onPress: toggle,
1321
+ style: [styles6.container, containerStyle],
1322
+ tabIndex: -1,
1323
+ testID: `${testID}-row`,
1324
+ children: [
1325
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.textColumn, children: [
1326
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.label, themeStyles.label], children: label }),
1327
+ hasDescription ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.description, themeStyles.description], children: description }) : null
1328
+ ] }),
1329
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { pointerEvents: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
1330
+ reactNative.Switch,
1331
+ {
1332
+ accessibilityHint: accessibilityHint ?? label,
1333
+ accessibilityLabel: label,
1334
+ accessibilityState: { checked: value, disabled },
1335
+ disabled,
1336
+ testID,
1337
+ value,
1338
+ onValueChange
1339
+ }
1340
+ ) })
1341
+ ]
1342
+ }
1343
+ )
1317
1344
  );
1318
1345
  };
1319
1346
  var ACTIVATION_KEYS = ["Enter", " ", "Spacebar"];
@@ -1327,7 +1354,14 @@ var styles7 = reactNative.StyleSheet.create({
1327
1354
  flexDirection: "row",
1328
1355
  alignItems: "flex-start",
1329
1356
  gap: 10,
1330
- marginBottom: 12
1357
+ marginBottom: 12,
1358
+ // The whole row is the Pressable, so the row IS the hit box: on RN-web `hitSlop` is inert and a
1359
+ // one-line label measured 36px tall (SHOWCASE-1). The 20px visual box keeps its size inside.
1360
+ minHeight: a11y.MIN_TOUCH_TARGET_PX
1361
+ },
1362
+ /** With no hint the row is a single line, so centre it vertically inside the floor. */
1363
+ centered: {
1364
+ alignItems: "center"
1331
1365
  },
1332
1366
  box: {
1333
1367
  width: BOX_SIZE,
@@ -1404,7 +1438,12 @@ var FormCheckbox = ({
1404
1438
  disabled,
1405
1439
  onPress: toggle,
1406
1440
  role: "checkbox",
1407
- style: [styles7.container, containerStyle, disabled ? { opacity: DISABLED_OPACITY } : null],
1441
+ style: [
1442
+ styles7.container,
1443
+ hasHint ? null : styles7.centered,
1444
+ containerStyle,
1445
+ disabled ? { opacity: DISABLED_OPACITY } : null
1446
+ ],
1408
1447
  testID,
1409
1448
  ...keyboardProps,
1410
1449
  children: [