@khipu/design-system 0.2.0-alpha.7 → 0.2.0-alpha.70

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.
@@ -991,10 +991,15 @@ const ui = _context.ui;
991
991
 
992
992
  if (!logoSource) return;
993
993
 
994
+ // Insert inside the amount div (first child of .kds-invoice-header)
995
+ var header = card.querySelector('.kds-invoice-header');
996
+ var amountDiv = header ? header.firstElementChild : null;
997
+ if (!amountDiv) return;
998
+
994
999
  var inner = document.createElement('div');
995
1000
  inner.className = 'kds-brand-inner';
996
1001
  inner.appendChild(logoSource.cloneNode(true));
997
- card.insertBefore(inner, card.firstChild);
1002
+ amountDiv.insertBefore(inner, amountDiv.firstChild);
998
1003
  });
999
1004
  }
1000
1005
 
@@ -1325,9 +1330,9 @@ const ui = _context.ui;
1325
1330
  function initStickyInvoice(root) {
1326
1331
  root = root || document;
1327
1332
 
1328
- // Progressive collapse range: 0px (expanded) to 60px (collapsed)
1333
+ // Progressive collapse range: 0px (expanded) to 20px (collapsed)
1329
1334
  var COLLAPSE_START = 0;
1330
- var COLLAPSE_END = 60;
1335
+ var COLLAPSE_END = 20;
1331
1336
 
1332
1337
  var lastScrollY = 0;
1333
1338
  var ticking = false;
@@ -1382,6 +1387,19 @@ const ui = _context.ui;
1382
1387
  // Single DOM write per frame — set on screen (parent) so it cascades to sticky + siblings
1383
1388
  currentScreen.style.setProperty('--collapse-progress', progress);
1384
1389
 
1390
+ // Toggle collapsed state class for discrete styling that can't interpolate (e.g. align-items)
1391
+ currentSticky.classList.toggle('is-collapsed', progress >= 1);
1392
+
1393
+ // Close expand panels as soon as the sticky header starts collapsing
1394
+ if (progress > 0) {
1395
+ currentSticky.querySelectorAll('[data-expand-toggle][aria-expanded="true"]').forEach(function(toggle) {
1396
+ toggle.setAttribute('aria-expanded', 'false');
1397
+ var panelId = toggle.getAttribute('aria-controls');
1398
+ var panel = panelId ? document.getElementById(panelId) : null;
1399
+ if (panel) panel.classList.remove('open');
1400
+ });
1401
+ }
1402
+
1385
1403
  lastScrollY = scrollY;
1386
1404
  });
1387
1405
  }
@@ -1395,6 +1413,9 @@ const ui = _context.ui;
1395
1413
  screen.style.removeProperty('--collapse-progress');
1396
1414
  screen.style.removeProperty('--collapse-collapsible-h');
1397
1415
  });
1416
+ root.querySelectorAll('.kds-invoice-sticky.is-collapsed').forEach(function(el) {
1417
+ el.classList.remove('is-collapsed');
1418
+ });
1398
1419
  }
1399
1420
  });
1400
1421
 
@@ -1446,7 +1467,7 @@ const ui = _context.ui;
1446
1467
  var rows = container.querySelectorAll('.kds-copyable-table-row[data-copy]');
1447
1468
  var values = [];
1448
1469
  rows.forEach(function(r) {
1449
- var key = r.querySelector('.k');
1470
+ var key = r.querySelector('.kds-key');
1450
1471
  var val = r.dataset.copy;
1451
1472
  if (key) {
1452
1473
  values.push(key.textContent.trim() + ': ' + val);