@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/cjs/index.js CHANGED
@@ -1360,7 +1360,8 @@ function RlsTabularText({ value }) {
1360
1360
  }
1361
1361
 
1362
1362
  function RlsAmount({ value, decimals, rlsTheme, symbol }) {
1363
- return (jsxRuntimeExports.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntimeExports.jsx("span", { children: symbol }), jsxRuntimeExports.jsx(RlsTabularText, { value: commons.currencyFormat({ value, decimals }) })] }));
1363
+ const amount = require$$0.useMemo(() => commons.currencyFormat({ value, decimals }), [value, decimals]);
1364
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntimeExports.jsx("span", { children: symbol }), jsxRuntimeExports.jsx(RlsTabularText, { value: amount })] }));
1364
1365
  }
1365
1366
 
1366
1367
  function renderClassStatus(base, status = {}, additionals) {
@@ -1539,10 +1540,18 @@ function RlsCheckBoxControl({ formControl, disabled, identifier, rlsTheme }) {
1539
1540
  }
1540
1541
 
1541
1542
  function RlsInput({ children, disabled, formControl, identifier, onValue, placeholder, type, value }) {
1543
+ const valueInitial = formControl?.value ?? value ? String(value) : '';
1544
+ const [valueInput, setValueInput] = require$$0.useState(valueInitial);
1542
1545
  const [focused, setFocused] = require$$0.useState(false);
1546
+ require$$0.useEffect(() => {
1547
+ const valueControl = formControl?.value ? String(formControl.value) : '';
1548
+ (!focused || valueInput !== valueControl) && setValueInput(valueControl);
1549
+ }, [formControl?.value]);
1543
1550
  const onChange = require$$0.useCallback((event) => {
1544
- const value = type === 'number' ? +event.target.value : event.target.value;
1551
+ const valueInput = event.target.value;
1552
+ const value = type === 'number' ? +valueInput : valueInput;
1545
1553
  onValue && onValue(value);
1554
+ setValueInput(valueInput);
1546
1555
  formControl?.setValue(value);
1547
1556
  }, [formControl, onValue]);
1548
1557
  const onFocus = require$$0.useCallback(() => {
@@ -1559,25 +1568,25 @@ function RlsInput({ children, disabled, formControl, identifier, onValue, placeh
1559
1568
  focused: formControl?.focused ?? focused
1560
1569
  });
1561
1570
  }, [formControl?.focused, formControl?.disabled, focused, disabled]);
1562
- 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 })] }));
1571
+ 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 })] }));
1563
1572
  }
1564
1573
 
1565
1574
  function RlsInputMoney({ decimals, disabled, formControl, identifier, onValue, placeholder, symbol, value }) {
1566
- const [valueInput, setValueInput] = require$$0.useState(value || 0);
1575
+ const [valueInput, setValueInput] = require$$0.useState(formControl?.value ?? value ?? 0);
1567
1576
  const onValueInput = require$$0.useCallback((value) => {
1568
1577
  !formControl && setValueInput(value);
1569
1578
  onValue && onValue(value);
1570
1579
  }, [formControl, onValue]);
1571
- 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 }) }) }));
1580
+ 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 }) }) }));
1572
1581
  }
1573
1582
 
1574
1583
  function RlsInputNumber({ disabled, formControl, identifier, onValue, placeholder, value }) {
1575
- const [valueInput, setValueInput] = require$$0.useState(value ?? 0);
1584
+ const [valueInput, setValueInput] = require$$0.useState(formControl?.value ?? value ?? 0);
1576
1585
  const onValueInput = require$$0.useCallback((value) => {
1577
1586
  !formControl && setValueInput(value);
1578
1587
  onValue && onValue(value);
1579
1588
  }, [formControl, onValue]);
1580
- 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 }) }));
1589
+ 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 }) }));
1581
1590
  }
1582
1591
 
1583
1592
  function RlsInputPassword({ disabled, formControl, identifier, onValue, placeholder, type }) {
@@ -1612,12 +1621,12 @@ function RlsInputSearch({ formControl, identifier, onSearch, placeholder }) {
1612
1621
  }
1613
1622
 
1614
1623
  function RlsInputText({ disabled, formControl, identifier, onValue, placeholder, value }) {
1615
- const [valueInput, setValueInput] = require$$0.useState(value ?? '');
1624
+ const [valueInput, setValueInput] = require$$0.useState(formControl?.value ?? value ?? '');
1616
1625
  const onValueInput = require$$0.useCallback((value) => {
1617
1626
  !formControl && setValueInput(value);
1618
1627
  onValue && onValue(value);
1619
1628
  }, [formControl, onValue]);
1620
- 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 }) }));
1629
+ 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 }) }));
1621
1630
  }
1622
1631
 
1623
1632
  function RlsLabel({ children, rlsTheme }) {
@@ -2242,7 +2251,7 @@ const reactI18n = i18n.i18n({
2242
2251
  dateActionToday: 'Hoy',
2243
2252
  listEmptyDescription: 'Lo sentimos, en el momento no hay elementos en el listado',
2244
2253
  listEmptyTitle: 'Selección no disponible',
2245
- listInputPlaceholder: 'Buscar...'
2254
+ listInputPlaceholder: 'Escriba palabre clave para filtrar...'
2246
2255
  },
2247
2256
  en: {
2248
2257
  confirmationActionApproved: 'Approved',
@@ -2251,7 +2260,7 @@ const reactI18n = i18n.i18n({
2251
2260
  dateActionToday: 'Today',
2252
2261
  listEmptyDescription: 'Sorry, there are currently no items in the list',
2253
2262
  listEmptyTitle: 'Selection not available',
2254
- listInputPlaceholder: 'Search...'
2263
+ listInputPlaceholder: 'Enter keyword to filter...'
2255
2264
  }
2256
2265
  });
2257
2266
 
@@ -2309,52 +2318,58 @@ function useConfirmation() {
2309
2318
  };
2310
2319
  }
2311
2320
 
2321
+ function RlsDatatable({ children, datatable, footer, header, identifier, rlsTheme, summary, toolbar }) {
2322
+ const className = require$$0.useMemo(() => {
2323
+ return renderClassStatus('rls-datatable', {
2324
+ scrolleable: datatable?.scrolleable
2325
+ });
2326
+ }, [datatable]);
2327
+ 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 })] }));
2328
+ }
2312
2329
  function RlsDatatableHeader({ children, identifier }) {
2313
2330
  return (jsxRuntimeExports.jsx("tr", { id: identifier, className: "rls-datatable__header", children: children }));
2314
2331
  }
2315
2332
  function RlsDatatableTitle({ children, className, control, identifier }) {
2316
- const classDatatableName = require$$0.useMemo(() => {
2333
+ const classNameTitle = require$$0.useMemo(() => {
2317
2334
  return renderClassStatus('rls-datatable__title', { control }, className);
2318
- }, [control, className]);
2319
- return (jsxRuntimeExports.jsx("th", { id: identifier, className: classDatatableName, children: children }));
2335
+ }, [className, control]);
2336
+ return (jsxRuntimeExports.jsx("th", { id: identifier, className: classNameTitle, children: children }));
2320
2337
  }
2321
2338
  function RlsDatatableSubheader({ children, className, identifier }) {
2322
- const classDatatableName = require$$0.useMemo(() => {
2339
+ const classNameSubheader = require$$0.useMemo(() => {
2323
2340
  return renderClassStatus('rls-datatable__subheader', {}, className);
2324
2341
  }, [className]);
2325
- return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classDatatableName, children: children }));
2342
+ return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classNameSubheader, children: children }));
2326
2343
  }
2327
- function RlsDatatableRecord({ children, className, error, identifier, info, successs, warning }) {
2328
- const classDatatableName = require$$0.useMemo(() => {
2329
- return renderClassStatus('rls-datatable__record', { error, info, successs, warning }, className);
2330
- }, [error, info, successs, warning, className]);
2331
- return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classDatatableName, children: children }));
2344
+ function RlsDatatableRecord({ children, className, error, identifier, info, overflow, successs, warning }) {
2345
+ const classNameRecord = require$$0.useMemo(() => {
2346
+ return renderClassStatus('rls-datatable__record', { error, info, overflow, successs, warning }, className);
2347
+ }, [className, error, info, overflow, successs, warning]);
2348
+ return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classNameRecord, children: children }));
2332
2349
  }
2333
- function RlsDatatableTotals({ children, className, error, identifier, info, successs, warning }) {
2334
- const classDatatableName = require$$0.useMemo(() => {
2335
- return renderClassStatus('rls-datatable__totals', { error, info, successs, warning }, className);
2336
- }, [error, info, successs, warning, className]);
2337
- return (jsxRuntimeExports.jsx("div", { id: identifier, className: classDatatableName, children: children }));
2350
+ function RlsDatatableTotals({ children, className, error, identifier, info, overflow, successs, warning }) {
2351
+ const classNameTotals = require$$0.useMemo(() => {
2352
+ return renderClassStatus('rls-datatable__totals', { error, info, overflow, successs, warning }, className);
2353
+ }, [className, error, info, overflow, successs, warning]);
2354
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: classNameTotals, children: children }));
2338
2355
  }
2339
2356
  function RlsDatatableCell({ children, className, control, identifier, overflow }) {
2340
- const classDatatableName = require$$0.useMemo(() => {
2357
+ const classNameCell = require$$0.useMemo(() => {
2341
2358
  return renderClassStatus('rls-datatable__cell', { control, overflow }, className);
2342
- }, [control, overflow, className]);
2343
- return (jsxRuntimeExports.jsx("th", { id: identifier, className: classDatatableName, children: children }));
2359
+ }, [className, control, overflow]);
2360
+ return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameCell, children: children }));
2344
2361
  }
2345
2362
  function RlsDatatableData({ children, className, control, identifier, overflow }) {
2346
- const classDatatableName = require$$0.useMemo(() => {
2363
+ const classNameData = require$$0.useMemo(() => {
2347
2364
  return renderClassStatus('rls-datatable__data', { control, overflow }, className);
2348
- }, [control, overflow, className]);
2349
- return (jsxRuntimeExports.jsx("div", { id: identifier, className: classDatatableName, children: children }));
2365
+ }, [className, overflow, control]);
2366
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: classNameData, children: children }));
2350
2367
  }
2351
- function RlsDatatable({ children, datatable, footer, header, identifier, rlsTheme, summary, toolbar }) {
2352
- const className = require$$0.useMemo(() => {
2353
- return renderClassStatus('rls-datatable', {
2354
- scrolleable: datatable?.scrolleable
2355
- });
2356
- }, [datatable]);
2357
- 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 })] }));
2368
+ function RlsDatatableFloating({ children, className, identifier, invested }) {
2369
+ const classNameFloating = require$$0.useMemo(() => {
2370
+ return renderClassStatus('rls-datatable__floating', { invested }, className);
2371
+ }, [className, invested]);
2372
+ return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameFloating, children: children }));
2358
2373
  }
2359
2374
 
2360
2375
  function createObserver(options) {
@@ -2433,7 +2448,7 @@ function useListController(props) {
2433
2448
  }
2434
2449
  else if (valueProtected.current) {
2435
2450
  const element = collection.find(valueProtected.current);
2436
- element && setFormValue(element);
2451
+ element ? setFormValue(element) : refreshState({ ...state, value: '' });
2437
2452
  }
2438
2453
  else {
2439
2454
  automatic
@@ -2641,7 +2656,7 @@ function RlsFieldAutocompleteTemplate(props) {
2641
2656
  }, [autocomplete.higher, autocomplete.modalIsVisible]);
2642
2657
  const onInputSearch = require$$0.useCallback((event) => {
2643
2658
  autocomplete.setPattern(event.target.value);
2644
- }, []);
2659
+ }, [autocomplete.setPattern]);
2645
2660
  const onClickSearch = require$$0.useCallback(() => {
2646
2661
  onSearch && onSearch(autocomplete.pattern);
2647
2662
  }, [onSearch, autocomplete.pattern]);
@@ -3130,6 +3145,7 @@ exports.RlsContext = RlsContext;
3130
3145
  exports.RlsDatatable = RlsDatatable;
3131
3146
  exports.RlsDatatableCell = RlsDatatableCell;
3132
3147
  exports.RlsDatatableData = RlsDatatableData;
3148
+ exports.RlsDatatableFloating = RlsDatatableFloating;
3133
3149
  exports.RlsDatatableHeader = RlsDatatableHeader;
3134
3150
  exports.RlsDatatableRecord = RlsDatatableRecord;
3135
3151
  exports.RlsDatatableSubheader = RlsDatatableSubheader;