@rolster/react-components 18.10.0 → 18.10.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/cjs/index.js +101 -79
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +101 -79
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Amount/Amount.d.ts +2 -2
- package/dist/esm/components/atoms/Amount/Amount.js.map +1 -1
- package/dist/esm/components/atoms/Avatar/Avatar.d.ts +2 -2
- package/dist/esm/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/esm/components/atoms/Button/Button.d.ts +2 -2
- package/dist/esm/components/atoms/Button/Button.js.map +1 -1
- package/dist/esm/components/atoms/ButtonAction/ButtonAction.d.ts +2 -2
- package/dist/esm/components/atoms/ButtonAction/ButtonAction.js.map +1 -1
- package/dist/esm/components/atoms/CheckBox/CheckBox.d.ts +4 -4
- package/dist/esm/components/atoms/CheckBox/CheckBox.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Icon.d.ts +2 -2
- package/dist/esm/components/atoms/Icon/Icon.js.map +1 -1
- package/dist/esm/components/atoms/Input/Input.d.ts +3 -3
- package/dist/esm/components/atoms/Input/Input.js +1 -1
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.d.ts +3 -3
- package/dist/esm/components/atoms/InputMoney/InputMoney.js +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.js.map +1 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.d.ts +3 -3
- package/dist/esm/components/atoms/InputNumber/InputNumber.js +1 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.js.map +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.d.ts +3 -3
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
- package/dist/esm/components/atoms/InputText/InputText.d.ts +3 -3
- package/dist/esm/components/atoms/InputText/InputText.js +1 -1
- package/dist/esm/components/atoms/InputText/InputText.js.map +1 -1
- package/dist/esm/components/atoms/MessageIcon/MessageIcon.d.ts +2 -2
- package/dist/esm/components/atoms/MessageIcon/MessageIcon.js.map +1 -1
- package/dist/esm/components/atoms/ProgressBar/ProgressBar.d.ts +2 -2
- package/dist/esm/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/esm/components/atoms/RadioButton/RadioButton.d.ts +2 -2
- package/dist/esm/components/atoms/RadioButton/RadioButton.js +1 -1
- package/dist/esm/components/atoms/RadioButton/RadioButton.js.map +1 -1
- package/dist/esm/components/atoms/SearchInput/SearchInput.d.ts +2 -2
- package/dist/esm/components/atoms/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/atoms/SkeletonText/SkeletonText.d.ts +2 -2
- package/dist/esm/components/atoms/SkeletonText/SkeletonText.js.map +1 -1
- package/dist/esm/components/atoms/Switch/Switch.d.ts +4 -4
- package/dist/esm/components/atoms/Switch/Switch.js +1 -1
- package/dist/esm/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/esm/components/atoms/TabularText/TabularText.d.ts +2 -2
- package/dist/esm/components/atoms/TabularText/TabularText.js.map +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.d.ts +2 -2
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js.map +1 -1
- package/dist/esm/components/molecules/CheckBoxLabel/CheckBoxLabel.d.ts +2 -2
- package/dist/esm/components/molecules/CheckBoxLabel/CheckBoxLabel.js.map +1 -1
- package/dist/esm/components/molecules/DayPicker/DayPicker.d.ts +3 -2
- package/dist/esm/components/molecules/DayPicker/DayPicker.js +4 -1
- package/dist/esm/components/molecules/DayPicker/DayPicker.js.map +1 -1
- package/dist/esm/components/molecules/DayRangePicker/DayRangePicker.d.ts +2 -2
- package/dist/esm/components/molecules/DayRangePicker/DayRangePicker.js.map +1 -1
- package/dist/esm/components/molecules/MoneyField/MoneyField.d.ts +3 -3
- package/dist/esm/components/molecules/MoneyField/MoneyField.js +1 -1
- package/dist/esm/components/molecules/MoneyField/MoneyField.js.map +1 -1
- package/dist/esm/components/molecules/MonthPicker/MonthPicker.d.ts +3 -2
- package/dist/esm/components/molecules/MonthPicker/MonthPicker.js +12 -4
- package/dist/esm/components/molecules/MonthPicker/MonthPicker.js.map +1 -1
- package/dist/esm/components/molecules/MonthTitlePicker/MonthTitlePicker.d.ts +2 -2
- package/dist/esm/components/molecules/MonthTitlePicker/MonthTitlePicker.js.map +1 -1
- package/dist/esm/components/molecules/NumberField/NumberField.d.ts +3 -3
- package/dist/esm/components/molecules/NumberField/NumberField.js +1 -1
- package/dist/esm/components/molecules/NumberField/NumberField.js.map +1 -1
- package/dist/esm/components/molecules/Pagination/Pagination.d.ts +2 -2
- package/dist/esm/components/molecules/Pagination/Pagination.js +30 -30
- package/dist/esm/components/molecules/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/molecules/RadioButtonLabel/RadioButtonLabel.d.ts +2 -2
- package/dist/esm/components/molecules/RadioButtonLabel/RadioButtonLabel.js.map +1 -1
- package/dist/esm/components/molecules/TextField/TextField.d.ts +3 -3
- package/dist/esm/components/molecules/TextField/TextField.js +1 -1
- package/dist/esm/components/molecules/TextField/TextField.js.map +1 -1
- package/dist/esm/components/molecules/Toolbar/Toolbar.d.ts +2 -2
- package/dist/esm/components/molecules/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/components/molecules/YearPicker/YearPicker.d.ts +3 -2
- package/dist/esm/components/molecules/YearPicker/YearPicker.js +5 -2
- package/dist/esm/components/molecules/YearPicker/YearPicker.js.map +1 -1
- package/dist/esm/components/organisms/Card/Card.d.ts +2 -2
- package/dist/esm/components/organisms/Card/Card.js.map +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.d.ts +5 -4
- package/dist/esm/components/organisms/Confirmation/Confirmation.js.map +1 -1
- package/dist/esm/components/organisms/Datatable/Datatable.d.ts +7 -7
- package/dist/esm/components/organisms/Datatable/Datatable.js.map +1 -1
- package/dist/esm/components/organisms/DateField/DateField.d.ts +3 -2
- package/dist/esm/components/organisms/DateField/DateField.js +15 -6
- package/dist/esm/components/organisms/DateField/DateField.js.map +1 -1
- package/dist/esm/components/organisms/DatePicker/DatePicker.d.ts +2 -2
- package/dist/esm/components/organisms/DatePicker/DatePicker.js +1 -1
- package/dist/esm/components/organisms/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/organisms/DateRangeField/DateRangeField.d.ts +2 -2
- package/dist/esm/components/organisms/DateRangeField/DateRangeField.js.map +1 -1
- package/dist/esm/components/organisms/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/dist/esm/components/organisms/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.d.ts +2 -2
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.js.map +1 -1
- package/dist/esm/components/organisms/Modal/Modal.d.ts +2 -2
- package/dist/esm/components/organisms/Modal/Modal.js.map +1 -1
- package/dist/esm/components/organisms/Snackbar/Snackbar.d.ts +4 -4
- package/dist/esm/components/organisms/Snackbar/Snackbar.js.map +1 -1
- package/dist/esm/context.d.ts +3 -3
- package/dist/esm/utils/date-range-picker.d.ts +2 -2
- package/dist/esm/utils/date-range-picker.js +3 -3
- package/dist/esm/utils/date-range-picker.js.map +1 -1
- package/dist/esm/utils/day-picker.d.ts +2 -2
- package/dist/esm/utils/day-picker.js +3 -3
- package/dist/esm/utils/day-picker.js.map +1 -1
- package/dist/esm/utils/month-picker.d.ts +2 -2
- package/dist/esm/utils/month-picker.js +15 -15
- package/dist/esm/utils/month-picker.js.map +1 -1
- package/dist/esm/utils/year-picker.d.ts +2 -2
- package/dist/esm/utils/year-picker.js +3 -3
- package/dist/esm/utils/year-picker.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -67,7 +67,7 @@ function RlsCheckBoxControl({ formControl, disabled, rlsTheme }) {
|
|
|
67
67
|
}, rlsTheme: rlsTheme }));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
function RlsInput({ children, disabled, formControl,
|
|
70
|
+
function RlsInput({ children, disabled, formControl, placeholder, type, value, onValue }) {
|
|
71
71
|
const [focused, setFocused] = react.useState(false);
|
|
72
72
|
function onChange(event) {
|
|
73
73
|
switch (type) {
|
|
@@ -102,7 +102,7 @@ function RlsInput({ children, disabled, formControl, onValue, placeholder, type,
|
|
|
102
102
|
}), children: [jsxRuntime.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type || 'text', placeholder: placeholder, disabled: formControl?.disabled || disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange, value: formControl?.state || value || '' }), jsxRuntime.jsx("span", { className: "rls-input__value", children: children })] }));
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function RlsInputMoney({ decimals, disabled, formControl,
|
|
105
|
+
function RlsInputMoney({ decimals, disabled, formControl, placeholder, symbol, value, onValue }) {
|
|
106
106
|
const [valueInput, setValueInput] = react.useState(value || 0);
|
|
107
107
|
function onMoney(value) {
|
|
108
108
|
if (!formControl) {
|
|
@@ -115,7 +115,7 @@ function RlsInputMoney({ decimals, disabled, formControl, onValue, placeholder,
|
|
|
115
115
|
return (jsxRuntime.jsx("div", { className: "rls-input-money", children: jsxRuntime.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onMoney, children: jsxRuntime.jsx(RlsAmount, { value: formControl?.state || value || valueInput, symbol: symbol, decimals: decimals }) }) }));
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
function RlsInputNumber({ disabled, formControl,
|
|
118
|
+
function RlsInputNumber({ disabled, formControl, placeholder, value, onValue }) {
|
|
119
119
|
const [valueInput, setValueInput] = react.useState(value || 0);
|
|
120
120
|
function onNumber(value) {
|
|
121
121
|
if (!formControl) {
|
|
@@ -128,7 +128,7 @@ function RlsInputNumber({ disabled, formControl, onValue, placeholder, value })
|
|
|
128
128
|
return (jsxRuntime.jsx("div", { className: "rls-input-number", children: jsxRuntime.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onNumber, children: formControl?.state || value || valueInput }) }));
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
function RlsInputPassword({ disabled, formControl,
|
|
131
|
+
function RlsInputPassword({ disabled, formControl, placeholder, type, onValue }) {
|
|
132
132
|
const [focused, setFocused] = react.useState(false);
|
|
133
133
|
function onChange(event) {
|
|
134
134
|
formControl?.setState(event.target.value);
|
|
@@ -153,7 +153,7 @@ function RlsInputPassword({ disabled, formControl, onValue, placeholder, type })
|
|
|
153
153
|
}), children: jsxRuntime.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type || 'password', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange }) }));
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
function RlsInputText({ disabled, formControl,
|
|
156
|
+
function RlsInputText({ disabled, formControl, placeholder, value, onValue }) {
|
|
157
157
|
const [valueInput, setValueInput] = react.useState(value || '');
|
|
158
158
|
function onText(value) {
|
|
159
159
|
if (!formControl) {
|
|
@@ -182,7 +182,7 @@ function RlsProgressBar({ indeterminate, percentage, rlsTheme }) {
|
|
|
182
182
|
return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-progress-bar', { indeterminate }), "rls-theme": rlsTheme, children: jsxRuntime.jsx("div", { className: "rls-progress-bar__component", style: { width: `${percentage || 0}%` } }) }));
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
function RlsRadioButton({ checked, disabled,
|
|
185
|
+
function RlsRadioButton({ checked, disabled, rlsTheme, onClick }) {
|
|
186
186
|
return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-radiobutton', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntime.jsx("div", { className: "rls-radiobutton__component" }) }));
|
|
187
187
|
}
|
|
188
188
|
|
|
@@ -198,7 +198,7 @@ function RlsSkeletonText({ active, children, rlsTheme }) {
|
|
|
198
198
|
return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-skeleton-text', { active }), "rls-theme": rlsTheme, children: jsxRuntime.jsx("span", { className: "rls-skeleton-text__value", children: children }) }));
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
function RlsSwitch({ checked, disabled,
|
|
201
|
+
function RlsSwitch({ checked, disabled, rlsTheme, onClick }) {
|
|
202
202
|
return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-switch', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntime.jsxs("div", { className: "rls-switch__component", children: [jsxRuntime.jsx("div", { className: "rls-switch__component__element" }), jsxRuntime.jsx("div", { className: "rls-switch__component__bar" })] }) }));
|
|
203
203
|
}
|
|
204
204
|
function RlsSwitchControl({ formControl, disabled, rlsTheme }) {
|
|
@@ -265,7 +265,7 @@ function RlsCheckBoxLabel({ children, disabled, extended, formControl, rlsTheme
|
|
|
265
265
|
}), "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-checkbox-label__component", onClick: onToggle, children: jsxRuntime.jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsxRuntime.jsx("label", { className: "rls-checkbox-label__text", children: children })] }));
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
class DayPickerFactory {
|
|
269
269
|
constructor(props) {
|
|
270
270
|
const { date, value, maxDate, minDate } = props;
|
|
271
271
|
this.value = value;
|
|
@@ -275,7 +275,7 @@ let Factory$2 = class Factory {
|
|
|
275
275
|
this.date.setDate(1);
|
|
276
276
|
}
|
|
277
277
|
static execute(props) {
|
|
278
|
-
const factory = new
|
|
278
|
+
const factory = new DayPickerFactory(props);
|
|
279
279
|
const firstWeek = factory.createFirstWeek();
|
|
280
280
|
const rightWeeks = factory.createRightWeeks();
|
|
281
281
|
return [firstWeek, ...rightWeeks];
|
|
@@ -343,12 +343,12 @@ let Factory$2 = class Factory {
|
|
|
343
343
|
? helpersDate.weight(helpersDate.refactorDay(this.date, day)) > helpersDate.weight(this.maxDate)
|
|
344
344
|
: false;
|
|
345
345
|
}
|
|
346
|
-
}
|
|
346
|
+
}
|
|
347
347
|
function createDayPicker(props) {
|
|
348
|
-
return
|
|
348
|
+
return DayPickerFactory.execute(props);
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
-
function RlsDayPicker({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme }) {
|
|
351
|
+
function RlsDayPicker({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme, onValue }) {
|
|
352
352
|
const initialDate = date || new Date();
|
|
353
353
|
const initialDay = formControl?.state || initialDate.getDate();
|
|
354
354
|
const [weeks, setWeeks] = react.useState([]);
|
|
@@ -369,6 +369,9 @@ function RlsDayPicker({ date, disabled: disabledPicker, formControl, maxDate, mi
|
|
|
369
369
|
function onChange(value) {
|
|
370
370
|
setValue(value);
|
|
371
371
|
formControl?.setState(value);
|
|
372
|
+
if (onValue) {
|
|
373
|
+
onValue(value);
|
|
374
|
+
}
|
|
372
375
|
}
|
|
373
376
|
return (jsxRuntime.jsxs("div", { className: "rls-day-picker", "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-day-picker__header", children: helpersDate.DAY_LABELS().map((title, index) => (jsxRuntime.jsx("label", { className: "rls-day-picker__label", children: title }, index))) }), jsxRuntime.jsx("div", { className: "rls-day-picker__component", children: weeks.map(({ days }, index) => (jsxRuntime.jsx("div", { className: "rls-day-picker__week", children: days.map(({ value, disabled, forbidden, selected }, index) => (jsxRuntime.jsx("div", { className: renderClassStatus('rls-day-picker__day', {
|
|
374
377
|
disabled: disabled || disabledPicker,
|
|
@@ -421,7 +424,7 @@ class DateRange {
|
|
|
421
424
|
}
|
|
422
425
|
}
|
|
423
426
|
|
|
424
|
-
|
|
427
|
+
class DateRangePickerFactory {
|
|
425
428
|
constructor(props) {
|
|
426
429
|
const { date, range, maxDate, minDate } = props;
|
|
427
430
|
this.date = new Date(date.getTime());
|
|
@@ -431,7 +434,7 @@ let Factory$1 = class Factory {
|
|
|
431
434
|
this.date.setDate(1);
|
|
432
435
|
}
|
|
433
436
|
static execute(props) {
|
|
434
|
-
const factory = new
|
|
437
|
+
const factory = new DateRangePickerFactory(props);
|
|
435
438
|
const firstWeek = factory.createFirstWeek();
|
|
436
439
|
const rightWeeks = factory.createRightWeeks();
|
|
437
440
|
return [firstWeek, ...rightWeeks];
|
|
@@ -512,9 +515,9 @@ let Factory$1 = class Factory {
|
|
|
512
515
|
? helpersDate.weight(helpersDate.refactorDay(this.date, day)) > helpersDate.weight(this.maxDate)
|
|
513
516
|
: false;
|
|
514
517
|
}
|
|
515
|
-
}
|
|
518
|
+
}
|
|
516
519
|
function createRangePicker(props) {
|
|
517
|
-
return
|
|
520
|
+
return DateRangePickerFactory.execute(props);
|
|
518
521
|
}
|
|
519
522
|
|
|
520
523
|
function RlsDayRangePicker({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme }) {
|
|
@@ -547,7 +550,7 @@ function RlsDayRangePicker({ date, disabled: disabledPicker, formControl, maxDat
|
|
|
547
550
|
}, children: jsxRuntime.jsx("span", { className: "rls-day-range-picker__day__span", children: value || '??' }) }, index))) }, index))) })] }));
|
|
548
551
|
}
|
|
549
552
|
|
|
550
|
-
function RlsMoneyField({ children, decimals, disabled, formControl,
|
|
553
|
+
function RlsMoneyField({ children, decimals, disabled, formControl, placeholder, symbol, rlsTheme, value, onValue }) {
|
|
551
554
|
return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-box-field', {
|
|
552
555
|
focused: formControl?.focused,
|
|
553
556
|
error: formControl?.touched && !formControl?.valid,
|
|
@@ -557,7 +560,7 @@ function RlsMoneyField({ children, decimals, disabled, formControl, onValue, pla
|
|
|
557
560
|
|
|
558
561
|
const MONTH_MAX_VALUE = helpersDate.Month.January;
|
|
559
562
|
const MONTH_MIN_VALUE = helpersDate.Month.December;
|
|
560
|
-
class
|
|
563
|
+
class MonthPickerFactory {
|
|
561
564
|
constructor(props) {
|
|
562
565
|
const { date, value, maxDate, minDate } = props;
|
|
563
566
|
this.value = value;
|
|
@@ -566,20 +569,20 @@ class Factory {
|
|
|
566
569
|
this.minDate = minDate;
|
|
567
570
|
}
|
|
568
571
|
static execute(props) {
|
|
569
|
-
const factory = new
|
|
572
|
+
const factory = new MonthPickerFactory(props);
|
|
570
573
|
return [
|
|
571
|
-
factory.createMonth(
|
|
572
|
-
factory.createMonth(
|
|
573
|
-
factory.createMonth(
|
|
574
|
-
factory.createMonth(
|
|
575
|
-
factory.createMonth(
|
|
576
|
-
factory.createMonth(
|
|
577
|
-
factory.createMonth(
|
|
578
|
-
factory.createMonth(
|
|
579
|
-
factory.createMonth(
|
|
580
|
-
factory.createMonth(
|
|
581
|
-
factory.createMonth(
|
|
582
|
-
factory.createMonth(
|
|
574
|
+
factory.createMonth(helpersDate.Month.January),
|
|
575
|
+
factory.createMonth(helpersDate.Month.February),
|
|
576
|
+
factory.createMonth(helpersDate.Month.March),
|
|
577
|
+
factory.createMonth(helpersDate.Month.April),
|
|
578
|
+
factory.createMonth(helpersDate.Month.May),
|
|
579
|
+
factory.createMonth(helpersDate.Month.June),
|
|
580
|
+
factory.createMonth(helpersDate.Month.July),
|
|
581
|
+
factory.createMonth(helpersDate.Month.August),
|
|
582
|
+
factory.createMonth(helpersDate.Month.September),
|
|
583
|
+
factory.createMonth(helpersDate.Month.October),
|
|
584
|
+
factory.createMonth(helpersDate.Month.November),
|
|
585
|
+
factory.createMonth(helpersDate.Month.December)
|
|
583
586
|
];
|
|
584
587
|
}
|
|
585
588
|
createMonth(value) {
|
|
@@ -623,10 +626,10 @@ function isMaxLimitMonth(month, date, maxDate) {
|
|
|
623
626
|
return date.getFullYear() === maxYear && month >= maxMonth;
|
|
624
627
|
}
|
|
625
628
|
function createMonthPicker(props) {
|
|
626
|
-
return
|
|
629
|
+
return MonthPickerFactory.execute(props);
|
|
627
630
|
}
|
|
628
631
|
|
|
629
|
-
function RlsMonthPicker({ formControl, date, disabled: disabledPicker, maxDate, minDate, rlsTheme }) {
|
|
632
|
+
function RlsMonthPicker({ formControl, date, disabled: disabledPicker, maxDate, minDate, rlsTheme, onValue }) {
|
|
630
633
|
const initialDate = date || new Date();
|
|
631
634
|
const initialMonth = formControl?.state || initialDate.getMonth();
|
|
632
635
|
const [months, setMonths] = react.useState([]);
|
|
@@ -639,12 +642,20 @@ function RlsMonthPicker({ formControl, date, disabled: disabledPicker, maxDate,
|
|
|
639
642
|
maxDate
|
|
640
643
|
}));
|
|
641
644
|
}, [value, date, minDate, maxDate]);
|
|
645
|
+
function onChange(value) {
|
|
646
|
+
formControl?.setState(value);
|
|
647
|
+
setValue(value);
|
|
648
|
+
if (onValue) {
|
|
649
|
+
onValue(value);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
642
652
|
return (jsxRuntime.jsx("div", { className: "rls-month-picker", "rls-theme": rlsTheme, children: months.map(({ label, value, disabled, selected }, index) => (jsxRuntime.jsx("div", { className: renderClassStatus('rls-month-picker__component', {
|
|
643
653
|
disabled: disabled || disabledPicker || false,
|
|
644
654
|
selected
|
|
645
655
|
}), onClick: () => {
|
|
646
|
-
|
|
647
|
-
|
|
656
|
+
if (!disabled) {
|
|
657
|
+
onChange(value);
|
|
658
|
+
}
|
|
648
659
|
}, children: jsxRuntime.jsx("span", { className: "rls-month-picker__span", children: label }) }, index))) }));
|
|
649
660
|
}
|
|
650
661
|
|
|
@@ -685,7 +696,7 @@ function RlsMonthTitlePicker({ monthControl, yearControl, date, maxDate, minDate
|
|
|
685
696
|
return (jsxRuntime.jsxs("div", { className: "rls-month-title-picker", children: [jsxRuntime.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onPreviousMonth, disabled: limitMinMonth }), jsxRuntime.jsx("span", { onClick: onClick, children: monthName }), jsxRuntime.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onNextMonth, disabled: limitMaxMonth })] }));
|
|
686
697
|
}
|
|
687
698
|
|
|
688
|
-
function RlsNumberField({ children, disabled, formControl,
|
|
699
|
+
function RlsNumberField({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
|
|
689
700
|
return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-box-field', {
|
|
690
701
|
focused: formControl?.focused,
|
|
691
702
|
error: formControl?.touched && !formControl?.valid,
|
|
@@ -735,7 +746,7 @@ function RlsPagination({ elements, count: defaultCount, filter, onElements, onPa
|
|
|
735
746
|
pagination.active = true;
|
|
736
747
|
setIndex(value);
|
|
737
748
|
setCurrentPagination(pagination);
|
|
738
|
-
refreshFromChanged(
|
|
749
|
+
refreshFromChanged(clonePage({ index: value }));
|
|
739
750
|
}
|
|
740
751
|
function goPagination(pagination) {
|
|
741
752
|
if (currentPagination) {
|
|
@@ -753,14 +764,14 @@ function RlsPagination({ elements, count: defaultCount, filter, onElements, onPa
|
|
|
753
764
|
else {
|
|
754
765
|
const prevIndex = value - MIN_NUMBER_PAGE;
|
|
755
766
|
if (prevIndex >= FIRST_PAGE) {
|
|
756
|
-
refreshFromChanged(
|
|
767
|
+
refreshFromChanged(clonePageFromIndex(prevIndex));
|
|
757
768
|
}
|
|
758
769
|
}
|
|
759
770
|
}
|
|
760
771
|
}
|
|
761
772
|
function goFirstPagination() {
|
|
762
773
|
if (collection.length) {
|
|
763
|
-
refreshFromChanged(
|
|
774
|
+
refreshFromChanged(clonePageFromIndex(FIRST_PAGE));
|
|
764
775
|
}
|
|
765
776
|
}
|
|
766
777
|
function goNextPagination() {
|
|
@@ -773,14 +784,14 @@ function RlsPagination({ elements, count: defaultCount, filter, onElements, onPa
|
|
|
773
784
|
else {
|
|
774
785
|
const nextIndex = value + 1;
|
|
775
786
|
if (nextIndex <= maxPage) {
|
|
776
|
-
refreshFromChanged(
|
|
787
|
+
refreshFromChanged(clonePageFromIndex(nextIndex));
|
|
777
788
|
}
|
|
778
789
|
}
|
|
779
790
|
}
|
|
780
791
|
}
|
|
781
792
|
function goLastPagination() {
|
|
782
793
|
if (collection.length) {
|
|
783
|
-
refreshFromChanged(
|
|
794
|
+
refreshFromChanged(clonePageFromIndex(maxPage - MIN_NUMBER_PAGE));
|
|
784
795
|
}
|
|
785
796
|
}
|
|
786
797
|
function createPageCollection(props) {
|
|
@@ -794,17 +805,11 @@ function RlsPagination({ elements, count: defaultCount, filter, onElements, onPa
|
|
|
794
805
|
}
|
|
795
806
|
function refreshFromElements(elements) {
|
|
796
807
|
elements.length
|
|
797
|
-
? refreshFromChanged(
|
|
808
|
+
? refreshFromChanged(refreshPage(elements, filter))
|
|
798
809
|
: rebootPagination();
|
|
799
810
|
}
|
|
800
811
|
function refreshFromFilter(filter) {
|
|
801
|
-
refreshFromChanged(
|
|
802
|
-
}
|
|
803
|
-
function createRefreshProps(elements, filter) {
|
|
804
|
-
const collection = refreshCollection(elements, filter);
|
|
805
|
-
const maxPage = refreshMaxPage(collection, count);
|
|
806
|
-
const index = refreshIndex(collection, maxPage);
|
|
807
|
-
return createPageProps({ collection, index, maxPage });
|
|
812
|
+
refreshFromChanged(refreshPage(elements, filter));
|
|
808
813
|
}
|
|
809
814
|
function refreshFromChanged(page) {
|
|
810
815
|
refreshPaginations(page);
|
|
@@ -832,13 +837,6 @@ function RlsPagination({ elements, count: defaultCount, filter, onElements, onPa
|
|
|
832
837
|
setIndex(newIndex);
|
|
833
838
|
return newIndex;
|
|
834
839
|
}
|
|
835
|
-
function rebootPagination() {
|
|
836
|
-
setCollection([]);
|
|
837
|
-
setMaxPage(0);
|
|
838
|
-
setIndex(0);
|
|
839
|
-
setPaginations([]);
|
|
840
|
-
onChangeElements([]);
|
|
841
|
-
}
|
|
842
840
|
function refreshDescription(page) {
|
|
843
841
|
const { collection, count, index } = page;
|
|
844
842
|
const totalCount = elements.length;
|
|
@@ -874,6 +872,23 @@ function RlsPagination({ elements, count: defaultCount, filter, onElements, onPa
|
|
|
874
872
|
}
|
|
875
873
|
setPaginations(paginations);
|
|
876
874
|
}
|
|
875
|
+
function clonePage(pagePartial) {
|
|
876
|
+
return {
|
|
877
|
+
collection: pagePartial.collection || collection,
|
|
878
|
+
index: typeof pagePartial.index === 'number' ? pagePartial.index : index,
|
|
879
|
+
count: pagePartial.count || count,
|
|
880
|
+
maxPage: typeof pagePartial.maxPage === 'number' ? pagePartial.maxPage : maxPage
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function clonePageFromIndex(index) {
|
|
884
|
+
return clonePage({ index });
|
|
885
|
+
}
|
|
886
|
+
function refreshPage(elements, filter) {
|
|
887
|
+
const collection = refreshCollection(elements, filter);
|
|
888
|
+
const maxPage = refreshMaxPage(collection, count);
|
|
889
|
+
const index = refreshIndex(collection, maxPage);
|
|
890
|
+
return clonePage({ collection, index, maxPage });
|
|
891
|
+
}
|
|
877
892
|
function createPagination(value, index) {
|
|
878
893
|
const active = value === index;
|
|
879
894
|
const pagination = {
|
|
@@ -886,16 +901,12 @@ function RlsPagination({ elements, count: defaultCount, filter, onElements, onPa
|
|
|
886
901
|
}
|
|
887
902
|
return pagination;
|
|
888
903
|
}
|
|
889
|
-
function
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
index: typeof props.index === 'number' ? props.index : index,
|
|
896
|
-
count: props.count || count,
|
|
897
|
-
maxPage: typeof props.maxPage === 'number' ? props.maxPage : maxPage
|
|
898
|
-
};
|
|
904
|
+
function rebootPagination() {
|
|
905
|
+
setCollection([]);
|
|
906
|
+
setMaxPage(0);
|
|
907
|
+
setIndex(0);
|
|
908
|
+
setPaginations([]);
|
|
909
|
+
onChangeElements([]);
|
|
899
910
|
}
|
|
900
911
|
return (jsxRuntime.jsxs("div", { className: "rls-pagination", children: [jsxRuntime.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntime.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: firstPage, children: jsxRuntime.jsx(RlsIcon, { value: "arrowhead-left" }) }), jsxRuntime.jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: firstPage, children: jsxRuntime.jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsxRuntime.jsx("div", { className: "rls-pagination__pages", children: paginations.map((page, index) => {
|
|
901
912
|
return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-pagination__page', {
|
|
@@ -950,7 +961,7 @@ function RlsSwitchLabel({ children, disabled, extended, formControl, rlsTheme })
|
|
|
950
961
|
return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-switch-label', { disabled, extended }), "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-switch-label__component", onClick: onToggle, children: jsxRuntime.jsx(RlsSwitch, { checked: checked, disabled: disabled }) }), jsxRuntime.jsx("label", { className: "rls-switch-label__text", children: children })] }));
|
|
951
962
|
}
|
|
952
963
|
|
|
953
|
-
function RlsTextField({ children, disabled, formControl,
|
|
964
|
+
function RlsTextField({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
|
|
954
965
|
return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-box-field', {
|
|
955
966
|
focused: formControl?.focused,
|
|
956
967
|
error: formControl?.touched && !formControl?.valid,
|
|
@@ -963,7 +974,7 @@ function RlsToolbar({ actions, children, subtitle }) {
|
|
|
963
974
|
}
|
|
964
975
|
|
|
965
976
|
const COUNT_YEAR_RANGE = 4;
|
|
966
|
-
class
|
|
977
|
+
class YearPickerFactory {
|
|
967
978
|
constructor(props) {
|
|
968
979
|
const { value, maxDate, minDate } = props;
|
|
969
980
|
this.value = value;
|
|
@@ -971,7 +982,7 @@ class FactoryYearPicker {
|
|
|
971
982
|
this.minDate = minDate;
|
|
972
983
|
}
|
|
973
984
|
static execute(props) {
|
|
974
|
-
const factory = new
|
|
985
|
+
const factory = new YearPickerFactory(props);
|
|
975
986
|
let year = props.year;
|
|
976
987
|
if (factory.minOverflowYear(year)) {
|
|
977
988
|
year = factory.minYear;
|
|
@@ -1042,10 +1053,10 @@ class FactoryYearPicker {
|
|
|
1042
1053
|
}
|
|
1043
1054
|
}
|
|
1044
1055
|
function createYearPicker(props) {
|
|
1045
|
-
return
|
|
1056
|
+
return YearPickerFactory.execute(props);
|
|
1046
1057
|
}
|
|
1047
1058
|
|
|
1048
|
-
function RlsYearPicker({ formControl, date: date, disabled: disabledPicker, maxDate, minDate, rlsTheme }) {
|
|
1059
|
+
function RlsYearPicker({ formControl, date: date, disabled: disabledPicker, maxDate, minDate, rlsTheme, onValue }) {
|
|
1049
1060
|
const initialDate = date || new Date();
|
|
1050
1061
|
const initialYear = formControl?.state || initialDate.getFullYear();
|
|
1051
1062
|
const [value, setValue] = react.useState(initialYear);
|
|
@@ -1074,12 +1085,15 @@ function RlsYearPicker({ formControl, date: date, disabled: disabledPicker, maxD
|
|
|
1074
1085
|
formControl?.setState(value);
|
|
1075
1086
|
setYear(value);
|
|
1076
1087
|
setValue(value);
|
|
1088
|
+
if (onValue) {
|
|
1089
|
+
onValue(value);
|
|
1090
|
+
}
|
|
1077
1091
|
}
|
|
1078
1092
|
return (jsxRuntime.jsxs("div", { className: "rls-year-picker", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: "rls-year-picker__header", children: [jsxRuntime.jsx("div", { className: "rls-year-picker__action rls-year-picker__action--prev", children: jsxRuntime.jsx("button", { disabled: !template.hasPrevious || disabledPicker, onClick: onClickPrev, children: jsxRuntime.jsx(RlsIcon, { value: "arrow-ios-left" }) }) }), jsxRuntime.jsx("div", { className: "rls-year-picker__title", children: jsxRuntime.jsxs("label", { className: "title1-bold", children: [template.minRange, " - ", template.maxRange] }) }), jsxRuntime.jsx("div", { className: "rls-year-picker__action rls-year-picker__action--next", children: jsxRuntime.jsx("button", { disabled: !template.hasNext || disabledPicker, onClick: onClickNext, children: jsxRuntime.jsx(RlsIcon, { value: "arrow-ios-right" }) }) })] }), jsxRuntime.jsx("div", { className: "rls-year-picker__component", children: template.years.map(({ value, disabled, selected }, index) => (jsxRuntime.jsx("div", { className: renderClassStatus('rls-year-picker__year', {
|
|
1079
1093
|
disabled: disabled || disabledPicker,
|
|
1080
1094
|
selected
|
|
1081
1095
|
}), onClick: () => {
|
|
1082
|
-
if (value) {
|
|
1096
|
+
if (value && !disabled) {
|
|
1083
1097
|
onChange(value);
|
|
1084
1098
|
}
|
|
1085
1099
|
}, children: jsxRuntime.jsx("span", { className: "rls-year-picker__year__span body1-medium", children: value || '????' }) }, index))) })] }));
|
|
@@ -1646,7 +1660,7 @@ const VISIBILITY$1 = {
|
|
|
1646
1660
|
year: true
|
|
1647
1661
|
}
|
|
1648
1662
|
};
|
|
1649
|
-
function RlsDatePicker({ automatic, date, formControl, disabled, maxDate, minDate,
|
|
1663
|
+
function RlsDatePicker({ automatic, date, formControl, disabled, maxDate, minDate, rlsTheme, onListener }) {
|
|
1650
1664
|
const dateInitial = formControl?.state || date || new Date();
|
|
1651
1665
|
const yearControl = useReactControl({ state: dateInitial.getFullYear() });
|
|
1652
1666
|
const dayControl = useReactControl({ state: dateInitial.getDate() });
|
|
@@ -1719,7 +1733,7 @@ function RlsModal({ children, visible, rlsTheme }) {
|
|
|
1719
1733
|
return ReactDOM.createPortal(jsxRuntime.jsxs("div", { className: renderClassStatus('rls-modal', { visible }), "rls-theme": rlsTheme, children: [jsxRuntime.jsx("div", { className: "rls-modal__component", children: children }), jsxRuntime.jsx("div", { className: "rls-modal__backdrop" })] }), document.body);
|
|
1720
1734
|
}
|
|
1721
1735
|
|
|
1722
|
-
function RlsDateField({ children, date, disabled, formControl, maxDate, minDate, placeholder, rlsTheme }) {
|
|
1736
|
+
function RlsDateField({ children, date, disabled, formControl, maxDate, minDate, placeholder, rlsTheme, onValue }) {
|
|
1723
1737
|
const dateInitial = formControl?.state || date || new Date();
|
|
1724
1738
|
const [value, setValue] = react.useState(dateInitial);
|
|
1725
1739
|
const [show, setShow] = react.useState(false);
|
|
@@ -1730,10 +1744,18 @@ function RlsDateField({ children, date, disabled, formControl, maxDate, minDate,
|
|
|
1730
1744
|
function onClickInput() {
|
|
1731
1745
|
setShow(true);
|
|
1732
1746
|
}
|
|
1747
|
+
function onChange(value, ignoreControl = false) {
|
|
1748
|
+
if (!ignoreControl) {
|
|
1749
|
+
formControl?.setState(undefined);
|
|
1750
|
+
}
|
|
1751
|
+
setValue(undefined);
|
|
1752
|
+
if (onValue) {
|
|
1753
|
+
onValue(value);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1733
1756
|
function onClean() {
|
|
1734
1757
|
if (value) {
|
|
1735
|
-
|
|
1736
|
-
setValue(undefined);
|
|
1758
|
+
onChange(undefined);
|
|
1737
1759
|
if (formControl && !formControl.touched) {
|
|
1738
1760
|
formControl.touch();
|
|
1739
1761
|
}
|
|
@@ -1742,9 +1764,9 @@ function RlsDateField({ children, date, disabled, formControl, maxDate, minDate,
|
|
|
1742
1764
|
setShow(true);
|
|
1743
1765
|
}
|
|
1744
1766
|
}
|
|
1745
|
-
return (jsxRuntime.jsxs("div", { className: "rls-date-field", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: renderClassStatus('rls-box-field', { disabled }), children: [children && jsxRuntime.jsx("label", { className: "rls-box-field__label", children: children }), jsxRuntime.jsx("div", { className: "rls-box-field__component", children: jsxRuntime.jsxs("div", { className: "rls-box-field__body", children: [jsxRuntime.jsx("input", { className: "rls-date-field__control", type: "text", value: description, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntime.jsx("button", { className: "rls-date-field__action", onClick: onClean, disabled: disabled, children: jsxRuntime.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), formControl?.touched && formControl?.error && (jsxRuntime.jsx("div", { className: "rls-box-field__error", children: jsxRuntime.jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }), jsxRuntime.jsx(RlsModal, { visible: show, children: jsxRuntime.jsx(RlsDatePicker, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
|
|
1746
|
-
if (
|
|
1747
|
-
|
|
1767
|
+
return (jsxRuntime.jsxs("div", { className: "rls-date-field", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: renderClassStatus('rls-box-field', { disabled }), children: [children && jsxRuntime.jsx("label", { className: "rls-box-field__label", children: children }), jsxRuntime.jsx("div", { className: "rls-box-field__component", children: jsxRuntime.jsxs("div", { className: "rls-box-field__body", children: [jsxRuntime.jsx("input", { className: "rls-date-field__control", type: "text", value: description, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntime.jsx("button", { className: "rls-date-field__action", onClick: onClean, disabled: disabled, children: jsxRuntime.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), formControl?.touched && formControl?.error && (jsxRuntime.jsx("div", { className: "rls-box-field__error", children: jsxRuntime.jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }), jsxRuntime.jsx(RlsModal, { visible: show, children: jsxRuntime.jsx(RlsDatePicker, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value, type }) => {
|
|
1768
|
+
if (type !== PickerListenerType.Cancel) {
|
|
1769
|
+
onChange(value, true);
|
|
1748
1770
|
}
|
|
1749
1771
|
setShow(false);
|
|
1750
1772
|
if (formControl && !formControl.touched) {
|