@inploi/plugin-job-search 0.23.1 → 0.23.2

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.cjs CHANGED
@@ -5585,12 +5585,20 @@ const JobCardSkeleton = ({
5585
5585
  const LoadMore = ({
5586
5586
  state,
5587
5587
  fetchNextPage,
5588
- config
5588
+ config,
5589
+ remainingItems
5589
5590
  }) => {
5591
+ const itemsToLoad = Math.min(PAGE_SIZE, remainingItems);
5590
5592
  if (state === "revalidating") {
5591
5593
  return /* @__PURE__ */ u$2("ul", { class: "flex flex-col gap-3", "aria-hidden": true, children: Array.from({ length: PAGE_SIZE }).map((_2, i2) => /* @__PURE__ */ u$2("li", { children: /* @__PURE__ */ u$2(JobCardSkeleton, { seed: i2, animationDelay: (i2 - 4) * 0.1, config }) }, i2)) });
5592
5594
  } else {
5593
- return /* @__PURE__ */ u$2("button", { class: btnClass({ variant: "neutral", class: "py-2" }), onClick: fetchNextPage, children: "Load More" });
5595
+ return /* @__PURE__ */ u$2("button", { class: btnClass({ variant: "neutral", class: "py-2" }), onClick: fetchNextPage, children: [
5596
+ "Load ",
5597
+ itemsToLoad,
5598
+ " more of ",
5599
+ remainingItems,
5600
+ " remaining"
5601
+ ] });
5594
5602
  }
5595
5603
  };
5596
5604
  const getResultsCount = ({ pagination }) => {
@@ -5696,6 +5704,8 @@ const ResultsPage = ({
5696
5704
  ] })
5697
5705
  ] });
5698
5706
  const hasMore = data.pagination.last_page !== data.pagination.current_page;
5707
+ const alreadyDisplayedItems = page * PAGE_SIZE;
5708
+ const remainingItems = Math.max(data.pagination.total - alreadyDisplayedItems, 0);
5699
5709
  return /* @__PURE__ */ u$2(k$3, { children: [
5700
5710
  isFirst && /* @__PURE__ */ u$2("p", { class: "text-copy-neutral-lowcontrast text-style-tag m-0 p-0 text-center", children: getResultsCount({ pagination: data.pagination }) }),
5701
5711
  /* @__PURE__ */ u$2("ul", { "aria-label": `Page ${page}`, class: "flex flex-col gap-3", children: data.results.map((job) => {
@@ -5709,7 +5719,15 @@ const ResultsPage = ({
5709
5719
  job.id
5710
5720
  );
5711
5721
  }) }),
5712
- hasMore && isLast && /* @__PURE__ */ u$2(LoadMore, { state, fetchNextPage, config: jobCardConfig })
5722
+ hasMore && isLast && /* @__PURE__ */ u$2(
5723
+ LoadMore,
5724
+ {
5725
+ state,
5726
+ fetchNextPage,
5727
+ config: jobCardConfig,
5728
+ remainingItems
5729
+ }
5730
+ )
5713
5731
  ] });
5714
5732
  }
5715
5733
  default:
package/dist/index.js CHANGED
@@ -5583,12 +5583,20 @@ const JobCardSkeleton = ({
5583
5583
  const LoadMore = ({
5584
5584
  state,
5585
5585
  fetchNextPage,
5586
- config
5586
+ config,
5587
+ remainingItems
5587
5588
  }) => {
5589
+ const itemsToLoad = Math.min(PAGE_SIZE, remainingItems);
5588
5590
  if (state === "revalidating") {
5589
5591
  return /* @__PURE__ */ u$2("ul", { class: "flex flex-col gap-3", "aria-hidden": true, children: Array.from({ length: PAGE_SIZE }).map((_2, i2) => /* @__PURE__ */ u$2("li", { children: /* @__PURE__ */ u$2(JobCardSkeleton, { seed: i2, animationDelay: (i2 - 4) * 0.1, config }) }, i2)) });
5590
5592
  } else {
5591
- return /* @__PURE__ */ u$2("button", { class: btnClass({ variant: "neutral", class: "py-2" }), onClick: fetchNextPage, children: "Load More" });
5593
+ return /* @__PURE__ */ u$2("button", { class: btnClass({ variant: "neutral", class: "py-2" }), onClick: fetchNextPage, children: [
5594
+ "Load ",
5595
+ itemsToLoad,
5596
+ " more of ",
5597
+ remainingItems,
5598
+ " remaining"
5599
+ ] });
5592
5600
  }
5593
5601
  };
5594
5602
  const getResultsCount = ({ pagination }) => {
@@ -5694,6 +5702,8 @@ const ResultsPage = ({
5694
5702
  ] })
5695
5703
  ] });
5696
5704
  const hasMore = data.pagination.last_page !== data.pagination.current_page;
5705
+ const alreadyDisplayedItems = page * PAGE_SIZE;
5706
+ const remainingItems = Math.max(data.pagination.total - alreadyDisplayedItems, 0);
5697
5707
  return /* @__PURE__ */ u$2(k$3, { children: [
5698
5708
  isFirst && /* @__PURE__ */ u$2("p", { class: "text-copy-neutral-lowcontrast text-style-tag m-0 p-0 text-center", children: getResultsCount({ pagination: data.pagination }) }),
5699
5709
  /* @__PURE__ */ u$2("ul", { "aria-label": `Page ${page}`, class: "flex flex-col gap-3", children: data.results.map((job) => {
@@ -5707,7 +5717,15 @@ const ResultsPage = ({
5707
5717
  job.id
5708
5718
  );
5709
5719
  }) }),
5710
- hasMore && isLast && /* @__PURE__ */ u$2(LoadMore, { state, fetchNextPage, config: jobCardConfig })
5720
+ hasMore && isLast && /* @__PURE__ */ u$2(
5721
+ LoadMore,
5722
+ {
5723
+ state,
5724
+ fetchNextPage,
5725
+ config: jobCardConfig,
5726
+ remainingItems
5727
+ }
5728
+ )
5711
5729
  ] });
5712
5730
  }
5713
5731
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-job-search",
3
- "version": "0.23.1",
3
+ "version": "0.23.2",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-job-search.js",
6
6
  "types": "dist/index.d.ts",