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