@abcagency/hc-ui-components 1.3.3 → 1.3.4

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.
@@ -40,8 +40,7 @@ var useListLogic = function useListLogic() {
40
40
  localStorage.setItem('sortSetting', JSON.stringify(sortSetting));
41
41
  var listingFiltered = dynamicSort(filteredListings, sortSetting.field, sortSetting.type);
42
42
  setFilteredListings(listingFiltered);
43
- // eslint-disable-next-line react-hooks/exhaustive-deps
44
- }, [sortSetting]);
43
+ }, [sortSetting, filteredListings, setFilteredListings]);
45
44
  useEffect(function () {
46
45
  observer.current = new IntersectionObserver(handleObserver, {
47
46
  root: scrollContainerRef.current,
@@ -56,8 +55,7 @@ var useListLogic = function useListLogic() {
56
55
  observer.current.unobserve(loader.current);
57
56
  }
58
57
  };
59
- // eslint-disable-next-line react-hooks/exhaustive-deps
60
- }, [loader.current, itemLimit, filteredListings.length]);
58
+ }, [filteredListings.length, itemLimit]);
61
59
  useEffect(function () {
62
60
  localStorage.setItem('scrollPosition', scrollPosition.toString());
63
61
  }, [scrollPosition]);
@@ -66,10 +64,9 @@ var useListLogic = function useListLogic() {
66
64
  if (parseInt(savedScrollPosition) > 3000) {
67
65
  setItemLimit(savedScrollPosition / 10);
68
66
  }
69
- if (savedScrollPosition && scrollPosition != null && scrollContainerRef.current) {
70
- // eslint-disable-next-line no-unused-vars
71
- scrollContainerRef.current;
67
+ if (savedScrollPosition && scrollContainerRef.current) {
72
68
  setTimeout(function () {
69
+ scrollContainerRef.current.scrollTop = parseInt(savedScrollPosition, 10);
73
70
  }, 300);
74
71
  }
75
72
  }, []);
@@ -83,8 +80,7 @@ var useListLogic = function useListLogic() {
83
80
  scrollContainer.removeEventListener('scroll', handleScroll);
84
81
  }
85
82
  };
86
- // eslint-disable-next-line react-hooks/exhaustive-deps
87
- }, [scrollContainerRef.current]);
83
+ }, []);
88
84
  var handleObserver = function handleObserver(entities) {
89
85
  var target = entities[0];
90
86
  if (!target.isIntersecting) return;
@@ -96,9 +92,6 @@ var useListLogic = function useListLogic() {
96
92
  observer.current.disconnect();
97
93
  }
98
94
  };
99
- if (sortSetting) {
100
- dynamicSort(filteredListings, sortSetting.field, sortSetting.type);
101
- }
102
95
  var handleScroll = function handleScroll() {
103
96
  if (scrollContainerRef.current) {
104
97
  setScrollPosition(scrollContainerRef.current.scrollTop);
@@ -1 +1 @@
1
- {"version":3,"file":"useList.js","sources":["../../src/hooks/useList.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\n\nimport { getStorageObject } from '~/util/localStorageUtil';\nimport { dynamicSort } from '~/util/sortUtil';\n\nimport { useMapList } from '~/contexts/mapListContext';\n\nconst getDefaultItemId = () => {\n\tlet item = getStorageObject(\"selectedListItem\");\n\tif (item?.expanded == true) {\n\t\treturn item.id;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nconst useListLogic = () => {\n\tconst [itemLimit, setItemLimit] = useState(100);\n\tconst [expandedId] = useState(getDefaultItemId());\n\tconst [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', null));\n\tconst [scrollPosition, setScrollPosition] = useState(getStorageObject('scrollPosition', 0));\n\tconst loader = useRef(null);\n\tconst scrollContainerRef = useRef(null);\n\tconst itemRefs = useRef({});\n\tconst observer = useRef(null);\n\tconst { filteredListings, setFilteredListings } = useMapList();\n\n\tuseEffect(() => {\n\t\tif (!sortSetting) return;\n\t\tlocalStorage.setItem('sortSetting', JSON.stringify(sortSetting));\n\t\tlet listingFiltered = dynamicSort(filteredListings, sortSetting.field, sortSetting.type);\n\t\tsetFilteredListings(listingFiltered);\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [sortSetting]);\n\n\tuseEffect(() => {\n\t\tobserver.current = new IntersectionObserver(handleObserver, {\n\t\t\troot: scrollContainerRef.current,\n\t\t\trootMargin: \"100px 0px\",\n\t\t\tthreshold: 0.5\n\t\t});\n\t\tif (loader.current) {\n\t\t\tobserver.current.observe(loader.current);\n\t\t}\n\t\treturn () => {\n\t\t\tif (observer.current && loader.current) {\n\t\t\t\tobserver.current.unobserve(loader.current);\n\t\t\t}\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [loader.current, itemLimit, filteredListings.length]);\n\n\tuseEffect(() => {\n\t\tlocalStorage.setItem('scrollPosition', scrollPosition.toString());\n\t}, [scrollPosition]);\n\n\tuseEffect(() => {\n\t\tconst savedScrollPosition = scrollPosition;\n\t\tif (parseInt(savedScrollPosition) > 3000) {\n\t\t\tsetItemLimit(savedScrollPosition / 10);\n\t\t}\n\t\tif (savedScrollPosition && scrollPosition != null && scrollContainerRef.current) {\n\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\tlet scrollContainerRefCurrent = scrollContainerRef.current;\n\t\t\tsetTimeout(() => {\n\t\t\t\tscrollContainerRefCurrent = parseInt(savedScrollPosition, 10);\n\t\t\t}, 300);\n\t\t}\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst scrollContainer = scrollContainerRef.current;\n\t\tif (scrollContainer) {\n\t\t\tscrollContainer.addEventListener('scroll', handleScroll);\n\t\t}\n\t\treturn () => {\n\t\t\tif (scrollContainer) {\n\t\t\t\tscrollContainer.removeEventListener('scroll', handleScroll);\n\t\t\t}\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [scrollContainerRef.current]);\n\n\tconst handleObserver = entities => {\n\t\tconst target = entities[0];\n\t\tif (!target.isIntersecting) return;\n\t\tif (filteredListings.length > itemLimit) {\n\t\t\tsetItemLimit(prevLimit => prevLimit + 100);\n\t\t} else if (observer.current) {\n\t\t\tobserver.current.disconnect();\n\t\t}\n\n\t};\n\n\tif (sortSetting) {\n\t\tdynamicSort(filteredListings, sortSetting.field, sortSetting.type);\n\t}\n\n\tconst handleScroll = () => {\n\t\tif (scrollContainerRef.current) {\n\t\t\tsetScrollPosition(scrollContainerRef.current.scrollTop);\n\t\t}\n\t};\n\n\treturn { itemLimit, expandedId, sortSetting, scrollPosition, loader, scrollContainerRef, itemRefs, setSortSetting, setScrollPosition, dynamicSort, filteredListings };\n};\n\nexport default useListLogic;\n"],"names":["getDefaultItemId","item","getStorageObject","expanded","id","useListLogic","_useState","useState","_useState2","_slicedToArray","itemLimit","setItemLimit","_useState3","_useState4","expandedId","_useState5","_useState6","sortSetting","setSortSetting","_useState7","_useState8","scrollPosition","setScrollPosition","loader","useRef","scrollContainerRef","itemRefs","observer","_useMapList","useMapList","filteredListings","setFilteredListings","useEffect","localStorage","setItem","JSON","stringify","listingFiltered","dynamicSort","field","type","current","IntersectionObserver","handleObserver","root","rootMargin","threshold","observe","unobserve","length","toString","savedScrollPosition","parseInt","setTimeout","scrollContainer","addEventListener","handleScroll","removeEventListener","entities","target","isIntersecting","prevLimit","disconnect","scrollTop"],"mappings":";;;;;;AAOA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,GAAS;AAC9B,EAAA,IAAIC,IAAI,GAAGC,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;EAC/C,IAAI,CAAAD,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAJA,IAAI,CAAEE,QAAQ,KAAI,IAAI,EAAE;IAC3B,OAAOF,IAAI,CAACG,EAAE,CAAA;AACf,GAAC,MAAM;AACN,IAAA,OAAO,IAAI,CAAA;AACZ,GAAA;AACD,CAAC,CAAA;AAED,IAAMC,YAAY,GAAG,SAAfA,YAAYA,GAAS;AAC1B,EAAA,IAAAC,SAAA,GAAkCC,QAAQ,CAAC,GAAG,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAxCI,IAAAA,SAAS,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,YAAY,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AAC9B,EAAA,IAAAI,UAAA,GAAqBL,QAAQ,CAACP,gBAAgB,EAAE,CAAC;IAAAa,UAAA,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AW,CAACuB,IAAI,CAAC,CAAA;AACnE,GAAA;AAEA,EAAA,IAAMgB,YAAY,GAAG,SAAfA,YAAYA,GAAS;IAC1B,IAAI/B,kBAAkB,CAACgB,OAAO,EAAE;AAC/BnB,MAAAA,iBAAiB,CAACG,kBAAkB,CAACgB,OAAO,CAACsB,SAAS,CAAC,CAAA;AACxD,KAAA;GACA,CAAA;EAED,OAAO;AAAErD,IAAAA,SAAS,EAATA,SAAS;AAAEI,IAAAA,UAAU,EAAVA,UAAU;AAAEG,IAAAA,WAAW,EAAXA,WAAW;AAAEI,IAAAA,cAAc,EAAdA,cAAc;AAAEE,IAAAA,MAAM,EAANA,MAAM;AAAEE,IAAAA,kBAAkB,EAAlBA,kBAAkB;AAAEC,IAAAA,QAAQ,EAARA,QAAQ;AAAER,IAAAA,cAAc,EAAdA,cAAc;AAAEI,IAAAA,iBAAiB,EAAjBA,iBAAiB;AAAEgB,IAAAA,WAAW,EAAXA,WAAW;AAAER,IAAAA,gBAAgB,EAAhBA,gBAAAA;GAAkB,CAAA;AACtK;;;;"}
1
+ {"version":3,"file":"useList.js","sources":["../../src/hooks/useList.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\n\nimport { getStorageObject } from '~/util/localStorageUtil';\nimport { dynamicSort } from '~/util/sortUtil';\n\nimport { useMapList } from '~/contexts/mapListContext';\n\nconst getDefaultItemId = () => {\n\tlet item = getStorageObject(\"selectedListItem\");\n\tif (item?.expanded == true) {\n\t\treturn item.id;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nconst useListLogic = () => {\n\tconst [itemLimit, setItemLimit] = useState(100);\n\tconst [expandedId] = useState(getDefaultItemId());\n\tconst [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', null));\n\tconst [scrollPosition, setScrollPosition] = useState(getStorageObject('scrollPosition', 0));\n\tconst loader = useRef(null);\n\tconst scrollContainerRef = useRef(null);\n\tconst itemRefs = useRef({});\n\tconst observer = useRef(null);\n\tconst { filteredListings, setFilteredListings } = useMapList();\n\n\tuseEffect(() => {\n\t\tif (!sortSetting) return;\n\t\tlocalStorage.setItem('sortSetting', JSON.stringify(sortSetting));\n\t\tlet listingFiltered = dynamicSort(filteredListings, sortSetting.field, sortSetting.type);\n\t\tsetFilteredListings(listingFiltered);\n\t}, [sortSetting, filteredListings, setFilteredListings]);\n\n\tuseEffect(() => {\n\t\tobserver.current = new IntersectionObserver(handleObserver, {\n\t\t\troot: scrollContainerRef.current,\n\t\t\trootMargin: \"100px 0px\",\n\t\t\tthreshold: 0.5\n\t\t});\n\t\tif (loader.current) {\n\t\t\tobserver.current.observe(loader.current);\n\t\t}\n\t\treturn () => {\n\t\t\tif (observer.current && loader.current) {\n\t\t\t\tobserver.current.unobserve(loader.current);\n\t\t\t}\n\t\t};\n\t}, [filteredListings.length, itemLimit]);\n\n\tuseEffect(() => {\n\t\tlocalStorage.setItem('scrollPosition', scrollPosition.toString());\n\t}, [scrollPosition]);\n\n\tuseEffect(() => {\n\t\tconst savedScrollPosition = scrollPosition;\n\t\tif (parseInt(savedScrollPosition) > 3000) {\n\t\t\tsetItemLimit(savedScrollPosition / 10);\n\t\t}\n\t\tif (savedScrollPosition && scrollContainerRef.current) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tscrollContainerRef.current.scrollTop = parseInt(savedScrollPosition, 10);\n\t\t\t}, 300);\n\t\t}\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst scrollContainer = scrollContainerRef.current;\n\t\tif (scrollContainer) {\n\t\t\tscrollContainer.addEventListener('scroll', handleScroll);\n\t\t}\n\t\treturn () => {\n\t\t\tif (scrollContainer) {\n\t\t\t\tscrollContainer.removeEventListener('scroll', handleScroll);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\tconst handleObserver = entities => {\n\t\tconst target = entities[0];\n\t\tif (!target.isIntersecting) return;\n\t\tif (filteredListings.length > itemLimit) {\n\t\t\tsetItemLimit(prevLimit => prevLimit + 100);\n\t\t} else if (observer.current) {\n\t\t\tobserver.current.disconnect();\n\t\t}\n\t};\n\n\tconst handleScroll = () => {\n\t\tif (scrollContainerRef.current) {\n\t\t\tsetScrollPosition(scrollContainerRef.current.scrollTop);\n\t\t}\n\t};\n\n\treturn { itemLimit, expandedId, sortSetting, scrollPosition, loader, scrollContainerRef, itemRefs, setSortSetting, setScrollPosition, dynamicSort, filteredListings };\n};\n\nexport default useListLogic;\n"],"names":["getDefaultItemId","item","getStorageObject","expanded","id","useListLogic","_useState","useState","_useState2","_slicedToArray","itemLimit","setItemLimit","_useState3","_useState4","expandedId","_useState5","_useState6","sortSetting","setSortSetting","_useState7","_useState8","scrollPosition","setScrollPosition","loader","useRef","scrollContainerRef","itemRefs","observer","_useMapList","useMapList","filteredListings","setFilteredListings","useEffect","localStorage","setItem","JSON","stringify","listingFiltered","dynamicSort","field","type","current","IntersectionObserver","handleObserver","root","rootMargin","threshold","observe","unobserve","length","toString","savedScrollPosition","parseInt","setTimeout","scrollTop","scrollContainer","addEventListener","handleScroll","removeEventListener","entities","target","isIntersecting","prevLimit","disconnect"],"mappings":";;;;;;AAOA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,GAAS;AAC9B,EAAA,IAAIC,IAAI,GAAGC,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;EAC/C,IAAI,CAAAD,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAJA,IAAI,CAAEE,QAAQ,KAAI,IAAI,EAAE;IAC3B,OAAOF,IAAI,CAACG,EAAE,CAAA;AACf,GAAC,MAAM;AACN,IAAA,OAAO,IAAI,CAAA;AACZ,GAAA;AACD,CAAC,CAAA;AAED,IAAMC,YAAY,GAAG,SAAfA,YAAYA,GAAS;AAC1B,EAAA,IAAAC,SAAA,GAAkCC,QAAQ,CAAC,GAAG,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAxCI,IAAAA,SAAS,GAAAF,UAAA,CAAA,C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AAC9B,KAAA;GACA,CAAA;AAED,EAAA,IAAMN,YAAY,GAAG,SAAfA,YAAYA,GAAS;IAC1B,IAAIhC,kBAAkB,CAACgB,OAAO,EAAE;AAC/BnB,MAAAA,iBAAiB,CAACG,kBAAkB,CAACgB,OAAO,CAACa,SAAS,CAAC,CAAA;AACxD,KAAA;GACA,CAAA;EAED,OAAO;AAAE5C,IAAAA,SAAS,EAATA,SAAS;AAAEI,IAAAA,UAAU,EAAVA,UAAU;AAAEG,IAAAA,WAAW,EAAXA,WAAW;AAAEI,IAAAA,cAAc,EAAdA,cAAc;AAAEE,IAAAA,MAAM,EAANA,MAAM;AAAEE,IAAAA,kBAAkB,EAAlBA,kBAAkB;AAAEC,IAAAA,QAAQ,EAARA,QAAQ;AAAER,IAAAA,cAAc,EAAdA,cAAc;AAAEI,IAAAA,iBAAiB,EAAjBA,iBAAiB;AAAEgB,IAAAA,WAAW,EAAXA,WAAW;AAAER,IAAAA,gBAAgB,EAAhBA,gBAAAA;GAAkB,CAAA;AACtK;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abcagency/hc-ui-components",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "UI Components for HireControl",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -30,8 +30,7 @@ const useListLogic = () => {
30
30
  localStorage.setItem('sortSetting', JSON.stringify(sortSetting));
31
31
  let listingFiltered = dynamicSort(filteredListings, sortSetting.field, sortSetting.type);
32
32
  setFilteredListings(listingFiltered);
33
- // eslint-disable-next-line react-hooks/exhaustive-deps
34
- }, [sortSetting]);
33
+ }, [sortSetting, filteredListings, setFilteredListings]);
35
34
 
36
35
  useEffect(() => {
37
36
  observer.current = new IntersectionObserver(handleObserver, {
@@ -47,8 +46,7 @@ const useListLogic = () => {
47
46
  observer.current.unobserve(loader.current);
48
47
  }
49
48
  };
50
- // eslint-disable-next-line react-hooks/exhaustive-deps
51
- }, [loader.current, itemLimit, filteredListings.length]);
49
+ }, [filteredListings.length, itemLimit]);
52
50
 
53
51
  useEffect(() => {
54
52
  localStorage.setItem('scrollPosition', scrollPosition.toString());
@@ -59,11 +57,9 @@ const useListLogic = () => {
59
57
  if (parseInt(savedScrollPosition) > 3000) {
60
58
  setItemLimit(savedScrollPosition / 10);
61
59
  }
62
- if (savedScrollPosition && scrollPosition != null && scrollContainerRef.current) {
63
- // eslint-disable-next-line no-unused-vars
64
- let scrollContainerRefCurrent = scrollContainerRef.current;
60
+ if (savedScrollPosition && scrollContainerRef.current) {
65
61
  setTimeout(() => {
66
- scrollContainerRefCurrent = parseInt(savedScrollPosition, 10);
62
+ scrollContainerRef.current.scrollTop = parseInt(savedScrollPosition, 10);
67
63
  }, 300);
68
64
  }
69
65
  }, []);
@@ -78,8 +74,7 @@ const useListLogic = () => {
78
74
  scrollContainer.removeEventListener('scroll', handleScroll);
79
75
  }
80
76
  };
81
- // eslint-disable-next-line react-hooks/exhaustive-deps
82
- }, [scrollContainerRef.current]);
77
+ }, []);
83
78
 
84
79
  const handleObserver = entities => {
85
80
  const target = entities[0];
@@ -89,13 +84,8 @@ const useListLogic = () => {
89
84
  } else if (observer.current) {
90
85
  observer.current.disconnect();
91
86
  }
92
-
93
87
  };
94
88
 
95
- if (sortSetting) {
96
- dynamicSort(filteredListings, sortSetting.field, sortSetting.type);
97
- }
98
-
99
89
  const handleScroll = () => {
100
90
  if (scrollContainerRef.current) {
101
91
  setScrollPosition(scrollContainerRef.current.scrollTop);