@rolster/react-components 18.17.0 → 18.17.3

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
@@ -1438,25 +1438,25 @@ function RlsInput({ children, disabled, formControl, identifier, onValue, placeh
1438
1438
  return (jsxRuntimeExports.jsxs("div", { id: identifier, className: renderClassStatus('rls-input', {
1439
1439
  focused: formControl?.focused ?? focused,
1440
1440
  disabled: formControl?.disabled || disabled
1441
- }), 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 })] }));
1441
+ }), 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 })] }));
1442
1442
  }
1443
1443
 
1444
1444
  function RlsInputMoney({ decimals, disabled, formControl, identifier, onValue, placeholder, symbol, value }) {
1445
1445
  const [valueInput, setValueInput] = useState(value || 0);
1446
- function onChange(value) {
1446
+ function onValueInput(value) {
1447
1447
  !formControl && setValueInput(value);
1448
1448
  onValue && onValue(value);
1449
1449
  }
1450
- 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: onChange, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value ?? value ?? valueInput, symbol: symbol, decimals: decimals }) }) }));
1450
+ 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 }) }) }));
1451
1451
  }
1452
1452
 
1453
1453
  function RlsInputNumber({ disabled, formControl, identifier, onValue, placeholder, value }) {
1454
1454
  const [valueInput, setValueInput] = useState(value ?? 0);
1455
- function onChange(value) {
1455
+ function onValueInput(value) {
1456
1456
  !formControl && setValueInput(value);
1457
1457
  onValue && onValue(value);
1458
1458
  }
1459
- 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: onChange, children: formControl?.value ?? value ?? valueInput }) }));
1459
+ 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 }) }));
1460
1460
  }
1461
1461
 
1462
1462
  function RlsInputPassword({ disabled, formControl, identifier, onValue, placeholder, type }) {
@@ -1485,11 +1485,11 @@ function RlsInputSearch({ formControl, identifier, onSearch, placeholder }) {
1485
1485
 
1486
1486
  function RlsInputText({ disabled, formControl, identifier, onValue, placeholder, value }) {
1487
1487
  const [valueInput, setValueInput] = useState(value ?? '');
1488
- function onChange(value) {
1488
+ function onValueInput(value) {
1489
1489
  !formControl && setValueInput(value);
1490
1490
  onValue && onValue(value);
1491
1491
  }
1492
- 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: onChange, children: formControl?.value ?? value ?? valueInput }) }));
1492
+ 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 }) }));
1493
1493
  }
1494
1494
 
1495
1495
  function RlsLabel({ children, rlsTheme }) {
@@ -1986,34 +1986,36 @@ class ConfirmationResult extends PartialSealed {
1986
1986
  }
1987
1987
  }
1988
1988
  function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title, visible }) {
1989
- return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__header", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-confirmation__title", children: title }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__subtitle", children: subtitle }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__body", children: content && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__message", children: content })) }), (approved || reject) && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__actions", children: [approved && (jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: approved.onClick, children: approved.label })), reject && (jsxRuntimeExports.jsx(RlsButton, { type: "outline", onClick: reject.onClick, children: reject.label }))] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__backdrop" })] }));
1989
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__header", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-confirmation__title", children: title }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__subtitle", children: subtitle }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__body", children: content && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__message", children: content })) }), (approved || reject) && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__actions", children: [approved && (jsxRuntimeExports.jsx(RlsButton, { identifier: approved.identifier, type: "raised", onClick: approved.onClick, children: approved.label })), reject && (jsxRuntimeExports.jsx(RlsButton, { identifier: reject.identifier, type: "outline", onClick: reject.onClick, children: reject.label }))] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__backdrop" })] }));
1990
1990
  }
1991
1991
  function useConfirmationService() {
1992
1992
  const [config, setConfig] = useState({});
1993
1993
  const [visible, setVisible] = useState(false);
1994
1994
  const rlsConfirmation = ReactDOM.createPortal(jsxRuntimeExports.jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
1995
- function confirmation(config) {
1995
+ function confirmation(options) {
1996
1996
  return new Promise((resolve) => {
1997
- const { content, rlsTheme, subtitle, title, approved, reject } = config;
1997
+ const { content, rlsTheme, subtitle, title, approved, reject } = options;
1998
1998
  setConfig({
1999
1999
  content,
2000
2000
  rlsTheme,
2001
2001
  subtitle,
2002
2002
  title,
2003
2003
  approved: {
2004
- label: approved || reactI18n('confirmationActionApproved'),
2004
+ label: approved?.label ?? reactI18n('confirmationActionApproved'),
2005
2005
  onClick: () => {
2006
2006
  setVisible(false);
2007
2007
  resolve(ConfirmationResult.approved());
2008
- }
2008
+ },
2009
+ identifier: approved?.identifier
2009
2010
  },
2010
2011
  reject: reject
2011
2012
  ? {
2012
- label: reject,
2013
+ label: reject.label,
2013
2014
  onClick: () => {
2014
2015
  setVisible(false);
2015
2016
  resolve(ConfirmationResult.reject());
2016
- }
2017
+ },
2018
+ identifier: reject.identifier
2017
2019
  }
2018
2020
  : undefined
2019
2021
  });
@@ -2026,28 +2028,28 @@ function useConfirmationService() {
2026
2028
  };
2027
2029
  }
2028
2030
 
2029
- function RlsDatatableHeader({ children }) {
2030
- return jsxRuntimeExports.jsx("tr", { className: "rls-datatable__header", children: children });
2031
+ function RlsDatatableHeader({ children, identifier }) {
2032
+ return (jsxRuntimeExports.jsx("tr", { id: identifier, className: "rls-datatable__header", children: children }));
2031
2033
  }
2032
- function RlsDatatableTitle({ children, className, control }) {
2033
- return (jsxRuntimeExports.jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
2034
+ function RlsDatatableTitle({ children, className, control, identifier }) {
2035
+ return (jsxRuntimeExports.jsx("th", { id: identifier, className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
2034
2036
  }
2035
- function RlsDatatableRecord({ children, className, error, warning }) {
2036
- return (jsxRuntimeExports.jsx("tr", { className: renderClassStatus('rls-datatable__record', { error, warning }, className).trim(), children: children }));
2037
+ function RlsDatatableRecord({ children, className, error, identifier, warning }) {
2038
+ return (jsxRuntimeExports.jsx("tr", { id: identifier, className: renderClassStatus('rls-datatable__record', { error, warning }, className).trim(), children: children }));
2037
2039
  }
2038
- function RlsDatatableTotals({ children, className, error, warning }) {
2039
- return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-datatable__totals', { error, warning }, className).trim(), children: children }));
2040
+ function RlsDatatableTotals({ children, className, error, identifier, warning }) {
2041
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: renderClassStatus('rls-datatable__totals', { error, warning }, className).trim(), children: children }));
2040
2042
  }
2041
- function RlsDatatableCell({ children, className, control, overflow }) {
2042
- return (jsxRuntimeExports.jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
2043
+ function RlsDatatableCell({ children, className, control, identifier, overflow }) {
2044
+ return (jsxRuntimeExports.jsx("th", { id: identifier, className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
2043
2045
  }
2044
- function RlsDatatableData({ children, className, control, overflow }) {
2045
- return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-datatable__data', { control, overflow }, className).trim(), children: children }));
2046
+ function RlsDatatableData({ children, className, control, identifier, overflow }) {
2047
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: renderClassStatus('rls-datatable__data', { control, overflow }, className).trim(), children: children }));
2046
2048
  }
2047
- function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
2049
+ function RlsDatatable({ children, datatable, footer, header, identifier, rlsTheme, summary }) {
2048
2050
  return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-datatable', {
2049
2051
  scrolleable: datatable?.scrolleable
2050
- }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("table", { children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.tableRef, className: "rls-datatable__tbody", children: children })] }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
2052
+ }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("table", { id: identifier, children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.tableRef, className: "rls-datatable__tbody", children: children })] }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
2051
2053
  }
2052
2054
 
2053
2055
  function createObserver(options) {