@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/CHANGELOG.md +402 -383
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +69 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -454,7 +454,13 @@ var controlStyles = StyleSheet.create({
|
|
|
454
454
|
elevation: MENU_ELEVATION,
|
|
455
455
|
overflow: "hidden"
|
|
456
456
|
},
|
|
457
|
-
option
|
|
457
|
+
/** A menu option is a tap target, so it carries the kit floor (SHOWCASE-1). */
|
|
458
|
+
option: {
|
|
459
|
+
minHeight: MIN_TOUCH_TARGET_PX,
|
|
460
|
+
justifyContent: "center",
|
|
461
|
+
paddingHorizontal: MENU_OPT_PAD_H,
|
|
462
|
+
paddingVertical: MENU_OPT_PAD_V
|
|
463
|
+
},
|
|
458
464
|
optionText: { fontSize: OPTION_FONT },
|
|
459
465
|
error: { fontSize: ERROR_FONT, marginTop: ERROR_GAP }
|
|
460
466
|
});
|
|
@@ -958,10 +964,13 @@ var OUTLINE_PAD_H = 12;
|
|
|
958
964
|
var OUTLINE_PAD_V = 5;
|
|
959
965
|
var OUTLINE_FONT_SIZE = 13;
|
|
960
966
|
var CHIP_ICON_GAP = 6;
|
|
967
|
+
var MIN_TARGET_PX = 44;
|
|
961
968
|
var chipStyles = StyleSheet.create({
|
|
962
969
|
chip: {
|
|
963
970
|
paddingHorizontal: 12,
|
|
964
971
|
paddingVertical: 6,
|
|
972
|
+
minHeight: MIN_TARGET_PX,
|
|
973
|
+
justifyContent: "center",
|
|
965
974
|
borderRadius: SOLID_RADIUS,
|
|
966
975
|
backgroundColor: TRANSPARENT_COLOR,
|
|
967
976
|
borderWidth: 1
|
|
@@ -969,6 +978,8 @@ var chipStyles = StyleSheet.create({
|
|
|
969
978
|
chipOutline: {
|
|
970
979
|
paddingHorizontal: OUTLINE_PAD_H,
|
|
971
980
|
paddingVertical: OUTLINE_PAD_V,
|
|
981
|
+
minHeight: MIN_TARGET_PX,
|
|
982
|
+
justifyContent: "center",
|
|
972
983
|
borderRadius: OUTLINE_RADIUS,
|
|
973
984
|
borderWidth: 1
|
|
974
985
|
},
|
|
@@ -1251,7 +1262,10 @@ var styles6 = StyleSheet.create({
|
|
|
1251
1262
|
flexDirection: "row",
|
|
1252
1263
|
justifyContent: "space-between",
|
|
1253
1264
|
alignItems: "center",
|
|
1254
|
-
marginBottom: 12
|
|
1265
|
+
marginBottom: 12,
|
|
1266
|
+
// The ROW is the hit box (SHOWCASE-1): RN-web renders Switch as a 40x20 box and ignores
|
|
1267
|
+
// `hitSlop`, so a pointer target smaller than the floor cannot be widened any other way.
|
|
1268
|
+
minHeight: MIN_TOUCH_TARGET_PX
|
|
1255
1269
|
},
|
|
1256
1270
|
textColumn: {
|
|
1257
1271
|
flex: 1
|
|
@@ -1275,6 +1289,9 @@ var FormSwitch = ({
|
|
|
1275
1289
|
accessibilityHint
|
|
1276
1290
|
}) => {
|
|
1277
1291
|
const { theme } = useUi();
|
|
1292
|
+
const toggle = React2.useCallback(() => {
|
|
1293
|
+
if (!disabled) onValueChange(!value);
|
|
1294
|
+
}, [disabled, onValueChange, value]);
|
|
1278
1295
|
const { colors } = theme;
|
|
1279
1296
|
const hasDescription = typeof description === "string" && description !== "";
|
|
1280
1297
|
const themeStyles = React2.useMemo(() => {
|
|
@@ -1282,32 +1299,42 @@ var FormSwitch = ({
|
|
|
1282
1299
|
const descriptionStyle = { color: colors.textSecondary };
|
|
1283
1300
|
return { label: labelStyle, description: descriptionStyle };
|
|
1284
1301
|
}, [colors.text, colors.textSecondary]);
|
|
1285
|
-
return
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1302
|
+
return (
|
|
1303
|
+
/*
|
|
1304
|
+
Pointer target only: the whole row toggles on press. It is NOT an a11y element and NOT a tab
|
|
1305
|
+
stop (`accessible` / `focusable` false) so the native input below stays the ONE switch. The
|
|
1306
|
+
Switch sits under `pointerEvents="none"`, so a tap on it reaches this row exactly once
|
|
1307
|
+
instead of toggling twice; keyboard focus + Space still reach the input directly.
|
|
1308
|
+
*/
|
|
1309
|
+
/* @__PURE__ */ jsxs(
|
|
1310
|
+
Pressable,
|
|
1311
|
+
{
|
|
1312
|
+
accessible: false,
|
|
1313
|
+
disabled,
|
|
1314
|
+
onPress: toggle,
|
|
1315
|
+
style: [styles6.container, containerStyle],
|
|
1316
|
+
tabIndex: -1,
|
|
1317
|
+
testID: `${testID}-row`,
|
|
1318
|
+
children: [
|
|
1319
|
+
/* @__PURE__ */ jsxs(View, { style: styles6.textColumn, children: [
|
|
1320
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.label, themeStyles.label], children: label }),
|
|
1321
|
+
hasDescription ? /* @__PURE__ */ jsx(Text, { style: [styles6.description, themeStyles.description], children: description }) : null
|
|
1322
|
+
] }),
|
|
1323
|
+
/* @__PURE__ */ jsx(View, { pointerEvents: "none", children: /* @__PURE__ */ jsx(
|
|
1324
|
+
Switch,
|
|
1325
|
+
{
|
|
1326
|
+
accessibilityHint: accessibilityHint ?? label,
|
|
1327
|
+
accessibilityLabel: label,
|
|
1328
|
+
accessibilityState: { checked: value, disabled },
|
|
1329
|
+
disabled,
|
|
1330
|
+
testID,
|
|
1331
|
+
value,
|
|
1332
|
+
onValueChange
|
|
1333
|
+
}
|
|
1334
|
+
) })
|
|
1335
|
+
]
|
|
1336
|
+
}
|
|
1337
|
+
)
|
|
1311
1338
|
);
|
|
1312
1339
|
};
|
|
1313
1340
|
var ACTIVATION_KEYS = ["Enter", " ", "Spacebar"];
|
|
@@ -1321,7 +1348,14 @@ var styles7 = StyleSheet.create({
|
|
|
1321
1348
|
flexDirection: "row",
|
|
1322
1349
|
alignItems: "flex-start",
|
|
1323
1350
|
gap: 10,
|
|
1324
|
-
marginBottom: 12
|
|
1351
|
+
marginBottom: 12,
|
|
1352
|
+
// The whole row is the Pressable, so the row IS the hit box: on RN-web `hitSlop` is inert and a
|
|
1353
|
+
// one-line label measured 36px tall (SHOWCASE-1). The 20px visual box keeps its size inside.
|
|
1354
|
+
minHeight: MIN_TOUCH_TARGET_PX
|
|
1355
|
+
},
|
|
1356
|
+
/** With no hint the row is a single line, so centre it vertically inside the floor. */
|
|
1357
|
+
centered: {
|
|
1358
|
+
alignItems: "center"
|
|
1325
1359
|
},
|
|
1326
1360
|
box: {
|
|
1327
1361
|
width: BOX_SIZE,
|
|
@@ -1398,7 +1432,12 @@ var FormCheckbox = ({
|
|
|
1398
1432
|
disabled,
|
|
1399
1433
|
onPress: toggle,
|
|
1400
1434
|
role: "checkbox",
|
|
1401
|
-
style: [
|
|
1435
|
+
style: [
|
|
1436
|
+
styles7.container,
|
|
1437
|
+
hasHint ? null : styles7.centered,
|
|
1438
|
+
containerStyle,
|
|
1439
|
+
disabled ? { opacity: DISABLED_OPACITY } : null
|
|
1440
|
+
],
|
|
1402
1441
|
testID,
|
|
1403
1442
|
...keyboardProps,
|
|
1404
1443
|
children: [
|