@khipu/design-system 0.3.4 → 0.3.5-alpha.2
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 +62 -17
- package/dist/beercss/khipu-beercss.js +62 -0
- 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 +62 -17
- package/dist/beercss/khipu-beercss.scoped.min.css +1 -1
- package/dist/beercss/metadata.json +5 -5
- package/dist/index.js +213 -147
- package/dist/index.mjs +83 -17
- package/package.json +1 -1
|
@@ -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-
|
|
16
|
+
* Generated: 2026-08-13T15:55:41.056Z
|
|
17
17
|
*
|
|
18
18
|
* To regenerate:
|
|
19
19
|
* cd design-system && npm run tokens:generate
|
|
@@ -685,6 +685,37 @@ body.dark,
|
|
|
685
685
|
--outline: var(--kds-color-input-border);
|
|
686
686
|
--outline-variant: var(--kds-border-light);
|
|
687
687
|
|
|
688
|
+
/* ========================================
|
|
689
|
+
EXTENDED BRAND ROLES
|
|
690
|
+
|
|
691
|
+
Several roles used to resolve straight to --kds-color-primary-main, which
|
|
692
|
+
meant a brand could not have (say) a green link next to a navy button.
|
|
693
|
+
They are split into their own tokens:
|
|
694
|
+
|
|
695
|
+
--kds-color-accent form icon, expand toggle, checkbox/radio
|
|
696
|
+
--kds-color-accent-soft form icon backdrop
|
|
697
|
+
--kds-font-family-heading display/heading tier
|
|
698
|
+
--kds-invoice-amount-font-family
|
|
699
|
+
--kds-invoice-amount-color
|
|
700
|
+
--kds-button-font-family
|
|
701
|
+
--kds-button-text-transform
|
|
702
|
+
--kds-button-primary-bg
|
|
703
|
+
--kds-button-primary-bg-hover
|
|
704
|
+
|
|
705
|
+
These are deliberately NOT declared here. Each one is consumed as
|
|
706
|
+
var(--new-token, <the expression it used to be>), so the default is
|
|
707
|
+
supplied at the point of use.
|
|
708
|
+
|
|
709
|
+
Declaring them as :root aliases looks equivalent but is not. A custom
|
|
710
|
+
property is substituted on the element that DECLARES it, so
|
|
711
|
+
`--kds-color-accent: var(--kds-color-primary-main)` on :root freezes to
|
|
712
|
+
whatever the primary is at :root. A brand that sets its primary further
|
|
713
|
+
down the tree (which is how khenshin-web applies merchant styles) would
|
|
714
|
+
inherit the already-resolved Khipu purple and lose its own colour. Using
|
|
715
|
+
them as fallbacks resolves against the primary in effect at the consuming
|
|
716
|
+
element, so unbranded output and existing brands are both unchanged.
|
|
717
|
+
======================================== */
|
|
718
|
+
|
|
688
719
|
/* ========================================
|
|
689
720
|
ONBOARDING COMPONENTS TOKENS
|
|
690
721
|
======================================== */
|
|
@@ -1010,12 +1041,12 @@ a.kds-btn {
|
|
|
1010
1041
|
width: 100%;
|
|
1011
1042
|
|
|
1012
1043
|
/* Typography - Using design tokens */
|
|
1013
|
-
font-family: var(--kds-font-family-secondary);
|
|
1044
|
+
font-family: var(--kds-button-font-family, var(--kds-font-family-secondary));
|
|
1014
1045
|
font-weight: var(--kds-font-weight-medium); /* 500 */
|
|
1015
1046
|
font-size: var(--kds-typography-button-font-size); /* 0.875rem = 14px */
|
|
1016
1047
|
line-height: var(--kds-typography-button-line-height); /* 1.5 */
|
|
1017
1048
|
letter-spacing: var(--kds-typography-button-letter-spacing); /* 0.46px */
|
|
1018
|
-
text-transform: uppercase;
|
|
1049
|
+
text-transform: var(--kds-button-text-transform, uppercase);
|
|
1019
1050
|
|
|
1020
1051
|
/* Spacing - Using design tokens */
|
|
1021
1052
|
padding: var(--kds-spacing-button-padding); /* 0 16px */
|
|
@@ -1072,16 +1103,19 @@ a.kds-btn:disabled {
|
|
|
1072
1103
|
/* Primary button - Khipu purple */
|
|
1073
1104
|
button.kds-btn-primary,
|
|
1074
1105
|
a.kds-btn-primary {
|
|
1075
|
-
background: var(--kds-color-primary-main);
|
|
1106
|
+
background: var(--kds-button-primary-bg, var(--kds-color-primary-main)); /* #8347AD */
|
|
1076
1107
|
color: var(--kds-color-primary-contrast); /* #FFF light / dark-purple on dark (lavender bg) */
|
|
1077
1108
|
border: none;
|
|
1078
1109
|
box-shadow: 0 1px 2px rgba(131, 71, 173, .25);
|
|
1079
1110
|
}
|
|
1080
1111
|
|
|
1081
|
-
/* Hover State - background más oscuro
|
|
1112
|
+
/* Hover State - background más oscuro.
|
|
1113
|
+
Its own token, not primary-dark: once a brand sets the button background
|
|
1114
|
+
independently of the primary, deriving hover from the primary would snap it
|
|
1115
|
+
back to the brand's other colour on the first pointer-over. */
|
|
1082
1116
|
button.kds-btn-primary:hover:not(:disabled),
|
|
1083
1117
|
a.kds-btn-primary:hover:not(:disabled) {
|
|
1084
|
-
background: var(--kds-color-primary-dark);
|
|
1118
|
+
background: var(--kds-button-primary-bg-hover, var(--kds-color-primary-dark)); /* #5B3179 */
|
|
1085
1119
|
}
|
|
1086
1120
|
|
|
1087
1121
|
/* Active/Focus State */
|
|
@@ -1089,7 +1123,7 @@ button.kds-btn-primary:active:not(:disabled),
|
|
|
1089
1123
|
button.kds-btn-primary:focus-visible:not(:disabled),
|
|
1090
1124
|
a.kds-btn-primary:active:not(:disabled),
|
|
1091
1125
|
a.kds-btn-primary:focus-visible:not(:disabled) {
|
|
1092
|
-
background: var(--kds-color-primary-dark);
|
|
1126
|
+
background: var(--kds-button-primary-bg-hover, var(--kds-color-primary-dark));
|
|
1093
1127
|
}
|
|
1094
1128
|
|
|
1095
1129
|
/* Dark mode: the button is a light lavender with dark text, so hover/active must
|
|
@@ -3240,7 +3274,7 @@ label.radio span {
|
|
|
3240
3274
|
/* Checked state */
|
|
3241
3275
|
label.checkbox input[type="checkbox"]:checked,
|
|
3242
3276
|
label.radio input[type="radio"]:checked {
|
|
3243
|
-
accent-color: var(--primary);
|
|
3277
|
+
accent-color: var(--kds-color-accent, var(--primary));
|
|
3244
3278
|
}
|
|
3245
3279
|
|
|
3246
3280
|
/* Disabled state */
|
|
@@ -5009,9 +5043,12 @@ dialog#surveyModal button.circle {
|
|
|
5009
5043
|
background-color: var(--kds-color-info-soft);
|
|
5010
5044
|
}
|
|
5011
5045
|
|
|
5012
|
-
/* ── Typography variants ──
|
|
5046
|
+
/* ── Typography variants ──
|
|
5047
|
+
The display/heading tier resolves through --kds-font-family-heading so a
|
|
5048
|
+
brand can pair a display face with a different body face. Unset by default,
|
|
5049
|
+
so it falls through to the primary family and output is unchanged. */
|
|
5013
5050
|
.kds-text-display1 {
|
|
5014
|
-
font-family: var(--kds-font-family-primary, 'Public Sans', sans-serif);
|
|
5051
|
+
font-family: var(--kds-font-family-heading, var(--kds-font-family-primary, 'Public Sans', sans-serif));
|
|
5015
5052
|
font-size: var(--kds-font-size-4xl, 36px);
|
|
5016
5053
|
font-weight: var(--kds-font-weight-bold, 700);
|
|
5017
5054
|
line-height: var(--kds-line-height-tight, 1.2);
|
|
@@ -5019,7 +5056,7 @@ dialog#surveyModal button.circle {
|
|
|
5019
5056
|
}
|
|
5020
5057
|
|
|
5021
5058
|
.kds-text-display2 {
|
|
5022
|
-
font-family: var(--kds-font-family-primary, 'Public Sans', sans-serif);
|
|
5059
|
+
font-family: var(--kds-font-family-heading, var(--kds-font-family-primary, 'Public Sans', sans-serif));
|
|
5023
5060
|
font-size: var(--kds-font-size-3xl, 30px);
|
|
5024
5061
|
font-weight: var(--kds-font-weight-bold, 700);
|
|
5025
5062
|
line-height: var(--kds-line-height-tight, 1.2);
|
|
@@ -5027,21 +5064,21 @@ dialog#surveyModal button.circle {
|
|
|
5027
5064
|
}
|
|
5028
5065
|
|
|
5029
5066
|
.kds-text-heading1 {
|
|
5030
|
-
font-family: var(--kds-font-family-primary, 'Public Sans', sans-serif);
|
|
5067
|
+
font-family: var(--kds-font-family-heading, var(--kds-font-family-primary, 'Public Sans', sans-serif));
|
|
5031
5068
|
font-size: var(--kds-font-size-2xl, 24px);
|
|
5032
5069
|
font-weight: var(--kds-font-weight-semibold, 600);
|
|
5033
5070
|
line-height: var(--kds-line-height-snug, 1.375);
|
|
5034
5071
|
}
|
|
5035
5072
|
|
|
5036
5073
|
.kds-text-heading2 {
|
|
5037
|
-
font-family: var(--kds-font-family-primary, 'Public Sans', sans-serif);
|
|
5074
|
+
font-family: var(--kds-font-family-heading, var(--kds-font-family-primary, 'Public Sans', sans-serif));
|
|
5038
5075
|
font-size: var(--kds-font-size-xl, 20px);
|
|
5039
5076
|
font-weight: var(--kds-font-weight-semibold, 600);
|
|
5040
5077
|
line-height: var(--kds-line-height-snug, 1.375);
|
|
5041
5078
|
}
|
|
5042
5079
|
|
|
5043
5080
|
.kds-text-heading3 {
|
|
5044
|
-
font-family: var(--kds-font-family-primary, 'Public Sans', sans-serif);
|
|
5081
|
+
font-family: var(--kds-font-family-heading, var(--kds-font-family-primary, 'Public Sans', sans-serif));
|
|
5045
5082
|
font-size: var(--kds-font-size-lg, 18px);
|
|
5046
5083
|
font-weight: var(--kds-font-weight-semibold, 600);
|
|
5047
5084
|
line-height: var(--kds-line-height-normal, 1.5);
|
|
@@ -6267,7 +6304,7 @@ button.kds-fab:active:not(:disabled) {
|
|
|
6267
6304
|
irregular arriba (pegado al resumen) y abajo (~26px hasta el panel). Con height
|
|
6268
6305
|
auto el botón ajusta a su contenido y el ritmo lo gobiernan los márgenes. */
|
|
6269
6306
|
height: auto;
|
|
6270
|
-
color: var(--kds-color-primary-main);
|
|
6307
|
+
color: var(--kds-color-accent, var(--kds-color-primary-main));
|
|
6271
6308
|
font-weight: var(--kds-font-weight-medium);
|
|
6272
6309
|
font-size: var(--kds-font-size-sm);
|
|
6273
6310
|
cursor: pointer;
|
|
@@ -7097,11 +7134,13 @@ div.kds-invoice-header,
|
|
|
7097
7134
|
}
|
|
7098
7135
|
|
|
7099
7136
|
.kds-invoice-amount {
|
|
7137
|
+
/* inherit: the amount had no family of its own before, it took the body's. */
|
|
7138
|
+
font-family: var(--kds-invoice-amount-font-family, inherit);
|
|
7100
7139
|
font-weight: var(--kds-font-weight-semibold);
|
|
7101
7140
|
font-size: var(--kds-font-size-3xl);
|
|
7102
7141
|
line-height: var(--kds-line-height-tight);
|
|
7103
7142
|
letter-spacing: var(--kds-letter-spacing-wide);
|
|
7104
|
-
color: var(--kds-color-gray-900);
|
|
7143
|
+
color: var(--kds-invoice-amount-color, var(--kds-color-gray-900));
|
|
7105
7144
|
margin: 0;
|
|
7106
7145
|
}
|
|
7107
7146
|
|
|
@@ -7199,6 +7238,8 @@ div.kds-invoice-header,
|
|
|
7199
7238
|
|
|
7200
7239
|
/* -- Card Title -- */
|
|
7201
7240
|
.kds-card-title {
|
|
7241
|
+
/* inherit: the card title had no family of its own before. */
|
|
7242
|
+
font-family: var(--kds-font-family-heading, inherit);
|
|
7202
7243
|
font-weight: var(--kds-font-weight-semibold);
|
|
7203
7244
|
font-size: var(--kds-font-size-base);
|
|
7204
7245
|
line-height: 1.5;
|
|
@@ -9080,7 +9121,11 @@ a.kds-copy-all-btn.copied:hover {
|
|
|
9080
9121
|
|
|
9081
9122
|
.kds-form-icon-box {
|
|
9082
9123
|
align-items: center;
|
|
9083
|
-
background: var(--kds-color-background-brand-subtle, #f0f0fa);
|
|
9124
|
+
background: var(--kds-color-accent-soft, var(--kds-color-background-brand-subtle, #f0f0fa));
|
|
9125
|
+
/* The glyph inherits this, so the icon tracks the accent role without the
|
|
9126
|
+
markup having to name a colour utility. Falls back to the primary, which
|
|
9127
|
+
is what the .kds-text-primary utility on the glyph resolved to. */
|
|
9128
|
+
color: var(--kds-color-accent, var(--kds-color-primary-main));
|
|
9084
9129
|
border-radius: var(--kds-radius-md);
|
|
9085
9130
|
display: flex;
|
|
9086
9131
|
height: 52px;
|
|
@@ -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;
|