@nulogy/components 8.17.1 → 9.0.0

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/main.js CHANGED
@@ -12879,7 +12879,7 @@
12879
12879
  };
12880
12880
  }
12881
12881
 
12882
- var index$1 = typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect;
12882
+ var index = typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect;
12883
12883
 
12884
12884
  var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
12885
12885
  // ==============================
@@ -13392,7 +13392,7 @@
13392
13392
  placement = _useState4[0],
13393
13393
  setPlacement = _useState4[1];
13394
13394
  var controlHeight = theme.spacing.controlHeight;
13395
- index$1(function () {
13395
+ index(function () {
13396
13396
  var menuEl = ref.current;
13397
13397
  if (!menuEl) return;
13398
13398
 
@@ -13557,7 +13557,7 @@
13557
13557
  });
13558
13558
  }
13559
13559
  }, [controlElement, menuPosition, placement, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width]);
13560
- index$1(function () {
13560
+ index(function () {
13561
13561
  updateComputedPosition();
13562
13562
  }, [updateComputedPosition]);
13563
13563
  var runAutoUpdate = React.useCallback(function () {
@@ -13571,7 +13571,7 @@
13571
13571
  });
13572
13572
  }
13573
13573
  }, [controlElement, updateComputedPosition]);
13574
- index$1(function () {
13574
+ index(function () {
13575
13575
  runAutoUpdate();
13576
13576
  }, [runAutoUpdate]);
13577
13577
  var setMenuPortalElement = React.useCallback(function (menuPortalElement) {
@@ -48574,7 +48574,7 @@
48574
48574
  }
48575
48575
 
48576
48576
  if (disabled) {
48577
- return "inital";
48577
+ return "initial";
48578
48578
  }
48579
48579
 
48580
48580
  return theme.colors.lightGrey;
@@ -48617,13 +48617,11 @@
48617
48617
  };
48618
48618
  });
48619
48619
 
48620
- // @ts-nocheck
48621
-
48622
48620
  var PreviousButton = function PreviousButton(_ref) {
48623
48621
  var disabled = _ref.disabled,
48624
48622
  onClick = _ref.onClick,
48625
48623
  label = _ref.label,
48626
- ariaLabel = _ref["aria-label"];
48624
+ ariaLabel = _ref.ariaLabel;
48627
48625
 
48628
48626
  var _useTranslation = useTranslation(),
48629
48627
  t = _useTranslation.t;
@@ -48642,22 +48640,18 @@
48642
48640
  disabled: PropTypes__default["default"].bool,
48643
48641
  onClick: PropTypes__default["default"].func,
48644
48642
  label: PropTypes__default["default"].node,
48645
- "aria-label": PropTypes__default["default"].string
48643
+ ariaLabel: PropTypes__default["default"].string
48646
48644
  };
48647
48645
  PreviousButton.defaultProps = {
48648
48646
  disabled: false,
48649
- onClick: null,
48650
- label: undefined,
48651
- "aria-label": undefined
48647
+ onClick: null
48652
48648
  };
48653
48649
 
48654
- // @ts-nocheck
48655
-
48656
48650
  var NextButton = function NextButton(_ref) {
48657
48651
  var disabled = _ref.disabled,
48658
48652
  onClick = _ref.onClick,
48659
48653
  label = _ref.label,
48660
- ariaLabel = _ref["aria-label"];
48654
+ ariaLabel = _ref.ariaLabel;
48661
48655
 
48662
48656
  var _useTranslation = useTranslation(),
48663
48657
  t = _useTranslation.t;
@@ -48676,91 +48670,112 @@
48676
48670
  disabled: PropTypes__default["default"].bool,
48677
48671
  onClick: PropTypes__default["default"].func,
48678
48672
  label: PropTypes__default["default"].node,
48679
- "aria-label": PropTypes__default["default"].string
48673
+ ariaLabel: PropTypes__default["default"].string
48680
48674
  };
48681
48675
  NextButton.defaultProps = {
48682
48676
  disabled: false,
48683
- onClick: null,
48684
- label: undefined,
48685
- "aria-label": undefined
48677
+ onClick: null
48686
48678
  };
48687
48679
 
48688
- var SEPERATOR = "...";
48689
- var getPageItemstoDisplay = function getPageItemstoDisplay(totalPages, currentPage) {
48680
+ var SEPARATOR = "...";
48681
+ var getPageItemsToDisplay = function getPageItemsToDisplay(totalPages, currentPage) {
48682
+ var MAX_PAGES_TO_SHOW = 6;
48690
48683
  var pages = Array.from({
48691
48684
  length: totalPages
48692
- }, function (v, k) {
48693
- return k + 1;
48685
+ }, function (v, i) {
48686
+ return i + 1;
48694
48687
  });
48695
- var MAX_PAGES_TO_SHOW = 6;
48696
48688
  if (totalPages <= MAX_PAGES_TO_SHOW) return pages;
48697
48689
 
48698
48690
  if (currentPage <= MAX_PAGES_TO_SHOW - 1) {
48699
- return [].concat(pages.slice(0, 5), [SEPERATOR, totalPages]);
48691
+ return [].concat(pages.slice(0, 5), [SEPARATOR, totalPages]);
48700
48692
  }
48701
48693
 
48702
48694
  if (currentPage > totalPages - 5) {
48703
- return [1, SEPERATOR].concat(pages.slice(totalPages - 5));
48695
+ return [1, SEPARATOR].concat(pages.slice(totalPages - 5));
48704
48696
  }
48705
48697
 
48706
- return [1, SEPERATOR].concat(pages.slice(currentPage - 2, currentPage + 2), [SEPERATOR, totalPages]);
48698
+ return [1, SEPARATOR].concat(pages.slice(currentPage - 2, currentPage + 2), [SEPARATOR, totalPages]);
48707
48699
  };
48708
48700
 
48709
- var Pagination = function Pagination(props) {
48710
- var currentPage = props.currentPage,
48711
- totalPages = props.totalPages,
48712
- onNext = props.onNext,
48713
- onPrevious = props.onPrevious,
48714
- onSelectPage = props.onSelectPage,
48715
- nextAriaLabel = props.nextAriaLabel,
48716
- nextLabel = props.nextLabel,
48717
- previousAriaLabel = props.previousAriaLabel,
48718
- previousLabel = props.previousLabel,
48719
- ariaLabel = props["aria-label"],
48720
- restProps = __rest(props, ["currentPage", "totalPages", "onNext", "onPrevious", "onSelectPage", "nextAriaLabel", "nextLabel", "previousAriaLabel", "previousLabel", "aria-label"]);
48701
+ function Pagination(_a) {
48702
+ var currentPage = _a.currentPage,
48703
+ totalPages = _a.totalPages,
48704
+ onNext = _a.onNext,
48705
+ onPrevious = _a.onPrevious,
48706
+ onSelectPage = _a.onSelectPage,
48707
+ nextAriaLabel = _a.nextAriaLabel,
48708
+ nextLabel = _a.nextLabel,
48709
+ previousAriaLabel = _a.previousAriaLabel,
48710
+ previousLabel = _a.previousLabel,
48711
+ scrollToTopAfterPagination = _a.scrollToTopAfterPagination,
48712
+ scrollTargetRef = _a.scrollTargetRef,
48713
+ ariaLabel = _a["aria-label"],
48714
+ restProps = __rest(_a, ["currentPage", "totalPages", "onNext", "onPrevious", "onSelectPage", "nextAriaLabel", "nextLabel", "previousAriaLabel", "previousLabel", "scrollToTopAfterPagination", "scrollTargetRef", "aria-label"]);
48721
48715
 
48722
48716
  var _useTranslation = useTranslation(),
48723
48717
  t = _useTranslation.t;
48724
48718
 
48719
+ var scrollToTop = function scrollToTop() {
48720
+ var _a, _b;
48721
+
48722
+ if (scrollToTopAfterPagination) {
48723
+ var top = (scrollTargetRef === null || scrollTargetRef === void 0 ? void 0 : scrollTargetRef.current) ? window.scrollY + ((_b = (_a = scrollTargetRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.top) : 0;
48724
+ window.scrollTo({
48725
+ top: top,
48726
+ behavior: "smooth"
48727
+ });
48728
+ }
48729
+ };
48730
+
48725
48731
  return /*#__PURE__*/React__default["default"].createElement(Flex, Object.assign({
48726
48732
  as: "nav",
48727
48733
  "aria-label": ariaLabel || t("pagination navigation")
48728
48734
  }, restProps), /*#__PURE__*/React__default["default"].createElement(PreviousButton, {
48729
48735
  disabled: currentPage === 1,
48730
- onClick: onPrevious,
48736
+ onClick: function onClick() {
48737
+ ne.flushSync(function () {
48738
+ onPrevious();
48739
+ });
48740
+ scrollToTop();
48741
+ },
48731
48742
  ariaLabel: previousAriaLabel,
48732
48743
  label: previousLabel
48733
- }), getPageItemstoDisplay(totalPages, currentPage).map(function (page, index) {
48744
+ }), getPageItemsToDisplay(totalPages, currentPage).map(function (page, index) {
48734
48745
  var isCurrentPage = currentPage === page;
48735
- if (page === SEPERATOR) return (
48736
- /*#__PURE__*/
48737
- // eslint-disable-next-line react/no-array-index-key
48738
- React__default["default"].createElement(Text, {
48739
- key: "sep" + index,
48740
- py: "x1",
48741
- mr: "x2",
48742
- fontSize: "small",
48743
- lineHeight: "smallTextBase"
48744
- }, SEPERATOR)
48745
- );else return /*#__PURE__*/React__default["default"].createElement(PageNumber, {
48746
+ if (page === SEPARATOR) return /*#__PURE__*/React__default["default"].createElement(Text, {
48747
+ key: "sep" + index,
48748
+ py: "x1",
48749
+ mr: "x2",
48750
+ fontSize: "small",
48751
+ lineHeight: "smallTextBase"
48752
+ }, SEPARATOR);else return /*#__PURE__*/React__default["default"].createElement(PageNumber, {
48746
48753
  "aria-current": isCurrentPage,
48747
48754
  currentPage: isCurrentPage,
48748
48755
  disabled: isCurrentPage,
48749
48756
  "aria-label": isCurrentPage ? null : t("go to page", {
48750
- count: page
48757
+ count: Number(page)
48751
48758
  }),
48752
48759
  key: page,
48753
48760
  onClick: function onClick() {
48754
- return onSelectPage(page);
48761
+ ne.flushSync(function () {
48762
+ onSelectPage(page);
48763
+ });
48764
+ scrollToTop();
48755
48765
  }
48756
48766
  }, page);
48757
48767
  }), /*#__PURE__*/React__default["default"].createElement(NextButton, {
48758
48768
  disabled: currentPage === totalPages,
48759
- onClick: onNext,
48769
+ onClick: function onClick() {
48770
+ ne.flushSync(function () {
48771
+ onNext();
48772
+ });
48773
+ scrollToTop();
48774
+ },
48760
48775
  ariaLabel: nextAriaLabel,
48761
48776
  label: nextLabel
48762
48777
  }));
48763
- };
48778
+ }
48764
48779
 
48765
48780
  Pagination.propTypes = {
48766
48781
  currentPage: PropTypes__default["default"].number.isRequired,
@@ -49280,21 +49295,28 @@
49280
49295
  return label;
49281
49296
  };
49282
49297
 
49283
- var renderHeaderCellContent = function renderHeaderCellContent(_a) {
49284
- var _a$headerFormatter = _a.headerFormatter,
49285
- headerFormatter = _a$headerFormatter === void 0 ? defaultheaderFormatter : _a$headerFormatter,
49286
- column = __rest(_a, ["headerFormatter"]);
49287
-
49288
- return headerFormatter(column);
49298
+ var renderHeaderCellContent = function renderHeaderCellContent(_ref3) {
49299
+ var _ref3$headerFormatter = _ref3.headerFormatter,
49300
+ headerFormatter = _ref3$headerFormatter === void 0 ? defaultheaderFormatter : _ref3$headerFormatter,
49301
+ align = _ref3.align,
49302
+ label = _ref3.label,
49303
+ dataKey = _ref3.dataKey,
49304
+ width = _ref3.width;
49305
+ return headerFormatter({
49306
+ align: align,
49307
+ label: label,
49308
+ dataKey: dataKey,
49309
+ width: width
49310
+ });
49289
49311
  };
49290
49312
 
49291
- var TableHead = function TableHead(_ref3) {
49292
- var columns = _ref3.columns,
49293
- compact = _ref3.compact,
49294
- sticky = _ref3.sticky;
49313
+ var TableHead = function TableHead(_ref4) {
49314
+ var columns = _ref4.columns,
49315
+ compact = _ref4.compact,
49316
+ sticky = _ref4.sticky;
49295
49317
 
49296
49318
  var renderColumns = function renderColumns(allColumns) {
49297
- return allColumns.map(function (column) {
49319
+ return allColumns.map(function (column, index) {
49298
49320
  var _a, _b;
49299
49321
 
49300
49322
  return /*#__PURE__*/React__default["default"].createElement(StyledTh, {
@@ -49311,10 +49333,6 @@
49311
49333
  return /*#__PURE__*/React__default["default"].createElement("thead", null, /*#__PURE__*/React__default["default"].createElement(StyledHeaderRow, null, renderColumns(columns)));
49312
49334
  };
49313
49335
 
49314
- TableHead.defaultProps = {
49315
- sticky: false
49316
- };
49317
-
49318
49336
  var columnPropType = PropTypes__default["default"].shape({
49319
49337
  align: PropTypes__default["default"].oneOf(["right", "left", "center"]),
49320
49338
  label: PropTypes__default["default"].string,
@@ -11,7 +11,7 @@ import _typeof$1 from '@babel/runtime/helpers/typeof';
11
11
  import { stringify, COMMENT, rulesheet, middleware, RULESET, combine, match as match$k, serialize, copy as copy$1, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, compile, dealloc, alloc, hash as hash$2, charat, strlen, indexof, next, token, from, peek, delimit, slice, position as position$1 } from 'stylis';
12
12
  import _extends$4 from '@babel/runtime/helpers/extends';
13
13
  import 'hoist-non-react-statics';
14
- import ne, { createPortal, findDOMNode } from 'react-dom';
14
+ import ne, { createPortal, findDOMNode, flushSync } from 'react-dom';
15
15
  import '@babel/runtime/helpers/objectSpread2';
16
16
  import '@babel/runtime/helpers/inherits';
17
17
  import '@babel/runtime/helpers/createSuper';
@@ -12862,7 +12862,7 @@ function autoUpdate(reference, floating, update, options) {
12862
12862
  };
12863
12863
  }
12864
12864
 
12865
- var index$1 = typeof document !== 'undefined' ? useLayoutEffect : useEffect;
12865
+ var index = typeof document !== 'undefined' ? useLayoutEffect : useEffect;
12866
12866
 
12867
12867
  var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
12868
12868
  // ==============================
@@ -13375,7 +13375,7 @@ var MenuPlacer = function MenuPlacer(props) {
13375
13375
  placement = _useState4[0],
13376
13376
  setPlacement = _useState4[1];
13377
13377
  var controlHeight = theme.spacing.controlHeight;
13378
- index$1(function () {
13378
+ index(function () {
13379
13379
  var menuEl = ref.current;
13380
13380
  if (!menuEl) return;
13381
13381
 
@@ -13540,7 +13540,7 @@ var MenuPortal = function MenuPortal(props) {
13540
13540
  });
13541
13541
  }
13542
13542
  }, [controlElement, menuPosition, placement, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width]);
13543
- index$1(function () {
13543
+ index(function () {
13544
13544
  updateComputedPosition();
13545
13545
  }, [updateComputedPosition]);
13546
13546
  var runAutoUpdate = useCallback(function () {
@@ -13554,7 +13554,7 @@ var MenuPortal = function MenuPortal(props) {
13554
13554
  });
13555
13555
  }
13556
13556
  }, [controlElement, updateComputedPosition]);
13557
- index$1(function () {
13557
+ index(function () {
13558
13558
  runAutoUpdate();
13559
13559
  }, [runAutoUpdate]);
13560
13560
  var setMenuPortalElement = useCallback(function (menuPortalElement) {
@@ -48557,7 +48557,7 @@ var getHoverBackground = function getHoverBackground(currentPage, disabled, them
48557
48557
  }
48558
48558
 
48559
48559
  if (disabled) {
48560
- return "inital";
48560
+ return "initial";
48561
48561
  }
48562
48562
 
48563
48563
  return theme.colors.lightGrey;
@@ -48600,13 +48600,11 @@ var PageNumber = styled(PaginationButton).withConfig({
48600
48600
  };
48601
48601
  });
48602
48602
 
48603
- // @ts-nocheck
48604
-
48605
48603
  var PreviousButton = function PreviousButton(_ref) {
48606
48604
  var disabled = _ref.disabled,
48607
48605
  onClick = _ref.onClick,
48608
48606
  label = _ref.label,
48609
- ariaLabel = _ref["aria-label"];
48607
+ ariaLabel = _ref.ariaLabel;
48610
48608
 
48611
48609
  var _useTranslation = useTranslation(),
48612
48610
  t = _useTranslation.t;
@@ -48625,22 +48623,18 @@ PreviousButton.propTypes = {
48625
48623
  disabled: PropTypes.bool,
48626
48624
  onClick: PropTypes.func,
48627
48625
  label: PropTypes.node,
48628
- "aria-label": PropTypes.string
48626
+ ariaLabel: PropTypes.string
48629
48627
  };
48630
48628
  PreviousButton.defaultProps = {
48631
48629
  disabled: false,
48632
- onClick: null,
48633
- label: undefined,
48634
- "aria-label": undefined
48630
+ onClick: null
48635
48631
  };
48636
48632
 
48637
- // @ts-nocheck
48638
-
48639
48633
  var NextButton = function NextButton(_ref) {
48640
48634
  var disabled = _ref.disabled,
48641
48635
  onClick = _ref.onClick,
48642
48636
  label = _ref.label,
48643
- ariaLabel = _ref["aria-label"];
48637
+ ariaLabel = _ref.ariaLabel;
48644
48638
 
48645
48639
  var _useTranslation = useTranslation(),
48646
48640
  t = _useTranslation.t;
@@ -48659,91 +48653,112 @@ NextButton.propTypes = {
48659
48653
  disabled: PropTypes.bool,
48660
48654
  onClick: PropTypes.func,
48661
48655
  label: PropTypes.node,
48662
- "aria-label": PropTypes.string
48656
+ ariaLabel: PropTypes.string
48663
48657
  };
48664
48658
  NextButton.defaultProps = {
48665
48659
  disabled: false,
48666
- onClick: null,
48667
- label: undefined,
48668
- "aria-label": undefined
48660
+ onClick: null
48669
48661
  };
48670
48662
 
48671
- var SEPERATOR = "...";
48672
- var getPageItemstoDisplay = function getPageItemstoDisplay(totalPages, currentPage) {
48663
+ var SEPARATOR = "...";
48664
+ var getPageItemsToDisplay = function getPageItemsToDisplay(totalPages, currentPage) {
48665
+ var MAX_PAGES_TO_SHOW = 6;
48673
48666
  var pages = Array.from({
48674
48667
  length: totalPages
48675
- }, function (v, k) {
48676
- return k + 1;
48668
+ }, function (v, i) {
48669
+ return i + 1;
48677
48670
  });
48678
- var MAX_PAGES_TO_SHOW = 6;
48679
48671
  if (totalPages <= MAX_PAGES_TO_SHOW) return pages;
48680
48672
 
48681
48673
  if (currentPage <= MAX_PAGES_TO_SHOW - 1) {
48682
- return [].concat(pages.slice(0, 5), [SEPERATOR, totalPages]);
48674
+ return [].concat(pages.slice(0, 5), [SEPARATOR, totalPages]);
48683
48675
  }
48684
48676
 
48685
48677
  if (currentPage > totalPages - 5) {
48686
- return [1, SEPERATOR].concat(pages.slice(totalPages - 5));
48678
+ return [1, SEPARATOR].concat(pages.slice(totalPages - 5));
48687
48679
  }
48688
48680
 
48689
- return [1, SEPERATOR].concat(pages.slice(currentPage - 2, currentPage + 2), [SEPERATOR, totalPages]);
48681
+ return [1, SEPARATOR].concat(pages.slice(currentPage - 2, currentPage + 2), [SEPARATOR, totalPages]);
48690
48682
  };
48691
48683
 
48692
- var Pagination = function Pagination(props) {
48693
- var currentPage = props.currentPage,
48694
- totalPages = props.totalPages,
48695
- onNext = props.onNext,
48696
- onPrevious = props.onPrevious,
48697
- onSelectPage = props.onSelectPage,
48698
- nextAriaLabel = props.nextAriaLabel,
48699
- nextLabel = props.nextLabel,
48700
- previousAriaLabel = props.previousAriaLabel,
48701
- previousLabel = props.previousLabel,
48702
- ariaLabel = props["aria-label"],
48703
- restProps = __rest(props, ["currentPage", "totalPages", "onNext", "onPrevious", "onSelectPage", "nextAriaLabel", "nextLabel", "previousAriaLabel", "previousLabel", "aria-label"]);
48684
+ function Pagination(_a) {
48685
+ var currentPage = _a.currentPage,
48686
+ totalPages = _a.totalPages,
48687
+ onNext = _a.onNext,
48688
+ onPrevious = _a.onPrevious,
48689
+ onSelectPage = _a.onSelectPage,
48690
+ nextAriaLabel = _a.nextAriaLabel,
48691
+ nextLabel = _a.nextLabel,
48692
+ previousAriaLabel = _a.previousAriaLabel,
48693
+ previousLabel = _a.previousLabel,
48694
+ scrollToTopAfterPagination = _a.scrollToTopAfterPagination,
48695
+ scrollTargetRef = _a.scrollTargetRef,
48696
+ ariaLabel = _a["aria-label"],
48697
+ restProps = __rest(_a, ["currentPage", "totalPages", "onNext", "onPrevious", "onSelectPage", "nextAriaLabel", "nextLabel", "previousAriaLabel", "previousLabel", "scrollToTopAfterPagination", "scrollTargetRef", "aria-label"]);
48704
48698
 
48705
48699
  var _useTranslation = useTranslation(),
48706
48700
  t = _useTranslation.t;
48707
48701
 
48702
+ var scrollToTop = function scrollToTop() {
48703
+ var _a, _b;
48704
+
48705
+ if (scrollToTopAfterPagination) {
48706
+ var top = (scrollTargetRef === null || scrollTargetRef === void 0 ? void 0 : scrollTargetRef.current) ? window.scrollY + ((_b = (_a = scrollTargetRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.top) : 0;
48707
+ window.scrollTo({
48708
+ top: top,
48709
+ behavior: "smooth"
48710
+ });
48711
+ }
48712
+ };
48713
+
48708
48714
  return /*#__PURE__*/React__default.createElement(Flex, Object.assign({
48709
48715
  as: "nav",
48710
48716
  "aria-label": ariaLabel || t("pagination navigation")
48711
48717
  }, restProps), /*#__PURE__*/React__default.createElement(PreviousButton, {
48712
48718
  disabled: currentPage === 1,
48713
- onClick: onPrevious,
48719
+ onClick: function onClick() {
48720
+ flushSync(function () {
48721
+ onPrevious();
48722
+ });
48723
+ scrollToTop();
48724
+ },
48714
48725
  ariaLabel: previousAriaLabel,
48715
48726
  label: previousLabel
48716
- }), getPageItemstoDisplay(totalPages, currentPage).map(function (page, index) {
48727
+ }), getPageItemsToDisplay(totalPages, currentPage).map(function (page, index) {
48717
48728
  var isCurrentPage = currentPage === page;
48718
- if (page === SEPERATOR) return (
48719
- /*#__PURE__*/
48720
- // eslint-disable-next-line react/no-array-index-key
48721
- React__default.createElement(Text, {
48722
- key: "sep" + index,
48723
- py: "x1",
48724
- mr: "x2",
48725
- fontSize: "small",
48726
- lineHeight: "smallTextBase"
48727
- }, SEPERATOR)
48728
- );else return /*#__PURE__*/React__default.createElement(PageNumber, {
48729
+ if (page === SEPARATOR) return /*#__PURE__*/React__default.createElement(Text, {
48730
+ key: "sep" + index,
48731
+ py: "x1",
48732
+ mr: "x2",
48733
+ fontSize: "small",
48734
+ lineHeight: "smallTextBase"
48735
+ }, SEPARATOR);else return /*#__PURE__*/React__default.createElement(PageNumber, {
48729
48736
  "aria-current": isCurrentPage,
48730
48737
  currentPage: isCurrentPage,
48731
48738
  disabled: isCurrentPage,
48732
48739
  "aria-label": isCurrentPage ? null : t("go to page", {
48733
- count: page
48740
+ count: Number(page)
48734
48741
  }),
48735
48742
  key: page,
48736
48743
  onClick: function onClick() {
48737
- return onSelectPage(page);
48744
+ flushSync(function () {
48745
+ onSelectPage(page);
48746
+ });
48747
+ scrollToTop();
48738
48748
  }
48739
48749
  }, page);
48740
48750
  }), /*#__PURE__*/React__default.createElement(NextButton, {
48741
48751
  disabled: currentPage === totalPages,
48742
- onClick: onNext,
48752
+ onClick: function onClick() {
48753
+ flushSync(function () {
48754
+ onNext();
48755
+ });
48756
+ scrollToTop();
48757
+ },
48743
48758
  ariaLabel: nextAriaLabel,
48744
48759
  label: nextLabel
48745
48760
  }));
48746
- };
48761
+ }
48747
48762
 
48748
48763
  Pagination.propTypes = {
48749
48764
  currentPage: PropTypes.number.isRequired,
@@ -49263,21 +49278,28 @@ var defaultheaderFormatter = function defaultheaderFormatter(_ref2) {
49263
49278
  return label;
49264
49279
  };
49265
49280
 
49266
- var renderHeaderCellContent = function renderHeaderCellContent(_a) {
49267
- var _a$headerFormatter = _a.headerFormatter,
49268
- headerFormatter = _a$headerFormatter === void 0 ? defaultheaderFormatter : _a$headerFormatter,
49269
- column = __rest(_a, ["headerFormatter"]);
49270
-
49271
- return headerFormatter(column);
49281
+ var renderHeaderCellContent = function renderHeaderCellContent(_ref3) {
49282
+ var _ref3$headerFormatter = _ref3.headerFormatter,
49283
+ headerFormatter = _ref3$headerFormatter === void 0 ? defaultheaderFormatter : _ref3$headerFormatter,
49284
+ align = _ref3.align,
49285
+ label = _ref3.label,
49286
+ dataKey = _ref3.dataKey,
49287
+ width = _ref3.width;
49288
+ return headerFormatter({
49289
+ align: align,
49290
+ label: label,
49291
+ dataKey: dataKey,
49292
+ width: width
49293
+ });
49272
49294
  };
49273
49295
 
49274
- var TableHead = function TableHead(_ref3) {
49275
- var columns = _ref3.columns,
49276
- compact = _ref3.compact,
49277
- sticky = _ref3.sticky;
49296
+ var TableHead = function TableHead(_ref4) {
49297
+ var columns = _ref4.columns,
49298
+ compact = _ref4.compact,
49299
+ sticky = _ref4.sticky;
49278
49300
 
49279
49301
  var renderColumns = function renderColumns(allColumns) {
49280
- return allColumns.map(function (column) {
49302
+ return allColumns.map(function (column, index) {
49281
49303
  var _a, _b;
49282
49304
 
49283
49305
  return /*#__PURE__*/React__default.createElement(StyledTh, {
@@ -49294,10 +49316,6 @@ var TableHead = function TableHead(_ref3) {
49294
49316
  return /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement(StyledHeaderRow, null, renderColumns(columns)));
49295
49317
  };
49296
49318
 
49297
- TableHead.defaultProps = {
49298
- sticky: false
49299
- };
49300
-
49301
49319
  var columnPropType = PropTypes.shape({
49302
49320
  align: PropTypes.oneOf(["right", "left", "center"]),
49303
49321
  label: PropTypes.string,
@@ -1,23 +1,22 @@
1
- import React from "react";
1
+ import React, { ReactNode } from "react";
2
2
  import PropTypes from "prop-types";
3
+ type NextButtonProps = {
4
+ disabled: boolean;
5
+ onClick: React.MouseEventHandler<HTMLButtonElement>;
6
+ label: ReactNode;
7
+ ariaLabel: string;
8
+ };
3
9
  declare const NextButton: {
4
- ({ disabled, onClick, label, "aria-label": ariaLabel }: {
5
- disabled: any;
6
- onClick: any;
7
- label: any;
8
- "aria-label": any;
9
- }): React.JSX.Element;
10
+ ({ disabled, onClick, label, ariaLabel }: NextButtonProps): React.JSX.Element;
10
11
  propTypes: {
11
12
  disabled: PropTypes.Requireable<boolean>;
12
13
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
13
14
  label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
14
- "aria-label": PropTypes.Requireable<string>;
15
+ ariaLabel: PropTypes.Requireable<string>;
15
16
  };
16
17
  defaultProps: {
17
18
  disabled: boolean;
18
19
  onClick: any;
19
- label: any;
20
- "aria-label": any;
21
20
  };
22
21
  };
23
22
  export default NextButton;
@@ -1,2 +1,5 @@
1
- declare const PageNumber: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
1
+ type PageNumberProps = {
2
+ currentPage: boolean;
3
+ };
4
+ declare const PageNumber: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, PageNumberProps, never>;
2
5
  export default PageNumber;
@@ -1,4 +1,43 @@
1
- import React from "react";
2
- export declare const getPageItemstoDisplay: (totalPages: any, currentPage: any) => any[];
3
- declare const Pagination: React.FC<any>;
1
+ import React, { ReactNode, RefObject } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { FlexProps } from "../Flex/Flex";
4
+ export declare const getPageItemsToDisplay: (totalPages: number, currentPage: number) => (string | number)[];
5
+ type PaginationProps = FlexProps & {
6
+ currentPage: number;
7
+ totalPages: number;
8
+ onNext?: () => void;
9
+ onPrevious?: () => void;
10
+ onSelectPage?: (page: string | number) => void;
11
+ nextLabel?: ReactNode;
12
+ nextAriaLabel?: string;
13
+ previousLabel?: ReactNode;
14
+ previousAriaLabel?: string;
15
+ scrollToTopAfterPagination?: boolean;
16
+ scrollTargetRef?: RefObject<HTMLElement>;
17
+ };
18
+ declare function Pagination({ currentPage, totalPages, onNext, onPrevious, onSelectPage, nextAriaLabel, nextLabel, previousAriaLabel, previousLabel, scrollToTopAfterPagination, scrollTargetRef, "aria-label": ariaLabel, ...restProps }: PaginationProps): React.JSX.Element;
19
+ declare namespace Pagination {
20
+ var propTypes: {
21
+ currentPage: PropTypes.Validator<number>;
22
+ totalPages: PropTypes.Validator<number>;
23
+ onNext: PropTypes.Requireable<(...args: any[]) => any>;
24
+ onPrevious: PropTypes.Requireable<(...args: any[]) => any>;
25
+ onSelectPage: PropTypes.Requireable<(...args: any[]) => any>;
26
+ nextLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
27
+ nextAriaLabel: PropTypes.Requireable<string>;
28
+ previousLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
29
+ previousAriaLabel: PropTypes.Requireable<string>;
30
+ "aria-label": PropTypes.Requireable<string>;
31
+ };
32
+ var defaultProps: {
33
+ onNext: any;
34
+ onPrevious: any;
35
+ onSelectPage: any;
36
+ nextLabel: any;
37
+ nextAriaLabel: any;
38
+ previousLabel: any;
39
+ previousAriaLabel: any;
40
+ "aria-label": any;
41
+ };
42
+ }
4
43
  export default Pagination;
@@ -22,3 +22,4 @@ export declare const WithLessThan5Pages: {
22
22
  name: string;
23
23
  };
24
24
  };
25
+ export declare function ScrollAfterPagination(): React.JSX.Element;
@@ -1,18 +1,22 @@
1
- import React from "react";
1
+ import React, { ReactNode } from "react";
2
2
  import PropTypes from "prop-types";
3
+ type PreviousButtonProps = {
4
+ disabled: boolean;
5
+ onClick: React.MouseEventHandler<HTMLButtonElement>;
6
+ label: ReactNode;
7
+ ariaLabel: string;
8
+ };
3
9
  declare const PreviousButton: {
4
- ({ disabled, onClick, label, "aria-label": ariaLabel }: any): React.JSX.Element;
10
+ ({ disabled, onClick, label, ariaLabel }: PreviousButtonProps): React.JSX.Element;
5
11
  propTypes: {
6
12
  disabled: PropTypes.Requireable<boolean>;
7
13
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
8
14
  label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
9
- "aria-label": PropTypes.Requireable<string>;
15
+ ariaLabel: PropTypes.Requireable<string>;
10
16
  };
11
17
  defaultProps: {
12
18
  disabled: boolean;
13
19
  onClick: any;
14
- label: any;
15
- "aria-label": any;
16
20
  };
17
21
  };
18
22
  export default PreviousButton;
@@ -1,17 +1,17 @@
1
- import { Key } from "react";
1
+ import type { Key } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  export type RowType = unknown;
4
- export type CellInfoType = {
4
+ export interface CellInfoType {
5
5
  cellData: unknown;
6
6
  column: ColumnType;
7
7
  row: RowType;
8
- };
9
- type ColumnInfoType = {
8
+ }
9
+ interface ColumnInfoType {
10
10
  align?: ColumnAlignment;
11
11
  label: string;
12
12
  dataKey?: Key;
13
13
  width?: string | number;
14
- };
14
+ }
15
15
  type ColumnAlignment = "left" | "right" | "center";
16
16
  export type ColumnType = {
17
17
  align?: ColumnAlignment;
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { Columns } from "./Table.types";
3
- type TableHeadProps = {
2
+ import type { Columns } from "./Table.types";
3
+ interface TableHeadProps {
4
4
  columns: Columns;
5
5
  compact?: boolean;
6
6
  sticky?: boolean;
7
- };
8
- declare const TableHead: React.FC<TableHeadProps>;
7
+ }
8
+ declare const TableHead: ({ columns, compact, sticky }: TableHeadProps) => React.JSX.Element;
9
9
  export default TableHead;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "8.17.1",
3
+ "version": "9.0.0",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {