@pure-ds/core 0.6.2 → 0.6.4
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/.cursorrules +2 -1
- package/.github/copilot-instructions.md +2 -1
- package/custom-elements.json +329 -17
- package/dist/types/public/assets/js/pds-manager.d.ts +1 -1
- package/dist/types/public/assets/js/pds-manager.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-live-edit.d.ts +28 -8
- package/dist/types/public/assets/pds/components/pds-live-edit.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-enhancers.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-generator.d.ts.map +1 -1
- package/package.json +1 -1
- package/public/assets/js/app.js +58 -16
- package/public/assets/js/pds-manager.js +157 -157
- package/public/assets/js/pds.js +5 -5
- package/public/assets/pds/components/pds-live-edit.js +1939 -1554
- package/public/assets/pds/custom-elements.json +329 -17
- package/public/assets/pds/pds-css-complete.json +1 -1
- package/public/assets/pds/vscode-custom-data.json +9 -7
- package/src/js/pds-core/pds-enhancers.js +72 -41
- package/src/js/pds-core/pds-generator.js +63 -49
|
@@ -1256,6 +1256,327 @@
|
|
|
1256
1256
|
}
|
|
1257
1257
|
]
|
|
1258
1258
|
},
|
|
1259
|
+
{
|
|
1260
|
+
"kind": "javascript-module",
|
|
1261
|
+
"path": "public/assets/pds/components/pds-live-edit.js",
|
|
1262
|
+
"declarations": [
|
|
1263
|
+
{
|
|
1264
|
+
"kind": "variable",
|
|
1265
|
+
"name": "EDITOR_TAG",
|
|
1266
|
+
"type": {
|
|
1267
|
+
"text": "string"
|
|
1268
|
+
},
|
|
1269
|
+
"default": "\"pds-live-edit\""
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
"kind": "class",
|
|
1273
|
+
"description": "",
|
|
1274
|
+
"name": "PdsLiveEdit",
|
|
1275
|
+
"members": [
|
|
1276
|
+
{
|
|
1277
|
+
"kind": "method",
|
|
1278
|
+
"name": "_teardown"
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
"kind": "method",
|
|
1282
|
+
"name": "_handleMouseOver",
|
|
1283
|
+
"parameters": [
|
|
1284
|
+
{
|
|
1285
|
+
"name": "event"
|
|
1286
|
+
}
|
|
1287
|
+
]
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
"kind": "method",
|
|
1291
|
+
"name": "_handleMouseOut",
|
|
1292
|
+
"parameters": [
|
|
1293
|
+
{
|
|
1294
|
+
"name": "event"
|
|
1295
|
+
}
|
|
1296
|
+
]
|
|
1297
|
+
},
|
|
1298
|
+
{
|
|
1299
|
+
"kind": "method",
|
|
1300
|
+
"name": "_findEditableTarget",
|
|
1301
|
+
"parameters": [
|
|
1302
|
+
{
|
|
1303
|
+
"name": "node"
|
|
1304
|
+
}
|
|
1305
|
+
]
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
"kind": "method",
|
|
1309
|
+
"name": "_showForTarget",
|
|
1310
|
+
"parameters": [
|
|
1311
|
+
{
|
|
1312
|
+
"name": "target"
|
|
1313
|
+
}
|
|
1314
|
+
]
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
"kind": "method",
|
|
1318
|
+
"name": "_removeActiveUI"
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
"kind": "method",
|
|
1322
|
+
"name": "_addDocumentListeners"
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
"kind": "method",
|
|
1326
|
+
"name": "_removeDocumentListeners"
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
"kind": "method",
|
|
1330
|
+
"name": "_handleDocumentPointer",
|
|
1331
|
+
"parameters": [
|
|
1332
|
+
{
|
|
1333
|
+
"name": "event"
|
|
1334
|
+
}
|
|
1335
|
+
]
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
"kind": "method",
|
|
1339
|
+
"name": "_handleDocumentKeydown",
|
|
1340
|
+
"parameters": [
|
|
1341
|
+
{
|
|
1342
|
+
"name": "event"
|
|
1343
|
+
}
|
|
1344
|
+
]
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
"kind": "method",
|
|
1348
|
+
"name": "_scheduleClose"
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
"kind": "method",
|
|
1352
|
+
"name": "_clearCloseTimer"
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
"kind": "method",
|
|
1356
|
+
"name": "_addRepositionListeners"
|
|
1357
|
+
},
|
|
1358
|
+
{
|
|
1359
|
+
"kind": "method",
|
|
1360
|
+
"name": "_removeRepositionListeners"
|
|
1361
|
+
},
|
|
1362
|
+
{
|
|
1363
|
+
"kind": "method",
|
|
1364
|
+
"name": "_repositionDropdown"
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
"kind": "method",
|
|
1368
|
+
"name": "_positionDropdown",
|
|
1369
|
+
"parameters": [
|
|
1370
|
+
{
|
|
1371
|
+
"name": "target"
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
"name": "dropdown"
|
|
1375
|
+
}
|
|
1376
|
+
]
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
"kind": "method",
|
|
1380
|
+
"name": "_handleMouseMove",
|
|
1381
|
+
"parameters": [
|
|
1382
|
+
{
|
|
1383
|
+
"name": "event"
|
|
1384
|
+
}
|
|
1385
|
+
]
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
"kind": "method",
|
|
1389
|
+
"name": "_isPointerWithinSafeZone"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
"kind": "method",
|
|
1393
|
+
"name": "_buildDropdown",
|
|
1394
|
+
"parameters": [
|
|
1395
|
+
{
|
|
1396
|
+
"name": "target"
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
"name": "quickPaths"
|
|
1400
|
+
},
|
|
1401
|
+
{
|
|
1402
|
+
"name": "hints"
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
"name": "debug"
|
|
1406
|
+
}
|
|
1407
|
+
]
|
|
1408
|
+
},
|
|
1409
|
+
{
|
|
1410
|
+
"kind": "method",
|
|
1411
|
+
"name": "_renderQuickForm",
|
|
1412
|
+
"parameters": [
|
|
1413
|
+
{
|
|
1414
|
+
"name": "container"
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
"name": "paths"
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
"name": "design"
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
"name": "hints"
|
|
1424
|
+
}
|
|
1425
|
+
]
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
"kind": "method",
|
|
1429
|
+
"name": "_openDrawer",
|
|
1430
|
+
"parameters": [
|
|
1431
|
+
{
|
|
1432
|
+
"name": "target"
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
"name": "quickPaths"
|
|
1436
|
+
}
|
|
1437
|
+
]
|
|
1438
|
+
},
|
|
1439
|
+
{
|
|
1440
|
+
"kind": "method",
|
|
1441
|
+
"name": "_handleValueChange",
|
|
1442
|
+
"parameters": [
|
|
1443
|
+
{
|
|
1444
|
+
"name": "event"
|
|
1445
|
+
}
|
|
1446
|
+
]
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
"kind": "method",
|
|
1450
|
+
"name": "_schedulePatch",
|
|
1451
|
+
"parameters": [
|
|
1452
|
+
{
|
|
1453
|
+
"name": "patch"
|
|
1454
|
+
}
|
|
1455
|
+
]
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
"kind": "field",
|
|
1459
|
+
"name": "_boundMouseOver"
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
"kind": "field",
|
|
1463
|
+
"name": "_boundMouseOut"
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
"kind": "field",
|
|
1467
|
+
"name": "_boundMouseMove"
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
"kind": "field",
|
|
1471
|
+
"name": "_boundReposition"
|
|
1472
|
+
},
|
|
1473
|
+
{
|
|
1474
|
+
"kind": "field",
|
|
1475
|
+
"name": "_activeTarget",
|
|
1476
|
+
"type": {
|
|
1477
|
+
"text": "null"
|
|
1478
|
+
},
|
|
1479
|
+
"default": "null"
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
"kind": "field",
|
|
1483
|
+
"name": "_activeDropdown",
|
|
1484
|
+
"type": {
|
|
1485
|
+
"text": "null"
|
|
1486
|
+
},
|
|
1487
|
+
"default": "null"
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
"kind": "field",
|
|
1491
|
+
"name": "_holdOpen",
|
|
1492
|
+
"type": {
|
|
1493
|
+
"text": "boolean"
|
|
1494
|
+
},
|
|
1495
|
+
"default": "false"
|
|
1496
|
+
},
|
|
1497
|
+
{
|
|
1498
|
+
"kind": "field",
|
|
1499
|
+
"name": "_closeTimer",
|
|
1500
|
+
"type": {
|
|
1501
|
+
"text": "null"
|
|
1502
|
+
},
|
|
1503
|
+
"default": "null"
|
|
1504
|
+
},
|
|
1505
|
+
{
|
|
1506
|
+
"kind": "field",
|
|
1507
|
+
"name": "_drawer",
|
|
1508
|
+
"type": {
|
|
1509
|
+
"text": "null"
|
|
1510
|
+
},
|
|
1511
|
+
"default": "null"
|
|
1512
|
+
},
|
|
1513
|
+
{
|
|
1514
|
+
"kind": "field",
|
|
1515
|
+
"name": "_pendingPatch",
|
|
1516
|
+
"type": {
|
|
1517
|
+
"text": "null"
|
|
1518
|
+
},
|
|
1519
|
+
"default": "null"
|
|
1520
|
+
},
|
|
1521
|
+
{
|
|
1522
|
+
"kind": "field",
|
|
1523
|
+
"name": "_applyTimer",
|
|
1524
|
+
"type": {
|
|
1525
|
+
"text": "null"
|
|
1526
|
+
},
|
|
1527
|
+
"default": "null"
|
|
1528
|
+
},
|
|
1529
|
+
{
|
|
1530
|
+
"kind": "field",
|
|
1531
|
+
"name": "_selectors",
|
|
1532
|
+
"type": {
|
|
1533
|
+
"text": "null"
|
|
1534
|
+
},
|
|
1535
|
+
"default": "null"
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
"kind": "field",
|
|
1539
|
+
"name": "_lastPointer",
|
|
1540
|
+
"type": {
|
|
1541
|
+
"text": "null"
|
|
1542
|
+
},
|
|
1543
|
+
"default": "null"
|
|
1544
|
+
},
|
|
1545
|
+
{
|
|
1546
|
+
"kind": "field",
|
|
1547
|
+
"name": "_boundDocPointer"
|
|
1548
|
+
},
|
|
1549
|
+
{
|
|
1550
|
+
"kind": "field",
|
|
1551
|
+
"name": "_boundDocKeydown"
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
"kind": "field",
|
|
1555
|
+
"name": "_connected",
|
|
1556
|
+
"type": {
|
|
1557
|
+
"text": "boolean"
|
|
1558
|
+
},
|
|
1559
|
+
"default": "false"
|
|
1560
|
+
}
|
|
1561
|
+
],
|
|
1562
|
+
"superclass": {
|
|
1563
|
+
"name": "HTMLElement"
|
|
1564
|
+
},
|
|
1565
|
+
"tagName": "EDITOR_TAG",
|
|
1566
|
+
"customElement": true
|
|
1567
|
+
}
|
|
1568
|
+
],
|
|
1569
|
+
"exports": [
|
|
1570
|
+
{
|
|
1571
|
+
"kind": "custom-element-definition",
|
|
1572
|
+
"name": "EDITOR_TAG",
|
|
1573
|
+
"declaration": {
|
|
1574
|
+
"name": "PdsLiveEdit",
|
|
1575
|
+
"module": "public/assets/pds/components/pds-live-edit.js"
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
]
|
|
1579
|
+
},
|
|
1259
1580
|
{
|
|
1260
1581
|
"kind": "javascript-module",
|
|
1261
1582
|
"path": "public/assets/pds/components/pds-omnibox.js",
|
|
@@ -1306,6 +1627,10 @@
|
|
|
1306
1627
|
"kind": "field",
|
|
1307
1628
|
"name": "icon"
|
|
1308
1629
|
},
|
|
1630
|
+
{
|
|
1631
|
+
"kind": "field",
|
|
1632
|
+
"name": "itemGrid"
|
|
1633
|
+
},
|
|
1309
1634
|
{
|
|
1310
1635
|
"kind": "method",
|
|
1311
1636
|
"name": "formAssociatedCallback"
|
|
@@ -1382,6 +1707,9 @@
|
|
|
1382
1707
|
},
|
|
1383
1708
|
{
|
|
1384
1709
|
"name": "icon"
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
"name": "item-grid"
|
|
1385
1713
|
}
|
|
1386
1714
|
],
|
|
1387
1715
|
"superclass": {
|
|
@@ -2240,23 +2568,7 @@
|
|
|
2240
2568
|
"kind": "class",
|
|
2241
2569
|
"description": "",
|
|
2242
2570
|
"name": "PdsTheme",
|
|
2243
|
-
"members": [
|
|
2244
|
-
{
|
|
2245
|
-
"kind": "field",
|
|
2246
|
-
"name": "label",
|
|
2247
|
-
"description": "Gets the legend/aria-label text to display.",
|
|
2248
|
-
"return": {
|
|
2249
|
-
"type": {
|
|
2250
|
-
"text": "string"
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
],
|
|
2255
|
-
"attributes": [
|
|
2256
|
-
{
|
|
2257
|
-
"name": "label"
|
|
2258
|
-
}
|
|
2259
|
-
],
|
|
2571
|
+
"members": [],
|
|
2260
2572
|
"superclass": {
|
|
2261
2573
|
"name": "HTMLElement"
|
|
2262
2574
|
},
|
|
@@ -2292,7 +2292,7 @@
|
|
|
2292
2292
|
],
|
|
2293
2293
|
"metadata": {
|
|
2294
2294
|
"generator": "PDS CSS Data Generator",
|
|
2295
|
-
"generatedAt": "2026-02-
|
|
2295
|
+
"generatedAt": "2026-02-17T11:41:36.229Z",
|
|
2296
2296
|
"totalProperties": 169,
|
|
2297
2297
|
"totalClasses": 169,
|
|
2298
2298
|
"totalAttributes": 4
|
|
@@ -689,6 +689,10 @@
|
|
|
689
689
|
}
|
|
690
690
|
]
|
|
691
691
|
},
|
|
692
|
+
{
|
|
693
|
+
"name": "EDITOR_TAG",
|
|
694
|
+
"description": "PdsLiveEdit component"
|
|
695
|
+
},
|
|
692
696
|
{
|
|
693
697
|
"name": "pds-omnibox",
|
|
694
698
|
"description": "PdsOmnibox component",
|
|
@@ -720,6 +724,10 @@
|
|
|
720
724
|
{
|
|
721
725
|
"name": "icon",
|
|
722
726
|
"description": ""
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"name": "item-grid",
|
|
730
|
+
"description": ""
|
|
723
731
|
}
|
|
724
732
|
]
|
|
725
733
|
},
|
|
@@ -839,13 +847,7 @@
|
|
|
839
847
|
},
|
|
840
848
|
{
|
|
841
849
|
"name": "pds-theme",
|
|
842
|
-
"description": "PdsTheme component"
|
|
843
|
-
"attributes": [
|
|
844
|
-
{
|
|
845
|
-
"name": "label",
|
|
846
|
-
"description": ""
|
|
847
|
-
}
|
|
848
|
-
]
|
|
850
|
+
"description": "PdsTheme component"
|
|
849
851
|
},
|
|
850
852
|
{
|
|
851
853
|
"name": "pds-toaster",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PDS Enhancers - Single Source of Truth
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* This file defines all progressive enhancements for the Pure Design System.
|
|
5
5
|
* Each enhancer has:
|
|
6
6
|
* - selector: CSS selector to target elements
|
|
@@ -30,24 +30,28 @@ function enhanceAccordion(elem) {
|
|
|
30
30
|
if (elem.dataset.enhancedAccordion) return;
|
|
31
31
|
elem.dataset.enhancedAccordion = "true";
|
|
32
32
|
|
|
33
|
-
elem.addEventListener(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
elem.addEventListener(
|
|
34
|
+
"toggle",
|
|
35
|
+
(event) => {
|
|
36
|
+
// Only handle toggle events from direct child details elements
|
|
37
|
+
// to avoid closing parent details when nested accordions are used
|
|
38
|
+
if (event.target.open && event.target.parentElement === elem) {
|
|
39
|
+
elem.querySelectorAll(":scope > details[open]").forEach((details) => {
|
|
40
|
+
if (details !== event.target) {
|
|
41
|
+
details.open = false;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
true,
|
|
47
|
+
);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
function enhanceDropdown(elem) {
|
|
47
51
|
if (elem.dataset.enhancedDropdown) return;
|
|
48
52
|
elem.dataset.enhancedDropdown = "true";
|
|
49
|
-
const menu = elem.lastElementChild
|
|
50
|
-
|
|
53
|
+
const menu = elem.lastElementChild;
|
|
54
|
+
|
|
51
55
|
if (!menu) return;
|
|
52
56
|
|
|
53
57
|
const trigger =
|
|
@@ -90,7 +94,7 @@ function enhanceDropdown(elem) {
|
|
|
90
94
|
menu?.offsetHeight || 0,
|
|
91
95
|
menu?.scrollHeight || 0,
|
|
92
96
|
menuRect.height || 0,
|
|
93
|
-
200
|
|
97
|
+
200,
|
|
94
98
|
);
|
|
95
99
|
const spaceBelow = Math.max(0, window.innerHeight - rect.bottom);
|
|
96
100
|
const spaceAbove = Math.max(0, rect.top);
|
|
@@ -105,7 +109,12 @@ function enhanceDropdown(elem) {
|
|
|
105
109
|
elem.getAttribute("data-dropdown-align") ||
|
|
106
110
|
"auto"
|
|
107
111
|
).toLowerCase();
|
|
108
|
-
if (
|
|
112
|
+
if (
|
|
113
|
+
align === "left" ||
|
|
114
|
+
align === "right" ||
|
|
115
|
+
align === "start" ||
|
|
116
|
+
align === "end"
|
|
117
|
+
) {
|
|
109
118
|
return align === "start" ? "left" : align === "end" ? "right" : align;
|
|
110
119
|
}
|
|
111
120
|
const rect = elem.getBoundingClientRect();
|
|
@@ -114,7 +123,7 @@ function enhanceDropdown(elem) {
|
|
|
114
123
|
menu?.offsetWidth || 0,
|
|
115
124
|
menu?.scrollWidth || 0,
|
|
116
125
|
menuRect.width || 0,
|
|
117
|
-
240
|
|
126
|
+
240,
|
|
118
127
|
);
|
|
119
128
|
const spaceRight = Math.max(0, window.innerWidth - rect.left);
|
|
120
129
|
const spaceLeft = Math.max(0, rect.right);
|
|
@@ -123,16 +132,42 @@ function enhanceDropdown(elem) {
|
|
|
123
132
|
return spaceLeft > spaceRight ? "right" : "left";
|
|
124
133
|
};
|
|
125
134
|
|
|
135
|
+
// Store click handler reference for cleanup
|
|
136
|
+
let clickHandler = null;
|
|
137
|
+
|
|
126
138
|
const openMenu = () => {
|
|
127
139
|
elem.dataset.dropdownDirection = resolveDirection();
|
|
128
140
|
elem.dataset.dropdownAlign = resolveAlign();
|
|
129
141
|
menu.setAttribute("aria-hidden", "false");
|
|
130
142
|
trigger?.setAttribute("aria-expanded", "true");
|
|
143
|
+
|
|
144
|
+
// Add click-outside handler when opening
|
|
145
|
+
if (!clickHandler) {
|
|
146
|
+
clickHandler = (event) => {
|
|
147
|
+
// Use composedPath() to handle Shadow DOM
|
|
148
|
+
const path = event.composedPath ? event.composedPath() : [event.target];
|
|
149
|
+
const clickedInside = path.some((node) => node === elem);
|
|
150
|
+
|
|
151
|
+
if (!clickedInside) {
|
|
152
|
+
closeMenu();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
// Use a slight delay to avoid closing immediately if this was triggered by a click
|
|
156
|
+
setTimeout(() => {
|
|
157
|
+
document.addEventListener("click", clickHandler);
|
|
158
|
+
}, 0);
|
|
159
|
+
}
|
|
131
160
|
};
|
|
132
161
|
|
|
133
162
|
const closeMenu = () => {
|
|
134
163
|
menu.setAttribute("aria-hidden", "true");
|
|
135
164
|
trigger?.setAttribute("aria-expanded", "false");
|
|
165
|
+
|
|
166
|
+
// Remove click-outside handler when closing
|
|
167
|
+
if (clickHandler) {
|
|
168
|
+
document.removeEventListener("click", clickHandler);
|
|
169
|
+
clickHandler = null;
|
|
170
|
+
}
|
|
136
171
|
};
|
|
137
172
|
|
|
138
173
|
const toggleMenu = () => {
|
|
@@ -149,12 +184,6 @@ function enhanceDropdown(elem) {
|
|
|
149
184
|
toggleMenu();
|
|
150
185
|
});
|
|
151
186
|
|
|
152
|
-
document.addEventListener("click", (event) => {
|
|
153
|
-
if (!elem.contains(event.target)) {
|
|
154
|
-
closeMenu();
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
|
|
158
187
|
elem.addEventListener("keydown", (event) => {
|
|
159
188
|
if (event.key === "Escape") {
|
|
160
189
|
closeMenu();
|
|
@@ -163,8 +192,15 @@ function enhanceDropdown(elem) {
|
|
|
163
192
|
});
|
|
164
193
|
|
|
165
194
|
elem.addEventListener("focusout", (event) => {
|
|
166
|
-
if
|
|
167
|
-
|
|
195
|
+
// Only close if focus is explicitly moving to an element outside the dropdown
|
|
196
|
+
// Don't close if relatedTarget is null (which happens when clicking non-focusable elements inside)
|
|
197
|
+
// Use composedPath() to handle Shadow DOM properly
|
|
198
|
+
if (event.relatedTarget) {
|
|
199
|
+
const path = event.composedPath ? event.composedPath() : [event.relatedTarget];
|
|
200
|
+
const focusedInside = path.some((node) => node === elem);
|
|
201
|
+
if (!focusedInside) {
|
|
202
|
+
closeMenu();
|
|
203
|
+
}
|
|
168
204
|
}
|
|
169
205
|
});
|
|
170
206
|
}
|
|
@@ -298,20 +334,18 @@ function enhanceRange(elem) {
|
|
|
298
334
|
}
|
|
299
335
|
|
|
300
336
|
function enhanceRequired(elem) {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
337
|
+
if (elem.dataset.enhancedRequired) return;
|
|
338
|
+
elem.dataset.enhancedRequired = "true";
|
|
339
|
+
|
|
305
340
|
const enhanceRequiredField = (input) => {
|
|
306
341
|
let label;
|
|
307
|
-
if(input.closest("[role$=group]")) {
|
|
342
|
+
if (input.closest("[role$=group]")) {
|
|
343
|
+
// Handles both radiogroup and group
|
|
308
344
|
label = input.closest("[role$=group]").querySelector("legend");
|
|
309
|
-
}
|
|
310
|
-
else{
|
|
345
|
+
} else {
|
|
311
346
|
label = input.closest("label");
|
|
312
347
|
}
|
|
313
348
|
if (!label) return;
|
|
314
|
-
|
|
315
349
|
|
|
316
350
|
if (label.querySelector(".required-asterisk")) return;
|
|
317
351
|
|
|
@@ -339,15 +373,14 @@ function enhanceRequired(elem) {
|
|
|
339
373
|
legend.textContent = "* Required fields";
|
|
340
374
|
form.insertBefore(
|
|
341
375
|
legend,
|
|
342
|
-
form.querySelector(".form-actions") || form.lastElementChild
|
|
376
|
+
form.querySelector(".form-actions") || form.lastElementChild,
|
|
343
377
|
);
|
|
344
378
|
}
|
|
345
|
-
}
|
|
379
|
+
};
|
|
346
380
|
|
|
347
381
|
elem.querySelectorAll("[required]").forEach((input) => {
|
|
348
382
|
enhanceRequiredField(input);
|
|
349
383
|
});
|
|
350
|
-
|
|
351
384
|
}
|
|
352
385
|
|
|
353
386
|
function enhanceOpenGroup(elem) {
|
|
@@ -362,7 +395,7 @@ function enhanceOpenGroup(elem) {
|
|
|
362
395
|
addInput.classList.add("input-text", "input-sm");
|
|
363
396
|
addInput.style.width = "auto";
|
|
364
397
|
const firstInput = elem.querySelector(
|
|
365
|
-
'input[type="radio"], input[type="checkbox"]'
|
|
398
|
+
'input[type="radio"], input[type="checkbox"]',
|
|
366
399
|
);
|
|
367
400
|
|
|
368
401
|
elem.appendChild(addInput);
|
|
@@ -373,9 +406,7 @@ function enhanceOpenGroup(elem) {
|
|
|
373
406
|
event.preventDefault();
|
|
374
407
|
|
|
375
408
|
const type = firstInput.type === "radio" ? "radio" : "checkbox";
|
|
376
|
-
const id = `open-group-${Math.random()
|
|
377
|
-
.toString(36)
|
|
378
|
-
.substring(2, 11)}`;
|
|
409
|
+
const id = `open-group-${Math.random().toString(36).substring(2, 11)}`;
|
|
379
410
|
const label = document.createElement("label");
|
|
380
411
|
|
|
381
412
|
const span = document.createElement("span");
|
|
@@ -510,7 +541,7 @@ const enhancerRunners = new Map([
|
|
|
510
541
|
/**
|
|
511
542
|
* Complete enhancers with runtime functions.
|
|
512
543
|
* Used by PDS.enhancer() and AutoDefiner at runtime.
|
|
513
|
-
*
|
|
544
|
+
*
|
|
514
545
|
* This is the canonical runtime array of enhancer objects.
|
|
515
546
|
*/
|
|
516
547
|
export const defaultPDSEnhancers = enhancerDefinitions.map((meta) => ({
|