@rolster/react-components 18.21.34 → 18.21.36

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.
@@ -1,25 +1,34 @@
1
1
  .rls-tabular-text {
2
+ --pvt-char-font-size: var(
3
+ --rlc-tabular-text-font-size,
4
+ var(--rls-body-font-size)
5
+ );
6
+ --pvt-char-height: calc(var(--pvt-char-font-size) + 1rem);
7
+ --pvt-char-width: var(--rlc-tabular-text-char-width, 5.5rem);
8
+ --pvt-pointer-width: var(--rlc-tabular-text-pointer-width, 2rem);
2
9
  display: flex;
3
10
  width: auto;
4
- justify-content: var(--rlc-tabulartext-text-align, flex-start);
11
+ justify-content: var(--rlc-tabular-text-align, flex-start);
5
12
  }
6
13
  .rls-tabular-text span {
7
- font-size: var(--rlc-tabulartext-font-size, var(--rls-body-font-size));
14
+ font-size: var(--pvt-char-font-size);
15
+ height: var(--pvt-char-height);
16
+ line-height: var(--pvt-char-height);
8
17
  }
9
18
  .rls-tabular-text__char {
10
19
  display: block;
20
+ width: var(--pvt-char-width);
11
21
  text-align: center;
12
- width: var(--rlc-tabulartext-char-width, 5.5rem);
13
22
  }
14
23
  .rls-tabular-text__pointer {
15
24
  display: block;
25
+ width: var(--pvt-pointer-width);
16
26
  text-align: center;
17
- width: var(--rlc-tabulartext-pointer-width, 2rem);
18
27
  } /*# sourceMappingURL=TabularText.css.map */
19
28
 
20
29
  .rls-amount {
21
30
  --pvt-font-size: var(--rlc-amount-font-size, inherit);
22
- --rlc-tabulartext-font-size: var(--pvt-font-size);
31
+ --rlc-tabular-text-font-size: var(--pvt-font-size);
23
32
  display: flex;
24
33
  width: var(--rlc-amount-width, auto);
25
34
  justify-content: var(--rlc-amount-text-align, start);
@@ -28,6 +37,14 @@
28
37
  }
29
38
  .rls-amount[rls-theme] {
30
39
  color: var(--rls-theme-color-500);
40
+ }
41
+ .rls-amount__value {
42
+ display: flex;
43
+ }
44
+ .rls-amount__decimal {
45
+ --rlc-tabular-text-char-width: calc(var(--pvt-font-size) * 0.55);
46
+ --rlc-tabular-text-font-size: calc(var(--pvt-font-size) * 0.75);
47
+ align-items: flex-end;
31
48
  } /*# sourceMappingURL=Amount.css.map */
32
49
 
33
50
  .rls-avatar {
@@ -537,11 +554,13 @@
537
554
  }
538
555
  .rls-input__value {
539
556
  position: absolute;
557
+ display: flex;
540
558
  top: 0rem;
541
559
  left: 0rem;
542
560
  width: 100%;
543
561
  height: var(--pvt-height);
544
562
  line-height: var(--pvt-height);
563
+ align-items: center;
545
564
  background: rgba(0, 0, 0, 0);
546
565
  pointer-events: none;
547
566
  overflow: hidden;
@@ -555,8 +574,8 @@
555
574
  } /*# sourceMappingURL=Input.css.map */
556
575
 
557
576
  .rls-input-money {
558
- --rlc-tabulartext-font-size: var(--rls-input-font-size);
559
- --rlc-tabulartext-char-width: 5.25rem;
577
+ --rlc-tabular-text-font-size: var(--rls-input-font-size);
578
+ --rlc-tabular-text-char-width: 5.25rem;
560
579
  position: relative;
561
580
  width: 100%;
562
581
  box-sizing: border-box;
package/dist/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import require$$0, { useState, useEffect, useMemo, useCallback, useRef, createContext } from 'react';
1
+ import require$$0, { useMemo, useCallback, useState, useRef, useEffect, createContext } from 'react';
2
2
  import { currencyFormat, floorDecimals, itIsDefined, PartialSealed } from '@rolster/commons';
3
3
  import { dateFormatTemplate, DAY_LABELS, DateRange, normalizeMinTime, assignDayInDate, dateIsBefore, MONTH_NAMES, Month, assignYearInDate, assignMonthInDate } from '@rolster/dates';
4
4
  import { i18n, i18nSubscribe } from '@rolster/i18n';
@@ -1342,26 +1342,6 @@ if (process.env.NODE_ENV === 'production') {
1342
1342
 
1343
1343
  var jsxRuntimeExports = jsxRuntime.exports;
1344
1344
 
1345
- const className = 'rls-tabular-text';
1346
- const pointers = ['.', ','];
1347
- function getCharClass(char) {
1348
- return pointers.includes(char)
1349
- ? `${className}__pointer`
1350
- : `${className}__char`;
1351
- }
1352
- function RlsTabularText({ value }) {
1353
- const [codes, setCodes] = useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
1354
- useEffect(() => {
1355
- setCodes(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: value?.split('').map((char, index) => (jsxRuntimeExports.jsx("span", { className: getCharClass(char), children: char }, index))) }));
1356
- }, [value]);
1357
- return jsxRuntimeExports.jsx("div", { className: "rls-tabular-text", children: codes });
1358
- }
1359
-
1360
- function RlsAmount({ value, decimals, rlsTheme, symbol }) {
1361
- const amount = useMemo(() => currencyFormat({ value, decimals }), [value, decimals]);
1362
- return (jsxRuntimeExports.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntimeExports.jsx("span", { children: symbol }), jsxRuntimeExports.jsx(RlsTabularText, { value: amount })] }));
1363
- }
1364
-
1365
1345
  function renderClassStatus(base, status = {}, additionals) {
1366
1346
  const _classElement = [base];
1367
1347
  Object.entries(status).forEach(([key, state]) => {
@@ -1483,6 +1463,38 @@ function msgErrorsI18n(key, language, interpolators) {
1483
1463
  return _msgErrorsI18n(key, { language, interpolators });
1484
1464
  }
1485
1465
 
1466
+ const className = 'rls-tabular-text';
1467
+ const pointers = ['.', ','];
1468
+ function getCharClass(char) {
1469
+ return pointers.includes(char)
1470
+ ? `${className}__pointer`
1471
+ : `${className}__char`;
1472
+ }
1473
+ function RlsTabularText({ className, value }) {
1474
+ const codes = useMemo(() => {
1475
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: value?.split('').map((char, index) => (jsxRuntimeExports.jsx("span", { className: getCharClass(char), children: char }, index))) }));
1476
+ }, [value]);
1477
+ const _className = useMemo(() => {
1478
+ return renderClassStatus('rls-tabular-text', {}, className);
1479
+ }, [className]);
1480
+ return jsxRuntimeExports.jsx("div", { className: _className, children: codes });
1481
+ }
1482
+
1483
+ function RlsAmount({ value, decimals, rlsTheme, symbol }) {
1484
+ const { decimal, integer } = useMemo(() => {
1485
+ const currency = currencyFormat({ value, decimals });
1486
+ if (!currency.includes(',')) {
1487
+ return { integer: currency, decimal: '' };
1488
+ }
1489
+ const currencySplit = currency.split(',');
1490
+ return {
1491
+ integer: currencySplit[0] + (currencySplit[1] ? ',' : ''),
1492
+ decimal: currencySplit[1] || ''
1493
+ };
1494
+ }, [value, decimals]);
1495
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntimeExports.jsx("span", { children: symbol }), jsxRuntimeExports.jsxs("div", { className: "rls-amount__value", children: [jsxRuntimeExports.jsx(RlsTabularText, { className: "rls-amount__integer", value: integer }), decimal && (jsxRuntimeExports.jsx(RlsTabularText, { className: "rls-amount__decimal", value: decimal }))] })] }));
1496
+ }
1497
+
1486
1498
  function RlsAvatar({ children, rounded, skeleton, rlsTheme }) {
1487
1499
  const className = useMemo(() => {
1488
1500
  return renderClassStatus('rls-avatar', { rounded, skeleton });