@khipu/design-system 0.3.5-alpha.3 → 0.3.5-alpha.30
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/dist/beercss/khipu-beercss.css +386 -43
- package/dist/beercss/khipu-beercss.js +5 -61
- package/dist/beercss/khipu-beercss.min.css +1 -1
- package/dist/beercss/khipu-beercss.min.js +1 -1
- package/dist/beercss/khipu-beercss.scoped.css +385 -43
- package/dist/beercss/khipu-beercss.scoped.min.css +1 -1
- package/dist/beercss/metadata.json +5 -5
- package/dist/index.d.mts +55 -1
- package/dist/index.d.ts +55 -1
- package/dist/index.js +333 -321
- package/dist/index.mjs +279 -270
- package/package.json +2 -2
|
@@ -895,70 +895,15 @@ const ui = _context.ui;
|
|
|
895
895
|
initHideOnScroll();
|
|
896
896
|
initBankModal();
|
|
897
897
|
initMerchantLogoBackdrop();
|
|
898
|
-
initCardHeightTransition();
|
|
899
898
|
|
|
900
899
|
console.log('Material Design initialization complete!');
|
|
901
900
|
}
|
|
902
901
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
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
|
-
}
|
|
902
|
+
// El alto de la body card cambia de golpe entre pantallas, sin animar. Hubo una
|
|
903
|
+
// transición acá (KTUF-239) y se quitó en KTUF-314: ver el comentario en
|
|
904
|
+
// KdsThemeProvider.tsx — animar el alto obliga a fijar `height` en píxeles, y con el
|
|
905
|
+
// alto fijado no hay forma de medir el alto natural del contenido para saber cuándo
|
|
906
|
+
// soltarlo, así que la card quedaba con espacio muerto abajo.
|
|
962
907
|
|
|
963
908
|
/**
|
|
964
909
|
* Initialize merchant logo backdrop (KTUF-204)
|
|
@@ -1798,7 +1743,6 @@ const ui = _context.ui;
|
|
|
1798
1743
|
window.Khipu.initBankModal = initBankModal;
|
|
1799
1744
|
window.Khipu.initStickyInvoice = initStickyInvoice;
|
|
1800
1745
|
window.Khipu.initHideOnScroll = initHideOnScroll;
|
|
1801
|
-
window.Khipu.initCardHeightTransition = initCardHeightTransition;
|
|
1802
1746
|
|
|
1803
1747
|
// Also export showSnackbar to global scope for backward compatibility
|
|
1804
1748
|
window.showSnackbar = showSnackbar;
|