@khipu/design-system 0.3.5-alpha.1 → 0.3.5-alpha.3

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.
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
15
15
  * Source: design-system/src/tokens/tokens.json
16
- * Generated: 2026-08-12T21:54:49.906Z
16
+ * Generated: 2026-08-13T16:19:44.738Z
17
17
  *
18
18
  * To regenerate:
19
19
  * cd design-system && npm run tokens:generate
@@ -7989,6 +7989,24 @@ svg[fill='none'] {
7989
7989
  }
7990
7990
  }
7991
7991
 
7992
+ /* Widget embebido: dentro de un iframe los media queries de ancho evalúan el viewport
7993
+ DEL IFRAME (~420px), no la pantalla, así que el flujo se ve siempre como mobile
7994
+ aunque el usuario esté en desktop — y el tope plano, pensado para cuando la card se
7995
+ pega al borde del teléfono, queda cortando una card que en realidad flota centrada.
7996
+ `hover`/`pointer` describen el dispositivo de entrada y no el viewport, así que
7997
+ sobreviven al iframe: con mouse las cards conservan las esquinas superiores. */
7998
+ @media (hover: hover) and (pointer: fine) {
7999
+ .kds-card-elevated.kds-invoice-sticky {
8000
+ border-radius: var(--kds-radius-card);
8001
+ }
8002
+
8003
+ .kds-screen > .kds-card-elevated.kds-card-elevated--flush-top,
8004
+ .kds-card-elevated.kds-card-elevated--flush-top {
8005
+ border-top-left-radius: var(--kds-radius-card);
8006
+ border-top-right-radius: var(--kds-radius-card);
8007
+ }
8008
+ }
8009
+
7992
8010
  /* Brand logo row (external, outside cards) */
7993
8011
  .kds-brand-row {
7994
8012
  padding: 0 var(--kds-spacing-0-5);
@@ -895,10 +895,71 @@ const ui = _context.ui;
895
895
  initHideOnScroll();
896
896
  initBankModal();
897
897
  initMerchantLogoBackdrop();
898
+ initCardHeightTransition();
898
899
 
899
900
  console.log('Material Design initialization complete!');
900
901
  }
901
902
 
903
+ /**
904
+ * Initialize body card height transition (KTUF-239)
905
+ * La body card cambia de alto al pasar de una pantalla a otra (loader ↔ formulario)
906
+ * y el salto se nota, sobre todo desde que la card ya no lleva un alto mínimo fijo.
907
+ * No se puede resolver con CSS: un cambio de altura provocado por contenido no
908
+ * dispara transiciones, porque el valor declarado sigue siendo `auto` antes y
909
+ * después (ni `interpolate-size` lo cubre — ese habilita animar hacia `auto` cuando
910
+ * el valor declarado cambia, que no es el caso). Por eso se mide y se anima acá.
911
+ * @param {Element} root - Root element to scope the query (default: document)
912
+ */
913
+ function initCardHeightTransition(root) {
914
+ root = root || document;
915
+ var MIN_DELTA_PX = 8;
916
+ var DURATION_MS = 280;
917
+
918
+ if (typeof ResizeObserver === 'undefined' || typeof Element.prototype.animate !== 'function') {
919
+ return;
920
+ }
921
+ if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
922
+ return;
923
+ }
924
+
925
+ var cards = root.querySelectorAll('.kds-screen > .kds-card-elevated');
926
+ Array.prototype.forEach.call(cards, function(card) {
927
+ if (card.getAttribute('data-kds-height-transition') === 'on') {
928
+ return;
929
+ }
930
+ card.setAttribute('data-kds-height-transition', 'on');
931
+
932
+ var previous = card.offsetHeight;
933
+ var animating = false;
934
+
935
+ var observer = new ResizeObserver(function() {
936
+ // La animación cambia el alto y volveria a disparar el observer.
937
+ if (animating) {
938
+ return;
939
+ }
940
+ var next = card.offsetHeight;
941
+ // Umbral: ignora reflows menores (fuentes que cargan, scrollbars).
942
+ if (Math.abs(next - previous) < MIN_DELTA_PX) {
943
+ previous = next;
944
+ return;
945
+ }
946
+ animating = true;
947
+ var animation = card.animate(
948
+ [{ height: previous + 'px' }, { height: next + 'px' }],
949
+ { duration: DURATION_MS, easing: 'ease-out' }
950
+ );
951
+ previous = next;
952
+ animation.finished.then(function() {
953
+ animating = false;
954
+ previous = card.offsetHeight;
955
+ }).catch(function() {
956
+ animating = false;
957
+ });
958
+ });
959
+ observer.observe(card);
960
+ });
961
+ }
962
+
902
963
  /**
903
964
  * Initialize merchant logo backdrop (KTUF-204)
904
965
  * Los logos de comercio van sobre el fondo neutro, no sobre el color de marca (los PNG
@@ -1737,6 +1798,7 @@ const ui = _context.ui;
1737
1798
  window.Khipu.initBankModal = initBankModal;
1738
1799
  window.Khipu.initStickyInvoice = initStickyInvoice;
1739
1800
  window.Khipu.initHideOnScroll = initHideOnScroll;
1801
+ window.Khipu.initCardHeightTransition = initCardHeightTransition;
1740
1802
 
1741
1803
  // Also export showSnackbar to global scope for backward compatibility
1742
1804
  window.showSnackbar = showSnackbar;