@orion-studios/payload-studio 0.6.0-beta.140 → 0.6.0-beta.141

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.
@@ -1405,10 +1405,69 @@ var decorateBuilderNumericSteppers = (root = document) => {
1405
1405
  field.appendChild(stepper);
1406
1406
  });
1407
1407
  };
1408
+ var getStylePanelTabFields = (panel) => Array.from(
1409
+ panel.querySelectorAll(
1410
+ [
1411
+ 'input:not([type="hidden"]):not([type="radio"]):not([disabled])',
1412
+ "select:not([disabled])",
1413
+ "textarea:not([disabled])"
1414
+ ].join(",")
1415
+ )
1416
+ ).filter((element) => element.tabIndex >= 0 && element.offsetParent !== null).sort((first, second) => {
1417
+ const firstRect = first.getBoundingClientRect();
1418
+ const secondRect = second.getBoundingClientRect();
1419
+ const rowDelta = firstRect.top - secondRect.top;
1420
+ if (Math.abs(rowDelta) > 4) {
1421
+ return rowDelta;
1422
+ }
1423
+ return firstRect.left - secondRect.left;
1424
+ });
1425
+ var decorateStylePanelTabOrder = () => {
1426
+ const panel = document.getElementById("orion-builder-v2-styles");
1427
+ if (!panel) {
1428
+ return;
1429
+ }
1430
+ panel.querySelectorAll('input[type="radio"]').forEach((input) => {
1431
+ input.tabIndex = -1;
1432
+ });
1433
+ if (panel.dataset.orionTabOrderBound === "true") {
1434
+ return;
1435
+ }
1436
+ panel.dataset.orionTabOrderBound = "true";
1437
+ panel.addEventListener(
1438
+ "keydown",
1439
+ (event) => {
1440
+ if (event.key !== "Tab" || event.defaultPrevented) {
1441
+ return;
1442
+ }
1443
+ const activeElement = document.activeElement;
1444
+ if (!activeElement || !panel.contains(activeElement)) {
1445
+ return;
1446
+ }
1447
+ const fields = getStylePanelTabFields(panel);
1448
+ const currentIndex = fields.indexOf(activeElement);
1449
+ if (currentIndex < 0) {
1450
+ return;
1451
+ }
1452
+ const nextIndex = event.shiftKey ? currentIndex - 1 : currentIndex + 1;
1453
+ const nextField = fields[nextIndex];
1454
+ if (!nextField) {
1455
+ return;
1456
+ }
1457
+ event.preventDefault();
1458
+ nextField.focus();
1459
+ if (nextField instanceof HTMLInputElement || nextField instanceof HTMLTextAreaElement) {
1460
+ nextField.select?.();
1461
+ }
1462
+ },
1463
+ true
1464
+ );
1465
+ };
1408
1466
  var decorateBuilderControls = (root = document) => {
1409
1467
  decorateBuilderSettingHelp(root);
1410
1468
  decorateBuilderColorEyeDroppers(root);
1411
1469
  decorateBuilderNumericSteppers(root);
1470
+ decorateStylePanelTabOrder();
1412
1471
  };
1413
1472
  var closeBuilderHelpPopovers = (except) => {
1414
1473
  document.querySelectorAll(".is-builder-help-open").forEach((element) => {
@@ -1281,10 +1281,69 @@ var decorateBuilderNumericSteppers = (root = document) => {
1281
1281
  field.appendChild(stepper);
1282
1282
  });
1283
1283
  };
1284
+ var getStylePanelTabFields = (panel) => Array.from(
1285
+ panel.querySelectorAll(
1286
+ [
1287
+ 'input:not([type="hidden"]):not([type="radio"]):not([disabled])',
1288
+ "select:not([disabled])",
1289
+ "textarea:not([disabled])"
1290
+ ].join(",")
1291
+ )
1292
+ ).filter((element) => element.tabIndex >= 0 && element.offsetParent !== null).sort((first, second) => {
1293
+ const firstRect = first.getBoundingClientRect();
1294
+ const secondRect = second.getBoundingClientRect();
1295
+ const rowDelta = firstRect.top - secondRect.top;
1296
+ if (Math.abs(rowDelta) > 4) {
1297
+ return rowDelta;
1298
+ }
1299
+ return firstRect.left - secondRect.left;
1300
+ });
1301
+ var decorateStylePanelTabOrder = () => {
1302
+ const panel = document.getElementById("orion-builder-v2-styles");
1303
+ if (!panel) {
1304
+ return;
1305
+ }
1306
+ panel.querySelectorAll('input[type="radio"]').forEach((input) => {
1307
+ input.tabIndex = -1;
1308
+ });
1309
+ if (panel.dataset.orionTabOrderBound === "true") {
1310
+ return;
1311
+ }
1312
+ panel.dataset.orionTabOrderBound = "true";
1313
+ panel.addEventListener(
1314
+ "keydown",
1315
+ (event) => {
1316
+ if (event.key !== "Tab" || event.defaultPrevented) {
1317
+ return;
1318
+ }
1319
+ const activeElement = document.activeElement;
1320
+ if (!activeElement || !panel.contains(activeElement)) {
1321
+ return;
1322
+ }
1323
+ const fields = getStylePanelTabFields(panel);
1324
+ const currentIndex = fields.indexOf(activeElement);
1325
+ if (currentIndex < 0) {
1326
+ return;
1327
+ }
1328
+ const nextIndex = event.shiftKey ? currentIndex - 1 : currentIndex + 1;
1329
+ const nextField = fields[nextIndex];
1330
+ if (!nextField) {
1331
+ return;
1332
+ }
1333
+ event.preventDefault();
1334
+ nextField.focus();
1335
+ if (nextField instanceof HTMLInputElement || nextField instanceof HTMLTextAreaElement) {
1336
+ nextField.select?.();
1337
+ }
1338
+ },
1339
+ true
1340
+ );
1341
+ };
1284
1342
  var decorateBuilderControls = (root = document) => {
1285
1343
  decorateBuilderSettingHelp(root);
1286
1344
  decorateBuilderColorEyeDroppers(root);
1287
1345
  decorateBuilderNumericSteppers(root);
1346
+ decorateStylePanelTabOrder();
1288
1347
  };
1289
1348
  var closeBuilderHelpPopovers = (except) => {
1290
1349
  document.querySelectorAll(".is-builder-help-open").forEach((element) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.140",
3
+ "version": "0.6.0-beta.141",
4
4
  "description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",