@cashub/hooks-elv 1.0.0 → 1.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/hooks-elv",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
5
  "author": "CasHUB Team",
6
6
  "description": "CasHUB hooks library (Elavon)",
package/usePagination.js CHANGED
@@ -58,6 +58,9 @@ const usePagination = _ref => {
58
58
  const middleRange = range(leftSiblingIndex, rightSiblingIndex);
59
59
  return [firstPageIndex, DOTS, ...middleRange, DOTS, lastPageIndex];
60
60
  }
61
+
62
+ // neither side needs dots (only reachable when siblingCount > 1): show every page
63
+ return range(1, totalPageCount);
61
64
  }, [totalCount, pageSize, siblingCount, currentPage]);
62
65
  return paginationRange;
63
66
  };
@@ -8,8 +8,14 @@ var _react = require("react");
8
8
  const useToggleOptions = defaultOptions => {
9
9
  const [options, setOptions] = (0, _react.useState)(defaultOptions);
10
10
  const handleToggleOptions = index => {
11
- options[index].checked = options[index].checked === 1 ? 0 : 1;
12
- setOptions([...options]);
11
+ setOptions(previous => {
12
+ return previous.map((option, optionIndex) => {
13
+ return optionIndex === index ? {
14
+ ...option,
15
+ checked: option.checked === 1 ? 0 : 1
16
+ } : option;
17
+ });
18
+ });
13
19
  };
14
20
  const resetOptions = (0, _react.useCallback)(options => {
15
21
  if (options) {