@jjlmoya/utils-finance 1.1.0

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.
Files changed (133) hide show
  1. package/package.json +64 -0
  2. package/src/category/i18n/en.ts +159 -0
  3. package/src/category/i18n/es.ts +159 -0
  4. package/src/category/i18n/fr.ts +159 -0
  5. package/src/category/index.ts +24 -0
  6. package/src/category/seo.astro +15 -0
  7. package/src/components/PreviewNavSidebar.astro +116 -0
  8. package/src/components/PreviewToolbar.astro +143 -0
  9. package/src/data.ts +11 -0
  10. package/src/env.d.ts +5 -0
  11. package/src/index.ts +32 -0
  12. package/src/layouts/PreviewLayout.astro +117 -0
  13. package/src/pages/[locale]/[slug].astro +146 -0
  14. package/src/pages/[locale].astro +251 -0
  15. package/src/pages/index.astro +4 -0
  16. package/src/tests/faq_count.test.ts +19 -0
  17. package/src/tests/locale_completeness.test.ts +39 -0
  18. package/src/tests/mocks/astro_mock.js +2 -0
  19. package/src/tests/no_h1_in_components.test.ts +48 -0
  20. package/src/tests/schemas_fulfillment.test.ts +23 -0
  21. package/src/tests/seo_length.test.ts +23 -0
  22. package/src/tests/title_quality.test.ts +55 -0
  23. package/src/tests/tool_validation.test.ts +17 -0
  24. package/src/tool/compoundInterest/bibliography.astro +14 -0
  25. package/src/tool/compoundInterest/component.astro +697 -0
  26. package/src/tool/compoundInterest/i18n/en.ts +212 -0
  27. package/src/tool/compoundInterest/i18n/es.ts +212 -0
  28. package/src/tool/compoundInterest/i18n/fr.ts +212 -0
  29. package/src/tool/compoundInterest/index.ts +34 -0
  30. package/src/tool/compoundInterest/logic.ts +40 -0
  31. package/src/tool/compoundInterest/seo.astro +14 -0
  32. package/src/tool/compoundInterest/ui.ts +19 -0
  33. package/src/tool/courtFeeCalculator/bibliography.astro +14 -0
  34. package/src/tool/courtFeeCalculator/component.astro +427 -0
  35. package/src/tool/courtFeeCalculator/i18n/en.ts +268 -0
  36. package/src/tool/courtFeeCalculator/i18n/es.ts +268 -0
  37. package/src/tool/courtFeeCalculator/i18n/fr.ts +268 -0
  38. package/src/tool/courtFeeCalculator/index.ts +33 -0
  39. package/src/tool/courtFeeCalculator/logic.ts +86 -0
  40. package/src/tool/courtFeeCalculator/seo.astro +14 -0
  41. package/src/tool/courtFeeCalculator/ui.ts +31 -0
  42. package/src/tool/debtSnowball/bibliography.astro +14 -0
  43. package/src/tool/debtSnowball/component.astro +1052 -0
  44. package/src/tool/debtSnowball/i18n/en.ts +288 -0
  45. package/src/tool/debtSnowball/i18n/es.ts +288 -0
  46. package/src/tool/debtSnowball/i18n/fr.ts +288 -0
  47. package/src/tool/debtSnowball/index.ts +37 -0
  48. package/src/tool/debtSnowball/logic.ts +156 -0
  49. package/src/tool/debtSnowball/seo.astro +14 -0
  50. package/src/tool/debtSnowball/ui.ts +49 -0
  51. package/src/tool/fireCalculator/bibliography.astro +14 -0
  52. package/src/tool/fireCalculator/component.astro +689 -0
  53. package/src/tool/fireCalculator/i18n/en.ts +261 -0
  54. package/src/tool/fireCalculator/i18n/es.ts +261 -0
  55. package/src/tool/fireCalculator/i18n/fr.ts +261 -0
  56. package/src/tool/fireCalculator/index.ts +33 -0
  57. package/src/tool/fireCalculator/logic.ts +108 -0
  58. package/src/tool/fireCalculator/seo.astro +14 -0
  59. package/src/tool/fireCalculator/ui.ts +33 -0
  60. package/src/tool/ibanBicSwiftConverter/bibliography.astro +14 -0
  61. package/src/tool/ibanBicSwiftConverter/component.astro +581 -0
  62. package/src/tool/ibanBicSwiftConverter/i18n/en.ts +167 -0
  63. package/src/tool/ibanBicSwiftConverter/i18n/es.ts +216 -0
  64. package/src/tool/ibanBicSwiftConverter/i18n/fr.ts +167 -0
  65. package/src/tool/ibanBicSwiftConverter/index.ts +33 -0
  66. package/src/tool/ibanBicSwiftConverter/logic.ts +101 -0
  67. package/src/tool/ibanBicSwiftConverter/seo.astro +14 -0
  68. package/src/tool/ibanBicSwiftConverter/ui.ts +17 -0
  69. package/src/tool/inflation/bibliography.astro +14 -0
  70. package/src/tool/inflation/component.astro +400 -0
  71. package/src/tool/inflation/i18n/en.ts +301 -0
  72. package/src/tool/inflation/i18n/es.ts +301 -0
  73. package/src/tool/inflation/i18n/fr.ts +301 -0
  74. package/src/tool/inflation/index.ts +34 -0
  75. package/src/tool/inflation/logic.ts +92 -0
  76. package/src/tool/inflation/seo.astro +14 -0
  77. package/src/tool/inflation/ui.ts +17 -0
  78. package/src/tool/lateInterest/bibliography.astro +14 -0
  79. package/src/tool/lateInterest/component.astro +655 -0
  80. package/src/tool/lateInterest/i18n/en.ts +255 -0
  81. package/src/tool/lateInterest/i18n/es.ts +224 -0
  82. package/src/tool/lateInterest/i18n/fr.ts +224 -0
  83. package/src/tool/lateInterest/index.ts +34 -0
  84. package/src/tool/lateInterest/logic.ts +89 -0
  85. package/src/tool/lateInterest/seo.astro +14 -0
  86. package/src/tool/lateInterest/ui.ts +33 -0
  87. package/src/tool/legalInterestRate/bibliography.astro +14 -0
  88. package/src/tool/legalInterestRate/component.astro +650 -0
  89. package/src/tool/legalInterestRate/i18n/en.ts +159 -0
  90. package/src/tool/legalInterestRate/i18n/es.ts +159 -0
  91. package/src/tool/legalInterestRate/i18n/fr.ts +159 -0
  92. package/src/tool/legalInterestRate/index.ts +33 -0
  93. package/src/tool/legalInterestRate/logic.ts +29 -0
  94. package/src/tool/legalInterestRate/seo.astro +14 -0
  95. package/src/tool/legalInterestRate/ui.ts +23 -0
  96. package/src/tool/lotteryOptimizer/bibliography.astro +14 -0
  97. package/src/tool/lotteryOptimizer/component.astro +863 -0
  98. package/src/tool/lotteryOptimizer/i18n/en.ts +188 -0
  99. package/src/tool/lotteryOptimizer/i18n/es.ts +281 -0
  100. package/src/tool/lotteryOptimizer/i18n/fr.ts +188 -0
  101. package/src/tool/lotteryOptimizer/index.ts +33 -0
  102. package/src/tool/lotteryOptimizer/logic.ts +133 -0
  103. package/src/tool/lotteryOptimizer/seo.astro +14 -0
  104. package/src/tool/lotteryOptimizer/ui.ts +33 -0
  105. package/src/tool/mortgage/bibliography.astro +14 -0
  106. package/src/tool/mortgage/component.astro +1030 -0
  107. package/src/tool/mortgage/i18n/en.ts +227 -0
  108. package/src/tool/mortgage/i18n/es.ts +227 -0
  109. package/src/tool/mortgage/i18n/fr.ts +227 -0
  110. package/src/tool/mortgage/index.ts +34 -0
  111. package/src/tool/mortgage/logic.ts +118 -0
  112. package/src/tool/mortgage/seo.astro +14 -0
  113. package/src/tool/mortgage/ui.ts +35 -0
  114. package/src/tool/percentageCalculator/bibliography.astro +14 -0
  115. package/src/tool/percentageCalculator/component.astro +640 -0
  116. package/src/tool/percentageCalculator/i18n/en.ts +233 -0
  117. package/src/tool/percentageCalculator/i18n/es.ts +233 -0
  118. package/src/tool/percentageCalculator/i18n/fr.ts +233 -0
  119. package/src/tool/percentageCalculator/index.ts +34 -0
  120. package/src/tool/percentageCalculator/logic.ts +48 -0
  121. package/src/tool/percentageCalculator/seo.astro +14 -0
  122. package/src/tool/percentageCalculator/ui.ts +30 -0
  123. package/src/tool/rentIncreaseCalculator/bibliography.astro +14 -0
  124. package/src/tool/rentIncreaseCalculator/component.astro +587 -0
  125. package/src/tool/rentIncreaseCalculator/i18n/en.ts +159 -0
  126. package/src/tool/rentIncreaseCalculator/i18n/es.ts +220 -0
  127. package/src/tool/rentIncreaseCalculator/i18n/fr.ts +159 -0
  128. package/src/tool/rentIncreaseCalculator/index.ts +33 -0
  129. package/src/tool/rentIncreaseCalculator/logic.ts +43 -0
  130. package/src/tool/rentIncreaseCalculator/seo.astro +14 -0
  131. package/src/tool/rentIncreaseCalculator/ui.ts +19 -0
  132. package/src/tools.ts +16 -0
  133. package/src/types.ts +74 -0
@@ -0,0 +1,650 @@
1
+ ---
2
+ import { Icon } from 'astro-icon/components';
3
+ import type { KnownLocale } from '../../types';
4
+
5
+ interface Props {
6
+ locale?: KnownLocale;
7
+ ui?: Record<string, unknown>;
8
+ }
9
+
10
+ const { ui } = Astro.props;
11
+ ---
12
+
13
+ <div class="lir-wrapper" data-currency-symbol={ui.currencySymbol} data-currency-code={ui.currencyCode} data-currency-locale={ui.currencyLocale}>
14
+ <div class="lir-container">
15
+ <header class="lir-header">
16
+ <span class="lir-badge">{ui.labelBadge}</span>
17
+ <h2 class="lir-title">{ui.labelTitle}</h2>
18
+ <p class="lir-subtitle">{ui.labelSubtitle}</p>
19
+ </header>
20
+
21
+ <div class="lir-main-rates">
22
+ <article class="rate-card">
23
+ <span class="rate-label">{ui.labelLegalInterest}</span>
24
+ <span class="rate-value">3,25%</span>
25
+ <span class="rate-subtext">{ui.labelActive}</span>
26
+ </article>
27
+
28
+ <article class="rate-card">
29
+ <span class="rate-label">{ui.labelDelayInterest}</span>
30
+ <span class="rate-value">4,06%</span>
31
+ <span class="rate-subtext">{ui.labelTributary}</span>
32
+ </article>
33
+
34
+ <article class="rate-card">
35
+ <span class="rate-label">{ui.labelCommercialOperations}</span>
36
+ <span class="rate-value">10,15%</span>
37
+ <span class="rate-subtext">{ui.labelFirstHalf}</span>
38
+ </article>
39
+ </div>
40
+
41
+ <section class="lir-calculator-section">
42
+ <h2 class="calculator-title">
43
+ <Icon name="mdi:calculator-variant" />
44
+ {ui.labelQuickCalculator}
45
+ </h2>
46
+
47
+ <div class="calculator-grid">
48
+ <div class="input-group">
49
+ <label for="capital">{ui.labelCapital}</label>
50
+ <div class="input-container">
51
+ <input
52
+ type="number"
53
+ id="capital"
54
+ placeholder="0.00"
55
+ class="lir-input"
56
+ value="1000"
57
+ />
58
+ <span class="currency-suffix">{ui.currencySymbol}</span>
59
+ </div>
60
+ </div>
61
+
62
+ <div class="input-group">
63
+ <label for="days">{ui.labelDays}</label>
64
+ <div class="input-container">
65
+ <input
66
+ type="number"
67
+ id="days"
68
+ placeholder="365"
69
+ class="lir-input"
70
+ value="365"
71
+ />
72
+ <span class="currency-suffix">días</span>
73
+ </div>
74
+ </div>
75
+
76
+ <div class="lir-results-card">
77
+ <div class="result-item">
78
+ <span class="result-label">{ui.labelInterestGenerated}</span>
79
+ <span class="result-amount" id="result-interest">32,50 {ui.currencySymbol}</span>
80
+ </div>
81
+ <div class="result-item result-total">
82
+ <span class="total-label">{ui.labelTotalToPay}</span>
83
+ <span class="total-amount" id="result-total">1.032,50 {ui.currencySymbol}</span>
84
+ </div>
85
+ </div>
86
+ </div>
87
+
88
+ <div class="lir-info-msg">
89
+ <div class="info-icon">
90
+ <Icon name="mdi:information-outline" />
91
+ </div>
92
+ <div class="info-content">
93
+ <p>{ui.labelFormula}</p>
94
+ <code class="info-formula">Interés = (Capital × 3,25% × Días) / (365 × 100)</code>
95
+ <p>{ui.labelBase}</p>
96
+ </div>
97
+ </div>
98
+ </section>
99
+ </div>
100
+ </div>
101
+
102
+ <style>
103
+ :root {
104
+ --lir-primary: #856404;
105
+ --lir-secondary: #b8860b;
106
+ --lir-accent: #6c757d;
107
+ --lir-bg-glass: rgba(255, 255, 255, 0.9);
108
+ --lir-border-glass: rgba(184, 134, 11, 0.3);
109
+ --lir-text-main: #212529;
110
+ --lir-text-muted: #495057;
111
+ --lir-glow: rgba(184, 134, 11, 0.1);
112
+ }
113
+
114
+ :global(.theme-dark) {
115
+ --lir-bg-glass: rgba(15, 23, 42, 0.9);
116
+ --lir-border-glass: rgba(184, 134, 11, 0.3);
117
+ --lir-text-main: #f8fafc;
118
+ --lir-text-muted: #94a3b8;
119
+ --lir-glow: rgba(184, 134, 11, 0.15);
120
+ }
121
+
122
+ :global([data-theme='dark']) {
123
+ --lir-bg-glass: rgba(15, 23, 42, 0.9);
124
+ --lir-border-glass: rgba(184, 134, 11, 0.3);
125
+ --lir-text-main: #f8fafc;
126
+ --lir-text-muted: #94a3b8;
127
+ --lir-glow: rgba(184, 134, 11, 0.15);
128
+ }
129
+
130
+ .lir-wrapper {
131
+ max-width: 900px;
132
+ margin: 2rem auto;
133
+ padding: 1rem;
134
+ }
135
+
136
+ .lir-container {
137
+ background: var(--lir-bg-glass);
138
+ backdrop-filter: blur(20px);
139
+ -webkit-backdrop-filter: blur(20px);
140
+ border: 2px solid var(--lir-border-glass);
141
+ border-radius: 2rem;
142
+ padding: 2.5rem;
143
+ position: relative;
144
+ overflow: hidden;
145
+ box-shadow: 0 15px 35px -5px rgba(184, 134, 11, 0.1);
146
+ }
147
+
148
+ .lir-header {
149
+ text-align: center;
150
+ margin-bottom: 2.5rem;
151
+ }
152
+
153
+ .lir-badge {
154
+ display: inline-block;
155
+ padding: 0.25rem 1rem;
156
+ background: rgba(184, 134, 11, 0.1);
157
+ border: 1px solid var(--lir-primary);
158
+ color: var(--lir-primary);
159
+ border-radius: 2rem;
160
+ font-size: 0.75rem;
161
+ font-weight: 800;
162
+ text-transform: uppercase;
163
+ letter-spacing: 1.5px;
164
+ margin-bottom: 1rem;
165
+ }
166
+
167
+ .lir-title {
168
+ font-size: 2.25rem;
169
+ font-weight: 900;
170
+ color: var(--lir-text-main);
171
+ margin-bottom: 0.5rem;
172
+ line-height: 1.1;
173
+ }
174
+
175
+ .lir-subtitle {
176
+ color: var(--lir-text-muted);
177
+ font-size: 1.1rem;
178
+ max-width: 600px;
179
+ margin: 0 auto;
180
+ }
181
+
182
+ .lir-main-rates {
183
+ display: grid;
184
+ grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
185
+ gap: 1.25rem;
186
+ margin-bottom: 2.5rem;
187
+ }
188
+
189
+ .rate-card {
190
+ background: white;
191
+ border: 1px solid rgba(184, 134, 11, 0.15);
192
+ border-radius: 1.5rem;
193
+ padding: 1.5rem;
194
+ text-align: center;
195
+ transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
196
+ position: relative;
197
+ display: flex;
198
+ flex-direction: column;
199
+ justify-content: center;
200
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.02);
201
+ }
202
+
203
+ :global(.theme-dark) .rate-card,
204
+ :global([data-theme='dark']) .rate-card {
205
+ background: rgba(255, 255, 255, 0.03);
206
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
207
+ }
208
+
209
+ .rate-card:hover {
210
+ transform: translateY(-5px);
211
+ border-color: var(--lir-primary);
212
+ }
213
+
214
+ .rate-label {
215
+ font-size: 0.85rem;
216
+ font-weight: 700;
217
+ color: var(--lir-text-muted);
218
+ margin-bottom: 0.5rem;
219
+ text-transform: uppercase;
220
+ letter-spacing: 1px;
221
+ }
222
+
223
+ .rate-value {
224
+ font-size: 3rem;
225
+ font-weight: 950;
226
+ color: var(--lir-secondary);
227
+ line-height: 1;
228
+ margin-bottom: 0.25rem;
229
+ }
230
+
231
+ .rate-subtext {
232
+ font-size: 0.95rem;
233
+ font-weight: 600;
234
+ color: var(--lir-text-main);
235
+ }
236
+
237
+ .lir-calculator-section {
238
+ background: #f8f9fa;
239
+ border: 1px solid rgba(0, 0, 0, 0.03);
240
+ border-radius: 1.75rem;
241
+ padding: 2rem;
242
+ }
243
+
244
+ :global(.theme-dark) .lir-calculator-section,
245
+ :global([data-theme='dark']) .lir-calculator-section {
246
+ background: rgba(255, 255, 255, 0.02);
247
+ }
248
+
249
+ .calculator-title {
250
+ font-size: 1.4rem;
251
+ font-weight: 800;
252
+ color: var(--lir-text-main);
253
+ margin-bottom: 1.5rem;
254
+ display: flex;
255
+ align-items: center;
256
+ gap: 0.75rem;
257
+ }
258
+
259
+ .calculator-title :global(svg) {
260
+ color: var(--lir-primary);
261
+ }
262
+
263
+ .calculator-grid {
264
+ display: grid;
265
+ grid-template-columns: 1fr 1fr;
266
+ gap: 1.5rem;
267
+ }
268
+
269
+ .input-group {
270
+ display: flex;
271
+ flex-direction: column;
272
+ gap: 0.5rem;
273
+ }
274
+
275
+ .input-group label {
276
+ font-weight: 700;
277
+ color: var(--lir-text-muted);
278
+ font-size: 0.85rem;
279
+ }
280
+
281
+ .input-container {
282
+ position: relative;
283
+ }
284
+
285
+ .lir-input {
286
+ width: 100%;
287
+ background: white;
288
+ border: 2px solid #e9ecef;
289
+ padding: 0.85rem 1.25rem;
290
+ border-radius: 1rem;
291
+ color: #212529;
292
+ font-size: 1.1rem;
293
+ font-weight: 700;
294
+ transition: all 0.3s;
295
+ }
296
+
297
+ :global(.theme-dark) .lir-input,
298
+ :global([data-theme='dark']) .lir-input {
299
+ background: rgba(15, 23, 42, 0.6);
300
+ border-color: rgba(255, 255, 255, 0.1);
301
+ color: white;
302
+ }
303
+
304
+ .lir-input:focus {
305
+ outline: none;
306
+ border-color: var(--lir-primary);
307
+ box-shadow: 0 0 10px var(--lir-glow);
308
+ }
309
+
310
+ .currency-suffix {
311
+ position: absolute;
312
+ right: 1.25rem;
313
+ top: 50%;
314
+ transform: translateY(-50%);
315
+ color: var(--lir-text-muted);
316
+ font-weight: 800;
317
+ font-size: 0.9rem;
318
+ }
319
+
320
+ .lir-results-card {
321
+ grid-column: span 2;
322
+ background: linear-gradient(135deg, rgba(184, 134, 11, 0.03) 0%, #fff 100%);
323
+ border: 1px solid var(--lir-border-glass);
324
+ border-radius: 1.5rem;
325
+ padding: 1.5rem 2rem;
326
+ margin-top: 0.5rem;
327
+ display: flex;
328
+ justify-content: space-between;
329
+ align-items: center;
330
+ }
331
+
332
+ :global(.theme-dark) .lir-results-card,
333
+ :global([data-theme='dark']) .lir-results-card {
334
+ background: linear-gradient(135deg, rgba(184, 134, 11, 0.1) 0%, rgba(15, 23, 42, 0.6) 100%);
335
+ }
336
+
337
+ .result-item {
338
+ display: flex;
339
+ flex-direction: column;
340
+ }
341
+
342
+ .result-label {
343
+ font-size: 0.95rem;
344
+ font-weight: 600;
345
+ color: var(--lir-text-muted);
346
+ }
347
+
348
+ .result-amount {
349
+ font-size: 2.25rem;
350
+ font-weight: 950;
351
+ color: var(--lir-secondary);
352
+ }
353
+
354
+ .result-total {
355
+ text-align: right;
356
+ }
357
+
358
+ .total-label {
359
+ font-size: 0.95rem;
360
+ font-weight: 800;
361
+ color: var(--lir-text-main);
362
+ }
363
+
364
+ .total-amount {
365
+ font-size: 2.5rem;
366
+ font-weight: 950;
367
+ color: var(--lir-primary);
368
+ }
369
+
370
+ .lir-info-msg {
371
+ margin-top: 1.5rem;
372
+ padding: 1.25rem;
373
+ background: rgba(184, 134, 11, 0.05);
374
+ border: 1px solid rgba(184, 134, 11, 0.1);
375
+ border-radius: 1.25rem;
376
+ display: flex;
377
+ gap: 1.25rem;
378
+ align-items: flex-start;
379
+ }
380
+
381
+ :global(.theme-dark) .lir-info-msg,
382
+ :global([data-theme='dark']) .lir-info-msg {
383
+ background: rgba(184, 134, 11, 0.08);
384
+ }
385
+
386
+ .info-icon {
387
+ background: var(--lir-primary);
388
+ color: white;
389
+ width: 32px;
390
+ height: 32px;
391
+ min-width: 32px;
392
+ border-radius: 50%;
393
+ display: flex;
394
+ align-items: center;
395
+ justify-content: center;
396
+ font-size: 1.2rem;
397
+ box-shadow: 0 4px 10px rgba(184, 134, 11, 0.2);
398
+ }
399
+
400
+ .info-content {
401
+ display: flex;
402
+ flex-direction: column;
403
+ gap: 0.5rem;
404
+ min-width: 0;
405
+ }
406
+
407
+ .info-content p {
408
+ margin: 0;
409
+ font-size: 0.85rem;
410
+ color: var(--lir-text-muted);
411
+ line-height: 1.5;
412
+ }
413
+
414
+ .info-formula {
415
+ background: white;
416
+ padding: 0.5rem 1rem;
417
+ border-radius: 0.75rem;
418
+ font-size: 0.9rem;
419
+ font-weight: 700;
420
+ color: var(--lir-primary);
421
+ border: 1px solid rgba(184, 134, 11, 0.1);
422
+ display: inline-block;
423
+ align-self: flex-start;
424
+ margin: 0.25rem 0;
425
+ }
426
+
427
+ :global(.theme-dark) .info-formula,
428
+ :global([data-theme='dark']) .info-formula {
429
+ background: rgba(0, 0, 0, 0.2);
430
+ color: var(--lir-secondary);
431
+ }
432
+
433
+ @media (max-width: 768px) {
434
+ .lir-wrapper {
435
+ padding: 1rem;
436
+ margin: 0.5rem auto;
437
+ box-sizing: border-box;
438
+ }
439
+
440
+ .lir-container {
441
+ padding: 1.25rem;
442
+ border-radius: 1.25rem;
443
+ width: 100%;
444
+ box-sizing: border-box;
445
+ }
446
+
447
+ .lir-badge {
448
+ padding: 0.2rem 0.75rem;
449
+ font-size: 0.65rem;
450
+ margin-bottom: 0.5rem;
451
+ }
452
+
453
+ .lir-title {
454
+ font-size: 1.5rem;
455
+ padding: 0;
456
+ }
457
+
458
+ .lir-subtitle {
459
+ font-size: 0.9rem;
460
+ padding: 0;
461
+ }
462
+
463
+ .lir-main-rates {
464
+ grid-template-columns: 1fr;
465
+ gap: 0.75rem;
466
+ margin-bottom: 1.5rem;
467
+ }
468
+
469
+ .rate-card {
470
+ padding: 1rem;
471
+ border-radius: 1rem;
472
+ }
473
+
474
+ .rate-label {
475
+ font-size: 0.75rem;
476
+ }
477
+
478
+ .rate-value {
479
+ font-size: 2.25rem;
480
+ }
481
+
482
+ .rate-subtext {
483
+ font-size: 0.85rem;
484
+ }
485
+
486
+ .lir-calculator-section {
487
+ padding: 1rem;
488
+ border-radius: 1rem;
489
+ }
490
+
491
+ .calculator-title {
492
+ font-size: 1.2rem;
493
+ margin-bottom: 1rem;
494
+ }
495
+
496
+ .calculator-grid {
497
+ grid-template-columns: 1fr;
498
+ gap: 0.75rem;
499
+ }
500
+
501
+ .lir-input {
502
+ padding: 0.75rem 2.5rem 0.75rem 1rem;
503
+ font-size: 1rem;
504
+ box-sizing: border-box;
505
+ }
506
+
507
+ .lir-results-card {
508
+ grid-column: span 1;
509
+ flex-direction: column;
510
+ padding: 1rem;
511
+ gap: 1rem;
512
+ margin-top: 0.5rem;
513
+ }
514
+
515
+ .result-item.result-total {
516
+ padding-top: 0.75rem;
517
+ }
518
+
519
+ .result-label,
520
+ .total-label {
521
+ font-size: 0.85rem;
522
+ }
523
+
524
+ .result-amount {
525
+ font-size: 1.75rem;
526
+ }
527
+
528
+ .total-amount {
529
+ font-size: 2rem;
530
+ }
531
+
532
+ .lir-info-msg {
533
+ padding: 0.75rem;
534
+ gap: 0.75rem;
535
+ width: 100%;
536
+ box-sizing: border-box;
537
+ overflow: hidden;
538
+ }
539
+
540
+ .info-icon {
541
+ width: 24px;
542
+ height: 24px;
543
+ min-width: 24px;
544
+ font-size: 0.9rem;
545
+ }
546
+
547
+ .info-formula {
548
+ width: 100%;
549
+ box-sizing: border-box;
550
+ padding: 0.5rem 0.75rem;
551
+ font-size: 0.7rem;
552
+ overflow-x: auto;
553
+ -webkit-overflow-scrolling: touch;
554
+ display: block;
555
+ border-radius: 0.5rem;
556
+ overflow-wrap: break-word;
557
+ white-space: normal;
558
+ }
559
+ }
560
+
561
+ @media (max-width: 480px) {
562
+ .lir-wrapper {
563
+ padding: 0.75rem;
564
+ }
565
+
566
+ .lir-container {
567
+ padding: 1rem;
568
+ }
569
+
570
+ .lir-title {
571
+ font-size: 1.3rem;
572
+ }
573
+
574
+ .lir-subtitle {
575
+ font-size: 0.85rem;
576
+ }
577
+
578
+ .rate-value {
579
+ font-size: 1.75rem;
580
+ }
581
+
582
+ .lir-calculator-section {
583
+ padding: 0.75rem;
584
+ }
585
+
586
+ .calculator-title {
587
+ font-size: 1rem;
588
+ }
589
+
590
+ .result-amount {
591
+ font-size: 1.4rem;
592
+ }
593
+
594
+ .total-amount {
595
+ font-size: 1.5rem;
596
+ }
597
+
598
+ .lir-input {
599
+ font-size: 0.9rem;
600
+ }
601
+
602
+ .info-content p {
603
+ font-size: 0.75rem;
604
+ }
605
+
606
+ .info-formula {
607
+ font-size: 0.65rem;
608
+ }
609
+ }
610
+ </style>
611
+
612
+ <script>
613
+ import { LegalInterestLogic } from './logic';
614
+
615
+ const capitalInput = document.getElementById('capital') as HTMLInputElement | null;
616
+ const daysInput = document.getElementById('days') as HTMLInputElement | null;
617
+ const interestDisplay = document.getElementById('result-interest');
618
+ const totalDisplay = document.getElementById('result-total');
619
+
620
+ const container = document.querySelector('.lir-wrapper') as HTMLElement;
621
+ const currencyLocale = container?.getAttribute('data-currency-locale') || 'es-ES';
622
+ const currencySymbol = container?.getAttribute('data-currency-symbol') || '€';
623
+
624
+ function formatCurrency(val: number): string {
625
+ return new Intl.NumberFormat(currencyLocale, {
626
+ minimumFractionDigits: 2,
627
+ maximumFractionDigits: 2,
628
+ }).format(val);
629
+ }
630
+
631
+ function calculate() {
632
+ if (!capitalInput || !daysInput) return;
633
+ const capital = parseFloat(capitalInput.value) || 0;
634
+ const days = parseFloat(daysInput.value) || 0;
635
+
636
+ const result = LegalInterestLogic.calculateInterest(capital, days);
637
+
638
+ if (interestDisplay) {
639
+ interestDisplay.textContent = `${formatCurrency(result.interest)} ${currencySymbol}`;
640
+ }
641
+ if (totalDisplay) {
642
+ totalDisplay.textContent = `${formatCurrency(result.total)} ${currencySymbol}`;
643
+ }
644
+ }
645
+
646
+ capitalInput?.addEventListener('input', calculate);
647
+ daysInput?.addEventListener('input', calculate);
648
+
649
+ calculate();
650
+ </script>