@commonsku/styles 1.17.22 → 1.17.23

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/index.d.ts CHANGED
@@ -15,7 +15,7 @@ import { GroupBase, StylesConfig, SelectInstance } from 'react-select';
15
15
  export { components, createFilter, mergeStyles } from 'react-select';
16
16
  import * as react_select_dist_declarations_src_Select from 'react-select/dist/declarations/src/Select';
17
17
  import { ReactDatePickerProps } from 'react-datepicker';
18
- import { HeaderGroup, UseSortByColumnProps, UseTableRowProps, UseExpandedRowProps, UseGroupByRowProps, UseRowSelectRowProps, UseRowStateRowProps, Column as Column$1, SortingRule, Cell } from 'react-table';
18
+ import { UseTableRowProps, UseExpandedRowProps, UseGroupByRowProps, UseRowSelectRowProps, UseRowStateRowProps, Column as Column$1, SortingRule, Cell, UseSortByState } from 'react-table';
19
19
  import { ListOnScrollProps } from 'react-window';
20
20
  import * as react_tooltip from 'react-tooltip';
21
21
 
@@ -2938,12 +2938,6 @@ type InputStepperStyledProps = Omit<NumberInputProps, 'onChange'> & {
2938
2938
  declare function InputStepperStyled(props: InputStepperStyledProps): React__default.JSX.Element;
2939
2939
  declare function InputStepper(props: InputStepperProps): React__default.JSX.Element;
2940
2940
 
2941
- interface BaseSortByHeaderGroup<D extends object = {}> extends HeaderGroup<D>, UseSortByColumnProps<D> {
2942
- containerProps?: object;
2943
- style?: React__default.CSSProperties;
2944
- className?: string;
2945
- }
2946
-
2947
2941
  interface Row<D extends Record<string, unknown> = Record<string, unknown>> extends UseTableRowProps<D>, UseExpandedRowProps<D>, UseGroupByRowProps<D>, UseRowSelectRowProps<D>, UseRowStateRowProps<D> {
2948
2942
  }
2949
2943
 
@@ -2984,9 +2978,6 @@ type VirtualTableProps<RowType extends Record<string, unknown>, TableProps, Tabl
2984
2978
  [key: string]: any;
2985
2979
  }>) => React__default.ReactElement;
2986
2980
  renderRowSubComponent?: <P = unknown>(props: React__default.PropsWithChildren<P>) => React__default.ReactElement;
2987
- onSort?: (value: {
2988
- column: BaseSortByHeaderGroup<RowType>;
2989
- }) => void;
2990
2981
  onResize?: VoidFunction;
2991
2982
  rowGroupStyles?: (value: {
2992
2983
  row: Row<RowType>;
@@ -2997,6 +2988,7 @@ type VirtualTableProps<RowType extends Record<string, unknown>, TableProps, Tabl
2997
2988
  style: React__default.CSSProperties;
2998
2989
  }) => React__default.CSSProperties;
2999
2990
  gutterSize?: number;
2991
+ onSortChange?: (sortState: UseSortByState<RowType>) => void;
3000
2992
  };
3001
2993
  declare const VirtualTable: <RowType extends Record<string, unknown>, TableProps, TableFooterProps>(props: VirtualTableProps<RowType, TableProps, TableFooterProps>) => React__default.JSX.Element;
3002
2994
 
package/dist/index.mjs CHANGED
@@ -7144,7 +7144,7 @@ function InputStepper(props) {
7144
7144
  var templateObject_1$c, templateObject_2$1, templateObject_3, templateObject_4;
7145
7145
 
7146
7146
  var VirtualTable = function (props) {
7147
- var columns = props.columns, data = props.data, itemSize = props.itemSize, _a = props.height, height = _a === void 0 ? 500 : _a, _b = props.minWidth, minWidth = _b === void 0 ? 140 : _b, _c = props.maxWidth, maxWidth = _c === void 0 ? 500 : _c, defaultSort = props.defaultSort, onClickRow = props.onClickRow, onScroll = props.onScroll, onUpdateData = props.onUpdateData, _d = props.useTableProps, useTableProps = _d === void 0 ? {} : _d, _e = props.tableHeaderProps, tableHeaderProps = _e === void 0 ? {} : _e, _f = props.tableFooterProps, tableFooterProps = _f === void 0 ? {} : _f, _g = props.hideFooter, hideFooter = _g === void 0 ? true : _g, _h = props.hideHeader, hideHeader = _h === void 0 ? false : _h, _j = props.className, className = _j === void 0 ? '' : _j, NoRowsFound = props.NoRowsFound, renderRowSubComponent = props.renderRowSubComponent, onSort = props.onSort; props.onResize; var rowGroupStyles = props.rowGroupStyles, rowStyles = props.rowStyles, _k = props.gutterSize, gutterSize = _k === void 0 ? 0 : _k, _l = props.customTableFooterProps, customTableFooterProps = _l === void 0 ? {} : _l, TableFooter = props.TableFooter;
7147
+ var columns = props.columns, data = props.data, itemSize = props.itemSize, _a = props.height, height = _a === void 0 ? 500 : _a, _b = props.minWidth, minWidth = _b === void 0 ? 140 : _b, _c = props.maxWidth, maxWidth = _c === void 0 ? 500 : _c, defaultSort = props.defaultSort, onClickRow = props.onClickRow, onScroll = props.onScroll, onUpdateData = props.onUpdateData, _d = props.useTableProps, useTableProps = _d === void 0 ? {} : _d, _e = props.tableHeaderProps, tableHeaderProps = _e === void 0 ? {} : _e, _f = props.tableFooterProps, tableFooterProps = _f === void 0 ? {} : _f, _g = props.hideFooter, hideFooter = _g === void 0 ? true : _g, _h = props.hideHeader, hideHeader = _h === void 0 ? false : _h, _j = props.className, className = _j === void 0 ? '' : _j, NoRowsFound = props.NoRowsFound, renderRowSubComponent = props.renderRowSubComponent; props.onResize; var rowGroupStyles = props.rowGroupStyles, rowStyles = props.rowStyles, _k = props.gutterSize, gutterSize = _k === void 0 ? 0 : _k, _l = props.customTableFooterProps, customTableFooterProps = _l === void 0 ? {} : _l, TableFooter = props.TableFooter, onSortChange = props.onSortChange;
7148
7148
  var defaultColumn = useMemo(function () { return ({
7149
7149
  minWidth: minWidth,
7150
7150
  maxWidth: maxWidth,
@@ -7159,6 +7159,7 @@ var VirtualTable = function (props) {
7159
7159
  var footerRef = useRef(null);
7160
7160
  var rowsRef = useRef(null);
7161
7161
  var listRef = useRef(null);
7162
+ var sortBy = tableData.state.sortBy;
7162
7163
  function resetList(index) {
7163
7164
  if (index === void 0) { index = 0; }
7164
7165
  listRef.current && listRef.current.resetAfterIndex(index);
@@ -7174,8 +7175,7 @@ var VirtualTable = function (props) {
7174
7175
  var _a;
7175
7176
  listRef.current && listRef.current.resetAfterIndex(0);
7176
7177
  (_a = column.toggleSortBy) === null || _a === void 0 ? void 0 : _a.call(column);
7177
- onSort && onSort({ column: column });
7178
- }, [onSort]);
7178
+ }, []);
7179
7179
  function onListScroll(e) {
7180
7180
  if (headerRef.current && e && e.target) {
7181
7181
  var target = e.target;
@@ -7253,11 +7253,27 @@ var VirtualTable = function (props) {
7253
7253
  setScrolledToBottom(Math.round(rows.scrollTop) >= rows.scrollHeight - rows.offsetHeight);
7254
7254
  }
7255
7255
  }, [onScroll]);
7256
- return (React.createElement("div", __assign({}, getTableProps(), { className: "table ".concat(className || '') }),
7257
- React.createElement("div", __assign({}, tableHeaderProps, { className: "thead ".concat(tableHeaderProps.className || ''), style: __assign(__assign({}, (tableHeaderProps.style || {})), (hideHeader ? { display: 'none' } : {})) }), headerGroups.map(function (headerGroup) { return (React.createElement("div", __assign({}, getHeaderGroupProps(headerGroup, false), { ref: headerRef, style: { width: tableWidth, } }), headerGroup.headers.map(function (column) { return (React.createElement("div", __assign({}, getHeaderProps(column, false), { className: "th", onClick: function () { return handleSort(column); } }),
7256
+ var renderTableHeader = useCallback(function () {
7257
+ var sortIconDirection = function (column) { return column.isSorted
7258
+ ? sortDirection(column)
7259
+ : "updown"; };
7260
+ return (React.createElement("div", __assign({}, tableHeaderProps, { className: "thead ".concat(tableHeaderProps.className || ""), style: __assign(__assign({}, (tableHeaderProps.style || {})), (hideHeader ? { display: "none" } : {})) }), headerGroups.map(function (headerGroup) { return (React.createElement("div", __assign({}, getHeaderGroupProps(headerGroup, false), { ref: headerRef, style: { width: tableWidth } }), headerGroup.headers.map(function (column) { return (React.createElement("div", __assign({}, getHeaderProps(column, false), { className: "th", onClick: function () { return handleSort(column); } }),
7258
7261
  column.render("Header"),
7259
- React.createElement("span", null, column.canSort &&
7260
- React.createElement(FilledChevronIcon, { direction: column.isSorted ? sortDirection(column) : 'updown', size: "medium", style: { verticalAlign: 'middle' } })))); }))); })),
7262
+ React.createElement("span", null, column.canSort && (React.createElement(FilledChevronIcon, { direction: sortIconDirection(column), size: "medium", style: { verticalAlign: "middle" } }))))); }))); })));
7263
+ }, [
7264
+ getHeaderGroupProps,
7265
+ getHeaderProps,
7266
+ handleSort,
7267
+ headerGroups,
7268
+ hideHeader,
7269
+ tableHeaderProps,
7270
+ tableWidth,
7271
+ ]);
7272
+ useEffect(function () {
7273
+ onSortChange && onSortChange({ sortBy: sortBy });
7274
+ }, [sortBy]);
7275
+ return (React.createElement("div", __assign({}, getTableProps(), { className: "table ".concat(className || '') }),
7276
+ renderTableHeader(),
7261
7277
  React.createElement("div", __assign({ className: "tbody" }, getTableBodyProps()), rows.length === 0 && NoRowsFound ? React.createElement(NoRowsFound, null) :
7262
7278
  React.createElement("div", { className: "scroll-container" },
7263
7279
  !scrolledToTop &&