@rolster/react-components 18.12.8 → 18.12.9

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
@@ -1118,10 +1118,17 @@ function useDatatable() {
1118
1118
  const [scrolleable, setScrolleable] = react.useState(false);
1119
1119
  const bodyRef = react.useRef(null);
1120
1120
  react.useEffect(() => {
1121
- const scrollHeight = bodyRef?.current?.scrollHeight || 0;
1122
- const clientHeight = bodyRef?.current?.clientHeight || 0;
1123
- setScrolleable(scrollHeight > clientHeight);
1124
- }, [bodyRef]);
1121
+ let observer;
1122
+ if (bodyRef?.current) {
1123
+ observer = new ResizeObserver(() => {
1124
+ const scrollHeight = bodyRef?.current?.scrollHeight || 0;
1125
+ const clientHeight = bodyRef?.current?.clientHeight || 0;
1126
+ setScrolleable(scrollHeight > clientHeight);
1127
+ });
1128
+ observer.observe(bodyRef?.current);
1129
+ }
1130
+ return () => observer?.disconnect();
1131
+ }, []);
1125
1132
  return { bodyRef, scrolleable };
1126
1133
  }
1127
1134
 
@@ -1547,10 +1554,16 @@ function RlsDatatableData({ children, className, error }) {
1547
1554
  function RlsDatatableCell({ children, className, control, overflow }) {
1548
1555
  return (jsxRuntime.jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
1549
1556
  }
1550
- function RlsDatatable({ children, datatable, footer, header, rlsTheme }) {
1557
+ function RlsDatatableTotals({ children, className, error }) {
1558
+ return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
1559
+ }
1560
+ function RlsDatatableInfo({ children, className, control, overflow }) {
1561
+ return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
1562
+ }
1563
+ function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
1551
1564
  return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-datatable', {
1552
1565
  scrolleable: datatable?.scrolleable
1553
- }), "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("table", { children: [header && jsxRuntime.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntime.jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), footer && jsxRuntime.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1566
+ }), "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("table", { children: [header && jsxRuntime.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntime.jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), summary && jsxRuntime.jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsxRuntime.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1554
1567
  }
1555
1568
 
1556
1569
  const controlIsValid = (props) => {
@@ -2121,7 +2134,9 @@ exports.RlsDatatable = RlsDatatable;
2121
2134
  exports.RlsDatatableCell = RlsDatatableCell;
2122
2135
  exports.RlsDatatableData = RlsDatatableData;
2123
2136
  exports.RlsDatatableHeader = RlsDatatableHeader;
2137
+ exports.RlsDatatableInfo = RlsDatatableInfo;
2124
2138
  exports.RlsDatatableTitle = RlsDatatableTitle;
2139
+ exports.RlsDatatableTotals = RlsDatatableTotals;
2125
2140
  exports.RlsDateField = RlsDateField;
2126
2141
  exports.RlsDatePicker = RlsDatePicker;
2127
2142
  exports.RlsDateRangeField = RlsDateRangeField;