@dloizides/ui-forms 1.17.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 +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +64 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
|
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
|
});
|
|
@@ -1262,7 +1268,10 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
1262
1268
|
flexDirection: "row",
|
|
1263
1269
|
justifyContent: "space-between",
|
|
1264
1270
|
alignItems: "center",
|
|
1265
|
-
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
|
|
1266
1275
|
},
|
|
1267
1276
|
textColumn: {
|
|
1268
1277
|
flex: 1
|
|
@@ -1286,6 +1295,9 @@ var FormSwitch = ({
|
|
|
1286
1295
|
accessibilityHint
|
|
1287
1296
|
}) => {
|
|
1288
1297
|
const { theme } = uiFeedback.useUi();
|
|
1298
|
+
const toggle = React2__default.default.useCallback(() => {
|
|
1299
|
+
if (!disabled) onValueChange(!value);
|
|
1300
|
+
}, [disabled, onValueChange, value]);
|
|
1289
1301
|
const { colors } = theme;
|
|
1290
1302
|
const hasDescription = typeof description === "string" && description !== "";
|
|
1291
1303
|
const themeStyles = React2__default.default.useMemo(() => {
|
|
@@ -1293,32 +1305,42 @@ var FormSwitch = ({
|
|
|
1293
1305
|
const descriptionStyle = { color: colors.textSecondary };
|
|
1294
1306
|
return { label: labelStyle, description: descriptionStyle };
|
|
1295
1307
|
}, [colors.text, colors.textSecondary]);
|
|
1296
|
-
return
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
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
|
+
)
|
|
1322
1344
|
);
|
|
1323
1345
|
};
|
|
1324
1346
|
var ACTIVATION_KEYS = ["Enter", " ", "Spacebar"];
|
|
@@ -1332,7 +1354,14 @@ var styles7 = reactNative.StyleSheet.create({
|
|
|
1332
1354
|
flexDirection: "row",
|
|
1333
1355
|
alignItems: "flex-start",
|
|
1334
1356
|
gap: 10,
|
|
1335
|
-
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"
|
|
1336
1365
|
},
|
|
1337
1366
|
box: {
|
|
1338
1367
|
width: BOX_SIZE,
|
|
@@ -1409,7 +1438,12 @@ var FormCheckbox = ({
|
|
|
1409
1438
|
disabled,
|
|
1410
1439
|
onPress: toggle,
|
|
1411
1440
|
role: "checkbox",
|
|
1412
|
-
style: [
|
|
1441
|
+
style: [
|
|
1442
|
+
styles7.container,
|
|
1443
|
+
hasHint ? null : styles7.centered,
|
|
1444
|
+
containerStyle,
|
|
1445
|
+
disabled ? { opacity: DISABLED_OPACITY } : null
|
|
1446
|
+
],
|
|
1413
1447
|
testID,
|
|
1414
1448
|
...keyboardProps,
|
|
1415
1449
|
children: [
|