@rolster/react-components 18.11.5 → 18.12.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.
- package/dist/cjs/assets/{index-Wm92C1Nd.css → index-c6NHIX56.css} +11 -5
- package/dist/cjs/index.js +33 -63
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-Wm92C1Nd.css → index-c6NHIX56.css} +11 -5
- package/dist/es/index.js +32 -61
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Amount/Amount.css +2 -1
- package/dist/esm/components/atoms/Amount/Amount.js +1 -1
- package/dist/esm/components/atoms/Amount/Amount.js.map +1 -1
- package/dist/esm/components/atoms/Avatar/Avatar.css +4 -1
- package/dist/esm/components/atoms/Avatar/Avatar.js +1 -1
- package/dist/esm/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/molecules/DayRangePicker/DayRangePicker.d.ts +1 -1
- package/dist/esm/components/molecules/DayRangePicker/DayRangePicker.js +2 -3
- package/dist/esm/components/molecules/DayRangePicker/DayRangePicker.js.map +1 -1
- package/dist/esm/components/molecules/Pagination/Pagination.css +5 -3
- package/dist/esm/components/organisms/DatePicker/DatePicker.js +4 -4
- package/dist/esm/components/organisms/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/organisms/DateRangeField/DateRangeField.d.ts +1 -1
- package/dist/esm/components/organisms/DateRangeField/DateRangeField.js +3 -2
- package/dist/esm/components/organisms/DateRangeField/DateRangeField.js.map +1 -1
- package/dist/esm/components/organisms/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/esm/components/organisms/DateRangePicker/DateRangePicker.js +5 -5
- package/dist/esm/components/organisms/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/esm/helpers/date-picker.js +2 -6
- package/dist/esm/helpers/date-picker.js.map +1 -1
- package/dist/esm/helpers/date-range-picker.d.ts +3 -1
- package/dist/esm/helpers/date-range-picker.js +10 -4
- package/dist/esm/helpers/date-range-picker.js.map +1 -1
- package/dist/esm/helpers/day-picker.js +3 -3
- package/dist/esm/helpers/day-picker.js.map +1 -1
- package/dist/esm/models.d.ts +0 -8
- package/dist/esm/models.js +0 -32
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/types.d.ts +1 -1
- package/package.json +10 -10
|
@@ -14,16 +14,17 @@
|
|
|
14
14
|
width: var(--rls-tabulartext-pointer-width);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
rls-amount {
|
|
18
18
|
display: flex;
|
|
19
19
|
justify-content: var(--rls-amount-text-align);
|
|
20
20
|
column-gap: var(--sizing-x2);
|
|
21
21
|
}
|
|
22
|
+
|
|
22
23
|
.rls-amount[rls-theme] {
|
|
23
24
|
color: var(--color-rolster-500);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
rls-avatar {
|
|
27
28
|
position: relative;
|
|
28
29
|
display: flex;
|
|
29
30
|
justify-content: center;
|
|
@@ -35,15 +36,18 @@
|
|
|
35
36
|
color: var(--color-light-500);
|
|
36
37
|
border-radius: var(--rls-avatar-border-radius);
|
|
37
38
|
}
|
|
39
|
+
|
|
38
40
|
.rls-avatar--skeleton {
|
|
39
41
|
background: var(--color-rolster-100);
|
|
40
42
|
}
|
|
41
43
|
.rls-avatar--skeleton > * {
|
|
42
44
|
display: none;
|
|
43
45
|
}
|
|
46
|
+
|
|
44
47
|
.rls-avatar--rounded {
|
|
45
48
|
border-radius: 50%;
|
|
46
49
|
}
|
|
50
|
+
|
|
47
51
|
.rls-avatar span {
|
|
48
52
|
font-size: inherit;
|
|
49
53
|
margin: auto;
|
|
@@ -1231,6 +1235,8 @@
|
|
|
1231
1235
|
height: var(--sizing-x16);
|
|
1232
1236
|
line-height: var(--sizing-x16);
|
|
1233
1237
|
border-radius: var(--sizing-x2);
|
|
1238
|
+
font-size: var(--body-font-size);
|
|
1239
|
+
letter-spacing: var(--body-letter-spacing);
|
|
1234
1240
|
}
|
|
1235
1241
|
.rls-pagination__page:hover {
|
|
1236
1242
|
background: var(--color-rolster-300);
|
|
@@ -1241,14 +1247,14 @@
|
|
|
1241
1247
|
color: var(--color-light-500);
|
|
1242
1248
|
}
|
|
1243
1249
|
.rls-pagination__description {
|
|
1244
|
-
color: var(--
|
|
1250
|
+
color: var(--color-theme-500);
|
|
1245
1251
|
margin: 0rem var(--sizing-x4);
|
|
1246
1252
|
width: auto;
|
|
1247
1253
|
height: var(--sizing-x20);
|
|
1248
1254
|
line-height: var(--sizing-x20);
|
|
1249
|
-
font-size: var(--body-
|
|
1255
|
+
font-size: var(--body-font-size);
|
|
1250
1256
|
font-weight: var(--font-weight-bold);
|
|
1251
|
-
letter-spacing: var(--body-
|
|
1257
|
+
letter-spacing: var(--body-letter-spacing);
|
|
1252
1258
|
}
|
|
1253
1259
|
.rls-pagination__actions {
|
|
1254
1260
|
width: auto;
|
package/dist/cjs/index.js
CHANGED
|
@@ -20,7 +20,7 @@ function RlsTabularText({ value }) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function RlsAmount({ value, decimals, rlsTheme, symbol }) {
|
|
23
|
-
return (jsxRuntime.jsxs("
|
|
23
|
+
return (jsxRuntime.jsxs("rls-amount", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntime.jsx("span", { children: symbol }), jsxRuntime.jsx(RlsTabularText, { value: helpersAdvanced.currencyFormat({ value, decimals }) })] }));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function renderClassStatus(base, status = {}, aditionals) {
|
|
@@ -39,7 +39,7 @@ function renderClassStatus(base, status = {}, aditionals) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
function RlsAvatar({ children, rounded, skeleton, rlsTheme }) {
|
|
42
|
-
return (jsxRuntime.jsx("
|
|
42
|
+
return (jsxRuntime.jsx("rls-avatar", { className: renderClassStatus('rls-avatar', { rounded, skeleton }), "rls-theme": rlsTheme, children: children }));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function RlsBreadcrumb({ labels }) {
|
|
@@ -335,12 +335,12 @@ class DayPickerFactory {
|
|
|
335
335
|
}
|
|
336
336
|
minOverflowDay(day) {
|
|
337
337
|
return this.minDate
|
|
338
|
-
? helpersDate.weight(helpersDate.
|
|
338
|
+
? helpersDate.weight(helpersDate.assignDay(this.date, day)) < helpersDate.weight(this.minDate)
|
|
339
339
|
: false;
|
|
340
340
|
}
|
|
341
341
|
maxOverflowDay(day) {
|
|
342
342
|
return this.maxDate
|
|
343
|
-
? helpersDate.weight(helpersDate.
|
|
343
|
+
? helpersDate.weight(helpersDate.assignDay(this.date, day)) > helpersDate.weight(this.maxDate)
|
|
344
344
|
: false;
|
|
345
345
|
}
|
|
346
346
|
}
|
|
@@ -385,45 +385,6 @@ function RlsDayPicker({ date, disabled: disabledPicker, formControl, maxDate, mi
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
const DATE_FORMAT = '{dd}/{mm}/{aa}';
|
|
388
|
-
class ListCollection {
|
|
389
|
-
constructor(value) {
|
|
390
|
-
this.value = value;
|
|
391
|
-
}
|
|
392
|
-
find(element) {
|
|
393
|
-
return this.value.find((current) => current.compareTo(element));
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
class DateRange {
|
|
397
|
-
constructor(minDate, maxDate) {
|
|
398
|
-
this.minDate = helpersDate.normalizeMinTime(minDate);
|
|
399
|
-
if (maxDate && helpersDate.isBefore(maxDate, minDate)) {
|
|
400
|
-
this.maxDate = helpersDate.normalizeMinTime(maxDate);
|
|
401
|
-
}
|
|
402
|
-
else {
|
|
403
|
-
this.maxDate = helpersDate.normalizeMinTime(minDate);
|
|
404
|
-
}
|
|
405
|
-
const minFormat = helpersDate.formatDate(this.minDate, DATE_FORMAT);
|
|
406
|
-
const maxFormat = helpersDate.formatDate(this.maxDate, DATE_FORMAT);
|
|
407
|
-
this.description = `${minFormat} - ${maxFormat}`;
|
|
408
|
-
}
|
|
409
|
-
recalculate(date) {
|
|
410
|
-
if (helpersDate.isBefore(this.minDate, date)) {
|
|
411
|
-
return new DateRange(date, this.maxDate);
|
|
412
|
-
}
|
|
413
|
-
if (helpersDate.isAfter(this.maxDate, date)) {
|
|
414
|
-
return new DateRange(this.minDate, date);
|
|
415
|
-
}
|
|
416
|
-
const minDifference = helpersDate.timeDifference(date, this.minDate);
|
|
417
|
-
const maxDifference = helpersDate.timeDifference(this.maxDate, date);
|
|
418
|
-
return minDifference > maxDifference
|
|
419
|
-
? new DateRange(this.minDate, date)
|
|
420
|
-
: new DateRange(date, this.maxDate);
|
|
421
|
-
}
|
|
422
|
-
static now() {
|
|
423
|
-
return new DateRange(new Date());
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
388
|
class DateRangePickerFactory {
|
|
428
389
|
constructor(props) {
|
|
429
390
|
const { date, range, maxDate, minDate } = props;
|
|
@@ -500,28 +461,33 @@ class DateRangePickerFactory {
|
|
|
500
461
|
day === date.getDate());
|
|
501
462
|
}
|
|
502
463
|
isRangedFromDate(day) {
|
|
503
|
-
return helpersDate.
|
|
464
|
+
return helpersDate.between(this.range.minDate, this.range.maxDate, helpersDate.assignDay(this.date, day));
|
|
504
465
|
}
|
|
505
466
|
overflowDay(day) {
|
|
506
467
|
return this.minOverflowDay(day) || this.maxOverflowDay(day);
|
|
507
468
|
}
|
|
508
469
|
minOverflowDay(day) {
|
|
509
470
|
return this.minDate
|
|
510
|
-
? helpersDate.weight(helpersDate.
|
|
471
|
+
? helpersDate.weight(helpersDate.assignDay(this.date, day)) < helpersDate.weight(this.minDate)
|
|
511
472
|
: false;
|
|
512
473
|
}
|
|
513
474
|
maxOverflowDay(day) {
|
|
514
475
|
return this.maxDate
|
|
515
|
-
? helpersDate.weight(helpersDate.
|
|
476
|
+
? helpersDate.weight(helpersDate.assignDay(this.date, day)) > helpersDate.weight(this.maxDate)
|
|
516
477
|
: false;
|
|
517
478
|
}
|
|
518
479
|
}
|
|
480
|
+
function formatRange(range) {
|
|
481
|
+
const minFormat = helpersDate.formatDate(range.minDate, DATE_FORMAT);
|
|
482
|
+
const maxFormat = helpersDate.formatDate(range.maxDate, DATE_FORMAT);
|
|
483
|
+
return `${minFormat} - ${maxFormat}`;
|
|
484
|
+
}
|
|
519
485
|
function createRangePicker(props) {
|
|
520
486
|
return DateRangePickerFactory.execute(props);
|
|
521
487
|
}
|
|
522
488
|
|
|
523
489
|
function RlsDayRangePicker({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme }) {
|
|
524
|
-
const initialRange = formControl?.state || DateRange.now();
|
|
490
|
+
const initialRange = formControl?.state || helpersDate.DateRange.now();
|
|
525
491
|
const initialDate = helpersDate.normalizeMinTime(date || initialRange.minDate);
|
|
526
492
|
const [weeks, setWeeks] = react.useState([]);
|
|
527
493
|
const [range, setRange] = react.useState(initialRange);
|
|
@@ -534,7 +500,7 @@ function RlsDayRangePicker({ date, disabled: disabledPicker, formControl, maxDat
|
|
|
534
500
|
}));
|
|
535
501
|
}, [range, date, minDate, maxDate]);
|
|
536
502
|
function onChange(value) {
|
|
537
|
-
const newRange = range.recalculate(helpersDate.
|
|
503
|
+
const newRange = range.recalculate(helpersDate.assignDay(initialDate, value));
|
|
538
504
|
setRange(newRange);
|
|
539
505
|
formControl?.setState(newRange);
|
|
540
506
|
}
|
|
@@ -1134,6 +1100,15 @@ const reactI18n = i18n.i18n({
|
|
|
1134
1100
|
}
|
|
1135
1101
|
});
|
|
1136
1102
|
|
|
1103
|
+
class ListCollection {
|
|
1104
|
+
constructor(value) {
|
|
1105
|
+
this.value = value;
|
|
1106
|
+
}
|
|
1107
|
+
find(element) {
|
|
1108
|
+
return this.value.find((current) => current.compareTo(element));
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1137
1112
|
const classElement = '.rls-list-field__element';
|
|
1138
1113
|
const MAX_POSITION_VISIBLE = 4;
|
|
1139
1114
|
const LIST_SIZE_REM = 16;
|
|
@@ -1654,11 +1629,7 @@ var PickerListenerType;
|
|
|
1654
1629
|
})(PickerListenerType || (PickerListenerType = {}));
|
|
1655
1630
|
|
|
1656
1631
|
function verifyDateRange(date, min, max) {
|
|
1657
|
-
return min && helpersDate.
|
|
1658
|
-
? min
|
|
1659
|
-
: max && helpersDate.isAfter(max, date)
|
|
1660
|
-
? max
|
|
1661
|
-
: date;
|
|
1632
|
+
return min && helpersDate.before(min, date) ? min : max && helpersDate.after(max, date) ? max : date;
|
|
1662
1633
|
}
|
|
1663
1634
|
|
|
1664
1635
|
const FORMAT_DESCRIPTION = '{dw}, {mx} {dd} de {aa}';
|
|
@@ -1692,21 +1663,21 @@ function RlsDatePicker({ automatic, date, formControl, disabled, maxDate, minDat
|
|
|
1692
1663
|
react.useEffect(() => {
|
|
1693
1664
|
setValue((prevValue) => {
|
|
1694
1665
|
return typeof yearControl.state === 'number'
|
|
1695
|
-
? verifyDateRange(helpersDate.
|
|
1666
|
+
? verifyDateRange(helpersDate.assignYear(prevValue, yearControl.state), minDate, maxDate)
|
|
1696
1667
|
: prevValue;
|
|
1697
1668
|
});
|
|
1698
1669
|
}, [yearControl.state]);
|
|
1699
1670
|
react.useEffect(() => {
|
|
1700
1671
|
setValue((prevValue) => {
|
|
1701
1672
|
return typeof monthControl.state === 'number'
|
|
1702
|
-
? verifyDateRange(helpersDate.
|
|
1673
|
+
? verifyDateRange(helpersDate.assignMonth(prevValue, monthControl.state), minDate, maxDate)
|
|
1703
1674
|
: prevValue;
|
|
1704
1675
|
});
|
|
1705
1676
|
}, [monthControl.state]);
|
|
1706
1677
|
react.useEffect(() => {
|
|
1707
1678
|
setValue((prevValue) => {
|
|
1708
1679
|
return typeof dayControl.state === 'number'
|
|
1709
|
-
? verifyDateRange(helpersDate.
|
|
1680
|
+
? verifyDateRange(helpersDate.assignDay(prevValue, dayControl.state), minDate, maxDate)
|
|
1710
1681
|
: prevValue;
|
|
1711
1682
|
});
|
|
1712
1683
|
}, [dayControl.state]);
|
|
@@ -1815,7 +1786,7 @@ const VISIBILITY = {
|
|
|
1815
1786
|
};
|
|
1816
1787
|
function RlsDateRangePicker({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, rlsTheme, onListener }) {
|
|
1817
1788
|
const dateInitial = helpersDate.normalizeMinTime(datePicker || new Date());
|
|
1818
|
-
const rangeInitial = formControl?.state || DateRange.now();
|
|
1789
|
+
const rangeInitial = formControl?.state || helpersDate.DateRange.now();
|
|
1819
1790
|
const yearControl = useReactControl({ state: dateInitial.getFullYear() });
|
|
1820
1791
|
const monthControl = useReactControl({ state: dateInitial.getMonth() });
|
|
1821
1792
|
const dayControl = useReactControl({ state: rangeInitial });
|
|
@@ -1825,14 +1796,14 @@ function RlsDateRangePicker({ automatic, date: datePicker, disabled, formControl
|
|
|
1825
1796
|
react.useEffect(() => {
|
|
1826
1797
|
setDate((prevValue) => {
|
|
1827
1798
|
return typeof yearControl.state === 'number'
|
|
1828
|
-
? helpersDate.
|
|
1799
|
+
? helpersDate.assignYear(prevValue, yearControl.state)
|
|
1829
1800
|
: prevValue;
|
|
1830
1801
|
});
|
|
1831
1802
|
}, [yearControl.state]);
|
|
1832
1803
|
react.useEffect(() => {
|
|
1833
1804
|
setDate((prevValue) => {
|
|
1834
1805
|
return typeof monthControl.state === 'number'
|
|
1835
|
-
? helpersDate.
|
|
1806
|
+
? helpersDate.assignMonth(prevValue, monthControl.state)
|
|
1836
1807
|
: prevValue;
|
|
1837
1808
|
});
|
|
1838
1809
|
}, [monthControl.state]);
|
|
@@ -1862,7 +1833,7 @@ function RlsDateRangePicker({ automatic, date: datePicker, disabled, formControl
|
|
|
1862
1833
|
onListener({ type: PickerListenerType.Select, value });
|
|
1863
1834
|
}
|
|
1864
1835
|
}
|
|
1865
|
-
return (jsxRuntime.jsxs("div", { className: "rls-date-range-picker", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: "rls-date-range-picker__header", children: [jsxRuntime.jsx("div", { className: "rls-date-range-picker__title rls-date-range-picker__title--description", children: jsxRuntime.jsx("span", { onClick: onVisibilityDay, children: value
|
|
1836
|
+
return (jsxRuntime.jsxs("div", { className: "rls-date-range-picker", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: "rls-date-range-picker__header", children: [jsxRuntime.jsx("div", { className: "rls-date-range-picker__title rls-date-range-picker__title--description", children: jsxRuntime.jsx("span", { onClick: onVisibilityDay, children: formatRange(value) }) }), jsxRuntime.jsx("div", { className: "rls-date-range-picker__title rls-date-range-picker__title--year", children: jsxRuntime.jsx("span", { onClick: onVisibilityYear, children: yearControl.state }) }), jsxRuntime.jsx(RlsMonthTitlePicker, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: year, type: month ? 'year' : 'month', onClick: onVisibilityMonth })] }), jsxRuntime.jsxs("div", { className: renderClassStatus('rls-date-range-picker__component', {
|
|
1866
1837
|
year,
|
|
1867
1838
|
day,
|
|
1868
1839
|
month
|
|
@@ -1872,14 +1843,14 @@ function RlsDateRangePicker({ automatic, date: datePicker, disabled, formControl
|
|
|
1872
1843
|
}
|
|
1873
1844
|
|
|
1874
1845
|
function RlsDateRangeField({ children, date: datePicker, disabled, formControl, maxDate, minDate, placeholder, rlsTheme }) {
|
|
1875
|
-
const rangeInitial = formControl?.state || DateRange.now();
|
|
1846
|
+
const rangeInitial = formControl?.state || helpersDate.DateRange.now();
|
|
1876
1847
|
const dateInitial = datePicker || new Date();
|
|
1877
1848
|
const [value, setValue] = react.useState(rangeInitial);
|
|
1878
1849
|
const [date] = react.useState(dateInitial);
|
|
1879
1850
|
const [show, setShow] = react.useState(false);
|
|
1880
1851
|
const [description, setDescription] = react.useState('');
|
|
1881
1852
|
react.useEffect(() => {
|
|
1882
|
-
setDescription(value
|
|
1853
|
+
setDescription(value ? formatRange(value) : '');
|
|
1883
1854
|
}, [value]);
|
|
1884
1855
|
function onClickInput() {
|
|
1885
1856
|
setShow(true);
|
|
@@ -2100,7 +2071,6 @@ function RlsApplication({ children }) {
|
|
|
2100
2071
|
}
|
|
2101
2072
|
|
|
2102
2073
|
exports.ConfirmationResult = ConfirmationResult;
|
|
2103
|
-
exports.DateRange = DateRange;
|
|
2104
2074
|
exports.ListCollection = ListCollection;
|
|
2105
2075
|
exports.RlsAmount = RlsAmount;
|
|
2106
2076
|
exports.RlsApplication = RlsApplication;
|