@rolster/react-components 18.21.8 → 18.21.10

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/es/index.js CHANGED
@@ -1358,7 +1358,8 @@ function RlsTabularText({ value }) {
1358
1358
  }
1359
1359
 
1360
1360
  function RlsAmount({ value, decimals, rlsTheme, symbol }) {
1361
- return (jsxRuntimeExports.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntimeExports.jsx("span", { children: symbol }), jsxRuntimeExports.jsx(RlsTabularText, { value: currencyFormat({ value, decimals }) })] }));
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 })] }));
1362
1363
  }
1363
1364
 
1364
1365
  function renderClassStatus(base, status = {}, additionals) {
@@ -1537,10 +1538,18 @@ function RlsCheckBoxControl({ formControl, disabled, identifier, rlsTheme }) {
1537
1538
  }
1538
1539
 
1539
1540
  function RlsInput({ children, disabled, formControl, identifier, onValue, placeholder, type, value }) {
1541
+ const valueInitial = formControl?.value ?? value ? String(value) : '';
1542
+ const [valueInput, setValueInput] = useState(valueInitial);
1540
1543
  const [focused, setFocused] = useState(false);
1544
+ useEffect(() => {
1545
+ const valueControl = formControl?.value ? String(formControl.value) : '';
1546
+ (!focused || valueInput !== valueControl) && setValueInput(valueControl);
1547
+ }, [formControl?.value]);
1541
1548
  const onChange = useCallback((event) => {
1542
- const value = type === 'number' ? +event.target.value : event.target.value;
1549
+ const valueInput = event.target.value;
1550
+ const value = type === 'number' ? +valueInput : valueInput;
1543
1551
  onValue && onValue(value);
1552
+ setValueInput(valueInput);
1544
1553
  formControl?.setValue(value);
1545
1554
  }, [formControl, onValue]);
1546
1555
  const onFocus = useCallback(() => {
@@ -1557,25 +1566,25 @@ function RlsInput({ children, disabled, formControl, identifier, onValue, placeh
1557
1566
  focused: formControl?.focused ?? focused
1558
1567
  });
1559
1568
  }, [formControl?.focused, formControl?.disabled, focused, disabled]);
1560
- return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, children: [jsxRuntimeExports.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?.value || value || '' }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
1569
+ return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, children: [jsxRuntimeExports.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: valueInput }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
1561
1570
  }
1562
1571
 
1563
1572
  function RlsInputMoney({ decimals, disabled, formControl, identifier, onValue, placeholder, symbol, value }) {
1564
- const [valueInput, setValueInput] = useState(value || 0);
1573
+ const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
1565
1574
  const onValueInput = useCallback((value) => {
1566
1575
  !formControl && setValueInput(value);
1567
1576
  onValue && onValue(value);
1568
1577
  }, [formControl, onValue]);
1569
- return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onValueInput, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value ?? value ?? valueInput, symbol: symbol, decimals: decimals }) }) }));
1578
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: valueInput, disabled: disabled, placeholder: placeholder, onValue: onValueInput, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value ?? valueInput, symbol: symbol, decimals: decimals }) }) }));
1570
1579
  }
1571
1580
 
1572
1581
  function RlsInputNumber({ disabled, formControl, identifier, onValue, placeholder, value }) {
1573
- const [valueInput, setValueInput] = useState(value ?? 0);
1582
+ const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
1574
1583
  const onValueInput = useCallback((value) => {
1575
1584
  !formControl && setValueInput(value);
1576
1585
  onValue && onValue(value);
1577
1586
  }, [formControl, onValue]);
1578
- return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onValueInput, children: formControl?.value ?? value ?? valueInput }) }));
1587
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: valueInput, disabled: disabled, placeholder: placeholder, onValue: onValueInput, children: formControl?.value ?? valueInput }) }));
1579
1588
  }
1580
1589
 
1581
1590
  function RlsInputPassword({ disabled, formControl, identifier, onValue, placeholder, type }) {
@@ -1610,12 +1619,12 @@ function RlsInputSearch({ formControl, identifier, onSearch, placeholder }) {
1610
1619
  }
1611
1620
 
1612
1621
  function RlsInputText({ disabled, formControl, identifier, onValue, placeholder, value }) {
1613
- const [valueInput, setValueInput] = useState(value ?? '');
1622
+ const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? '');
1614
1623
  const onValueInput = useCallback((value) => {
1615
1624
  !formControl && setValueInput(value);
1616
1625
  onValue && onValue(value);
1617
1626
  }, [formControl, onValue]);
1618
- return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "text", value: value, disabled: disabled, placeholder: placeholder, onValue: onValueInput, children: formControl?.value ?? value ?? valueInput }) }));
1627
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "text", value: valueInput, disabled: disabled, placeholder: placeholder, onValue: onValueInput, children: formControl?.value ?? valueInput }) }));
1619
1628
  }
1620
1629
 
1621
1630
  function RlsLabel({ children, rlsTheme }) {
@@ -2240,7 +2249,7 @@ const reactI18n = i18n({
2240
2249
  dateActionToday: 'Hoy',
2241
2250
  listEmptyDescription: 'Lo sentimos, en el momento no hay elementos en el listado',
2242
2251
  listEmptyTitle: 'Selección no disponible',
2243
- listInputPlaceholder: 'Buscar...'
2252
+ listInputPlaceholder: 'Escriba palabre clave para filtrar...'
2244
2253
  },
2245
2254
  en: {
2246
2255
  confirmationActionApproved: 'Approved',
@@ -2249,7 +2258,7 @@ const reactI18n = i18n({
2249
2258
  dateActionToday: 'Today',
2250
2259
  listEmptyDescription: 'Sorry, there are currently no items in the list',
2251
2260
  listEmptyTitle: 'Selection not available',
2252
- listInputPlaceholder: 'Search...'
2261
+ listInputPlaceholder: 'Enter keyword to filter...'
2253
2262
  }
2254
2263
  });
2255
2264
 
@@ -2307,52 +2316,58 @@ function useConfirmation() {
2307
2316
  };
2308
2317
  }
2309
2318
 
2319
+ function RlsDatatable({ children, datatable, footer, header, identifier, rlsTheme, summary, toolbar }) {
2320
+ const className = useMemo(() => {
2321
+ return renderClassStatus('rls-datatable', {
2322
+ scrolleable: datatable?.scrolleable
2323
+ });
2324
+ }, [datatable]);
2325
+ return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [toolbar && jsxRuntimeExports.jsx("div", { className: "rls-datatable__toolbar", children: toolbar }), jsxRuntimeExports.jsxs("table", { id: identifier, children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__head", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.tableRef, className: "rls-datatable__body", children: children })] }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__summary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__footer", children: footer })] }));
2326
+ }
2310
2327
  function RlsDatatableHeader({ children, identifier }) {
2311
2328
  return (jsxRuntimeExports.jsx("tr", { id: identifier, className: "rls-datatable__header", children: children }));
2312
2329
  }
2313
2330
  function RlsDatatableTitle({ children, className, control, identifier }) {
2314
- const classDatatableName = useMemo(() => {
2331
+ const classNameTitle = useMemo(() => {
2315
2332
  return renderClassStatus('rls-datatable__title', { control }, className);
2316
- }, [control, className]);
2317
- return (jsxRuntimeExports.jsx("th", { id: identifier, className: classDatatableName, children: children }));
2333
+ }, [className, control]);
2334
+ return (jsxRuntimeExports.jsx("th", { id: identifier, className: classNameTitle, children: children }));
2318
2335
  }
2319
2336
  function RlsDatatableSubheader({ children, className, identifier }) {
2320
- const classDatatableName = useMemo(() => {
2337
+ const classNameSubheader = useMemo(() => {
2321
2338
  return renderClassStatus('rls-datatable__subheader', {}, className);
2322
2339
  }, [className]);
2323
- return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classDatatableName, children: children }));
2340
+ return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classNameSubheader, children: children }));
2324
2341
  }
2325
- function RlsDatatableRecord({ children, className, error, identifier, info, successs, warning }) {
2326
- const classDatatableName = useMemo(() => {
2327
- return renderClassStatus('rls-datatable__record', { error, info, successs, warning }, className);
2328
- }, [error, info, successs, warning, className]);
2329
- return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classDatatableName, children: children }));
2342
+ function RlsDatatableRecord({ children, className, error, identifier, info, overflow, successs, warning }) {
2343
+ const classNameRecord = useMemo(() => {
2344
+ return renderClassStatus('rls-datatable__record', { error, info, overflow, successs, warning }, className);
2345
+ }, [className, error, info, overflow, successs, warning]);
2346
+ return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classNameRecord, children: children }));
2330
2347
  }
2331
- function RlsDatatableTotals({ children, className, error, identifier, info, successs, warning }) {
2332
- const classDatatableName = useMemo(() => {
2333
- return renderClassStatus('rls-datatable__totals', { error, info, successs, warning }, className);
2334
- }, [error, info, successs, warning, className]);
2335
- return (jsxRuntimeExports.jsx("div", { id: identifier, className: classDatatableName, children: children }));
2348
+ function RlsDatatableTotals({ children, className, error, identifier, info, overflow, successs, warning }) {
2349
+ const classNameTotals = useMemo(() => {
2350
+ return renderClassStatus('rls-datatable__totals', { error, info, overflow, successs, warning }, className);
2351
+ }, [className, error, info, overflow, successs, warning]);
2352
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: classNameTotals, children: children }));
2336
2353
  }
2337
2354
  function RlsDatatableCell({ children, className, control, identifier, overflow }) {
2338
- const classDatatableName = useMemo(() => {
2355
+ const classNameCell = useMemo(() => {
2339
2356
  return renderClassStatus('rls-datatable__cell', { control, overflow }, className);
2340
- }, [control, overflow, className]);
2341
- return (jsxRuntimeExports.jsx("th", { id: identifier, className: classDatatableName, children: children }));
2357
+ }, [className, control, overflow]);
2358
+ return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameCell, children: children }));
2342
2359
  }
2343
2360
  function RlsDatatableData({ children, className, control, identifier, overflow }) {
2344
- const classDatatableName = useMemo(() => {
2361
+ const classNameData = useMemo(() => {
2345
2362
  return renderClassStatus('rls-datatable__data', { control, overflow }, className);
2346
- }, [control, overflow, className]);
2347
- return (jsxRuntimeExports.jsx("div", { id: identifier, className: classDatatableName, children: children }));
2363
+ }, [className, overflow, control]);
2364
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: classNameData, children: children }));
2348
2365
  }
2349
- function RlsDatatable({ children, datatable, footer, header, identifier, rlsTheme, summary, toolbar }) {
2350
- const className = useMemo(() => {
2351
- return renderClassStatus('rls-datatable', {
2352
- scrolleable: datatable?.scrolleable
2353
- });
2354
- }, [datatable]);
2355
- return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [toolbar && jsxRuntimeExports.jsx("div", { className: "rls-datatable__toolbar", children: toolbar }), jsxRuntimeExports.jsxs("table", { id: identifier, children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__head", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.tableRef, className: "rls-datatable__body", children: children })] }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__summary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__footer", children: footer })] }));
2366
+ function RlsDatatableFloating({ children, className, identifier, invested }) {
2367
+ const classNameFloating = useMemo(() => {
2368
+ return renderClassStatus('rls-datatable__floating', { invested }, className);
2369
+ }, [className, invested]);
2370
+ return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameFloating, children: children }));
2356
2371
  }
2357
2372
 
2358
2373
  function createObserver(options) {
@@ -2431,7 +2446,7 @@ function useListController(props) {
2431
2446
  }
2432
2447
  else if (valueProtected.current) {
2433
2448
  const element = collection.find(valueProtected.current);
2434
- element && setFormValue(element);
2449
+ element ? setFormValue(element) : refreshState({ ...state, value: '' });
2435
2450
  }
2436
2451
  else {
2437
2452
  automatic
@@ -2639,7 +2654,7 @@ function RlsFieldAutocompleteTemplate(props) {
2639
2654
  }, [autocomplete.higher, autocomplete.modalIsVisible]);
2640
2655
  const onInputSearch = useCallback((event) => {
2641
2656
  autocomplete.setPattern(event.target.value);
2642
- }, []);
2657
+ }, [autocomplete.setPattern]);
2643
2658
  const onClickSearch = useCallback(() => {
2644
2659
  onSearch && onSearch(autocomplete.pattern);
2645
2660
  }, [onSearch, autocomplete.pattern]);
@@ -3108,5 +3123,5 @@ function RlsApplication({ children }) {
3108
3123
  return (jsxRuntimeExports.jsxs(RlsContext.Provider, { value: { confirmation, snackbar, withNavbar }, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
3109
3124
  }
3110
3125
 
3111
- export { ConfirmationResult, RlsAlert, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, setErrorsI18n, useConfirmation, useDatatable, useListController, useSnackbar };
3126
+ export { ConfirmationResult, RlsAlert, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, setErrorsI18n, useConfirmation, useDatatable, useListController, useSnackbar };
3112
3127
  //# sourceMappingURL=index.js.map