@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260708070033 → 0.8.1-dev.20260708102516

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.mjs CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  Button_default,
34
34
  ClientButton_default,
35
35
  ToastService_default
36
- } from "./chunk-67IG5NBU.mjs";
36
+ } from "./chunk-JKP4XOZB.mjs";
37
37
  import "./chunk-IMNQO57B.mjs";
38
38
 
39
39
  // src/components/controls/view/ViewControl.tsx
@@ -408,7 +408,7 @@ var ViewControl_default = ViewControl;
408
408
 
409
409
  // src/components/controls/edit/InputControl.tsx
410
410
  import dynamic4 from "next/dynamic";
411
- var InputControl = dynamic4(() => import("./InputControlClient-646PQPKQ.mjs"), {
411
+ var InputControl = dynamic4(() => import("./InputControlClient-XS52LLEE.mjs"), {
412
412
  ssr: false
413
413
  });
414
414
  var InputControl_default = InputControl;
@@ -612,7 +612,7 @@ var ImageNode_default = ImageNode;
612
612
  // src/components/pageRenderingEngine/nodes/LinkNode.tsx
613
613
  import dynamic6 from "next/dynamic";
614
614
  import { Fragment, jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
615
- var LinkNodeButton = dynamic6(() => import("./LinkNodeButton-WA5N3CBJ.mjs"), {
615
+ var LinkNodeButton = dynamic6(() => import("./LinkNodeButton-LX3KKGZY.mjs"), {
616
616
  ssr: false
617
617
  });
618
618
  function getNestedValue2(obj, path) {
@@ -2746,50 +2746,41 @@ var PageBodyRenderer = (props) => {
2746
2746
  var PageBodyRenderer_default = PageBodyRenderer;
2747
2747
 
2748
2748
  // src/components/Toast.tsx
2749
- import { useState } from "react";
2749
+ import { useCallback, useEffect, useRef, useState } from "react";
2750
2750
  import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs14 } from "react/jsx-runtime";
2751
2751
  var Toast = () => {
2752
2752
  const [showToast, setShowToast] = useState(false);
2753
2753
  const [message, setMessage] = useState("");
2754
2754
  const [messageType, setMessageType] = useState("error");
2755
- ToastService_default.showError = function(message2) {
2756
- setShowToast(true);
2757
- setMessage(message2);
2758
- setMessageType("error");
2759
- setTimeout(() => {
2760
- setShowToast(false);
2761
- }, 4e3);
2762
- };
2763
- ToastService_default.showSuccess = function(message2) {
2764
- setShowToast(true);
2765
- setMessage(message2);
2766
- setMessageType("success");
2767
- setTimeout(() => {
2768
- setShowToast(false);
2769
- }, 4e3);
2770
- };
2771
- ToastService_default.showWarning = function(message2) {
2772
- setShowToast(true);
2773
- setMessage(message2);
2774
- setMessageType("warning");
2775
- setTimeout(() => {
2776
- setShowToast(false);
2777
- }, 4e3);
2778
- };
2779
- ToastService_default.showInfo = function(message2) {
2755
+ const timeoutRef = useRef(null);
2756
+ const closeToast = useCallback(() => {
2757
+ if (timeoutRef.current) {
2758
+ clearTimeout(timeoutRef.current);
2759
+ timeoutRef.current = null;
2760
+ }
2761
+ setShowToast(false);
2762
+ }, []);
2763
+ const showMessage = useCallback((message2, messageType2) => {
2764
+ if (timeoutRef.current) {
2765
+ clearTimeout(timeoutRef.current);
2766
+ }
2780
2767
  setShowToast(true);
2781
2768
  setMessage(message2);
2782
- setMessageType("info");
2783
- setTimeout(() => {
2769
+ setMessageType(messageType2);
2770
+ timeoutRef.current = setTimeout(() => {
2784
2771
  setShowToast(false);
2772
+ timeoutRef.current = null;
2785
2773
  }, 4e3);
2786
- };
2787
- ToastService_default.close = function() {
2788
- setShowToast(false);
2789
- };
2790
- const closeToast = () => {
2791
- setShowToast(false);
2792
- };
2774
+ }, []);
2775
+ useEffect(() => {
2776
+ ToastService_default.initialize(showMessage, closeToast);
2777
+ return () => {
2778
+ closeToast();
2779
+ ToastService_default.initialize(() => {
2780
+ }, () => {
2781
+ });
2782
+ };
2783
+ }, [closeToast, showMessage]);
2793
2784
  return /* @__PURE__ */ jsx36(Fragment7, { children: showToast && /* @__PURE__ */ jsx36("div", { className: "fixed top-2 flex justify-center w-1/2 max-w-xl left-1/2 -translate-x-1/2", style: { zIndex: 1e3 }, children: /* @__PURE__ */ jsxs14("div", { className: `w-full items-center flex justify-between p-3 rounded-md relative shadow border bg-${messageType}-soft`, children: [
2794
2785
  /* @__PURE__ */ jsx36(
2795
2786
  "span",
@@ -2856,7 +2847,7 @@ var NavigationTabsV2 = ({ tabs, params = {} }) => {
2856
2847
  var NavigationTabsV2_default = NavigationTabsV2;
2857
2848
 
2858
2849
  // src/components/dataForm/DataList.tsx
2859
- import React27, { useEffect, useState as useState2, useCallback, useReducer } from "react";
2850
+ import React27, { useEffect as useEffect2, useState as useState2, useCallback as useCallback2, useReducer } from "react";
2860
2851
  import { useRouter } from "next/navigation";
2861
2852
 
2862
2853
  // src/components/dataForm/NoContentView.tsx
@@ -2964,7 +2955,7 @@ var DataList = (props) => {
2964
2955
  console.log(props.addLinkText);
2965
2956
  const [isDataFound, setIsDataFound] = useState2(null);
2966
2957
  const [searchTerm, setSearchTerm] = useState2(props.query?.searchTerm ?? "");
2967
- useEffect(() => {
2958
+ useEffect2(() => {
2968
2959
  if (props?.dataset) {
2969
2960
  if (props?.dataset.result && props.dataset.result.length > 0) {
2970
2961
  setIsDataFound(true);
@@ -2973,7 +2964,7 @@ var DataList = (props) => {
2973
2964
  }
2974
2965
  }
2975
2966
  }, [props.dataset]);
2976
- useEffect(() => {
2967
+ useEffect2(() => {
2977
2968
  if (!props.query?.["$filter"] || !props.filters) return;
2978
2969
  const filterQuery = props.query["$filter"];
2979
2970
  props.filters.forEach((filter) => {
@@ -3005,7 +2996,7 @@ var DataList = (props) => {
3005
2996
  const getSearchableColumns = () => {
3006
2997
  return props.columns?.filter((c) => c.isSearchable)?.map((c) => c.name)?.join(",");
3007
2998
  };
3008
- const handleFilterChange = useCallback(
2999
+ const handleFilterChange = useCallback2(
3009
3000
  (updatedValues) => {
3010
3001
  dispatch({
3011
3002
  type: FORM_INPUT_UPDATE,
@@ -3036,7 +3027,7 @@ var DataList = (props) => {
3036
3027
  },
3037
3028
  [dispatch, props, router]
3038
3029
  );
3039
- useEffect(() => {
3030
+ useEffect2(() => {
3040
3031
  if (!props.columns.some((col) => col.isSearchable)) {
3041
3032
  return;
3042
3033
  }
@@ -3483,7 +3474,7 @@ var DataList = (props) => {
3483
3474
  var DataList_default = DataList;
3484
3475
 
3485
3476
  // src/components/dataForm/DataListRenderer.tsx
3486
- import React28, { useState as useState3, useEffect as useEffect2 } from "react";
3477
+ import React28, { useState as useState3, useEffect as useEffect3 } from "react";
3487
3478
  import { usePathname as usePathname2 } from "next/navigation";
3488
3479
  import { jsx as jsx41, jsxs as jsxs17 } from "react/jsx-runtime";
3489
3480
  var viewControlMap = {
@@ -3547,7 +3538,7 @@ var DataListRenderer = ({
3547
3538
  const [addLinkText, setAddLinkText] = useState3("");
3548
3539
  const [serviceRoute, setServiceRoute] = useState3("");
3549
3540
  const pathname = usePathname2();
3550
- useEffect2(() => {
3541
+ useEffect3(() => {
3551
3542
  if (!formDefinition) return;
3552
3543
  setColumns(mapApiToColumns(formDefinition));
3553
3544
  setFilters(mapApiToFilters(formDefinition));
@@ -3560,7 +3551,7 @@ var DataListRenderer = ({
3560
3551
  setAddLinkHref(resolvedAddLinkHref);
3561
3552
  setAddLinkText(formDefinition?.siteFormDataList?.addLinkText ?? "");
3562
3553
  }, [formDefinition, params]);
3563
- useEffect2(() => {
3554
+ useEffect3(() => {
3564
3555
  const fetchData = async () => {
3565
3556
  if (!serviceRoute) return;
3566
3557
  const resolvedRoute = resolveRoutePlaceholders2(serviceRoute, params);
@@ -3607,10 +3598,10 @@ var DataListRenderer = ({
3607
3598
  var DataListRenderer_default = DataListRenderer;
3608
3599
 
3609
3600
  // src/components/dataForm/DataForm.tsx
3610
- import React30, { useCallback as useCallback3, useEffect as useEffect3, useReducer as useReducer2, useRef } from "react";
3601
+ import React30, { useCallback as useCallback4, useEffect as useEffect4, useReducer as useReducer2, useRef as useRef2 } from "react";
3611
3602
 
3612
3603
  // src/components/dataForm/DataFormChildSection.tsx
3613
- import React29, { useCallback as useCallback2 } from "react";
3604
+ import React29, { useCallback as useCallback3 } from "react";
3614
3605
 
3615
3606
  // src/components/dataForm/StyleTypes.tsx
3616
3607
  var StyleTypes2 = /* @__PURE__ */ ((StyleTypes3) => {
@@ -3645,7 +3636,7 @@ var DataFormChildSection = (props) => {
3645
3636
  return childItems.map((item, originalIndex) => ({ item, originalIndex })).filter((x) => !x.item.isDeleted) || [];
3646
3637
  };
3647
3638
  const childItemsToRender = getChildItemsForRendering();
3648
- const handleChildInputChange = useCallback2(
3639
+ const handleChildInputChange = useCallback3(
3649
3640
  (updatedValues) => {
3650
3641
  if (isOneToOne) {
3651
3642
  props.callback({
@@ -3672,7 +3663,7 @@ var DataFormChildSection = (props) => {
3672
3663
  },
3673
3664
  [props, isOneToOne, childItemsToRender]
3674
3665
  );
3675
- const onAddRow = useCallback2(() => {
3666
+ const onAddRow = useCallback3(() => {
3676
3667
  props.callback({
3677
3668
  sectionName: props.section.name,
3678
3669
  actionType: FORM_CHILD_ROW_ADD,
@@ -3681,7 +3672,7 @@ var DataFormChildSection = (props) => {
3681
3672
  rowIndex: -1
3682
3673
  });
3683
3674
  }, [props]);
3684
- const onDeleteRow = useCallback2(
3675
+ const onDeleteRow = useCallback3(
3685
3676
  (filteredIndex) => {
3686
3677
  const visibleItem = childItemsToRender[filteredIndex];
3687
3678
  if (visibleItem) {
@@ -3794,7 +3785,7 @@ var DataFormChildSection_default = DataFormChildSection;
3794
3785
  // src/components/dataForm/DataForm.tsx
3795
3786
  import { jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
3796
3787
  var DataForm = (props) => {
3797
- const formRef = useRef(null);
3788
+ const formRef = useRef2(null);
3798
3789
  console.log(props.dataItem, "dssads");
3799
3790
  const initialState = {
3800
3791
  inputValues: {},
@@ -3805,7 +3796,7 @@ var DataForm = (props) => {
3805
3796
  };
3806
3797
  const [formState, dispatch] = useReducer2(FormReducer_default, initialState);
3807
3798
  console.log(props.sections, "sections");
3808
- const clearHiddenChildSections = useCallback3(
3799
+ const clearHiddenChildSections = useCallback4(
3809
3800
  (changedProperty, newValues) => {
3810
3801
  if (!props.sections) return;
3811
3802
  const allChildSections = [];
@@ -3843,7 +3834,7 @@ var DataForm = (props) => {
3843
3834
  },
3844
3835
  [props.sections, formState.inputValues]
3845
3836
  );
3846
- const handleInputChange = useCallback3(
3837
+ const handleInputChange = useCallback4(
3847
3838
  async (updatedValues) => {
3848
3839
  dispatch({
3849
3840
  type: FORM_INPUT_UPDATE,
@@ -3858,7 +3849,7 @@ var DataForm = (props) => {
3858
3849
  },
3859
3850
  [dispatch, formState.inputValues, clearHiddenChildSections]
3860
3851
  );
3861
- const fetchData = useCallback3(async () => {
3852
+ const fetchData = useCallback4(async () => {
3862
3853
  if (!props.rules) return;
3863
3854
  if (Object.keys(formState.inputValues).length === 0) {
3864
3855
  return;
@@ -3889,7 +3880,7 @@ var DataForm = (props) => {
3889
3880
  console.error("Error fetching data:", error);
3890
3881
  }
3891
3882
  }, [formState.lastPropertyChanged, formState.inputValues]);
3892
- useEffect3(() => {
3883
+ useEffect4(() => {
3893
3884
  fetchData();
3894
3885
  }, [formState.inputValues, formState.lastPropertyChanged]);
3895
3886
  function replacePlaceholders(template, context, params) {
@@ -3909,7 +3900,7 @@ var DataForm = (props) => {
3909
3900
  }
3910
3901
  );
3911
3902
  }
3912
- const handleChildSectionChangeCallback = useCallback3(
3903
+ const handleChildSectionChangeCallback = useCallback4(
3913
3904
  (params) => {
3914
3905
  dispatch({
3915
3906
  type: params.actionType,
@@ -3954,7 +3945,7 @@ var DataForm = (props) => {
3954
3945
  });
3955
3946
  return cloned;
3956
3947
  }
3957
- const onClick = useCallback3(async () => {
3948
+ const onClick = useCallback4(async () => {
3958
3949
  if (props.onClick) {
3959
3950
  const isEdit = props.dataItem && Object.keys(props.dataItem).length > 0;
3960
3951
  const normalizedValues = normalizeChildSections(
@@ -3970,21 +3961,21 @@ var DataForm = (props) => {
3970
3961
  return { isSuccessful: true };
3971
3962
  }
3972
3963
  }, [formState, props]);
3973
- const handleAdditionalOnClick = useCallback3(async () => {
3964
+ const handleAdditionalOnClick = useCallback4(async () => {
3974
3965
  if (props.additionalActions?.onClick) {
3975
3966
  return await props.additionalActions.onClick(formState);
3976
3967
  } else {
3977
3968
  return { isSuccessful: true, message: "Action completed successfully" };
3978
3969
  }
3979
3970
  }, [formState, props]);
3980
- const onDelete = useCallback3(async () => {
3971
+ const onDelete = useCallback4(async () => {
3981
3972
  if (props.onDelete) {
3982
3973
  return await props.onDelete(formState);
3983
3974
  } else {
3984
3975
  return { isSuccessful: true };
3985
3976
  }
3986
3977
  }, [formState, props]);
3987
- useEffect3(() => {
3978
+ useEffect4(() => {
3988
3979
  if (props.dataItem) {
3989
3980
  dispatch({
3990
3981
  type: FORM_INITIAL_UPDATE,
package/dist/server.js CHANGED
@@ -691,38 +691,52 @@ var init_Hyperlink = __esm({
691
691
  });
692
692
 
693
693
  // src/components/ToastService.tsx
694
- var ToastService, ToastService_default;
694
+ var toastHandlersKey, getToastHandlers, ToastService, ToastService_default;
695
695
  var init_ToastService = __esm({
696
696
  "src/components/ToastService.tsx"() {
697
697
  "use strict";
698
- ToastService = class _ToastService {
698
+ toastHandlersKey = "__digitalStoreToastHandlers";
699
+ getToastHandlers = () => {
700
+ const globalScope = globalThis;
701
+ if (!globalScope[toastHandlersKey]) {
702
+ globalScope[toastHandlersKey] = {};
703
+ }
704
+ return globalScope[toastHandlersKey];
705
+ };
706
+ ToastService = class {
699
707
  static initialize(showToast, closeToast) {
700
- _ToastService.showToast = showToast;
701
- _ToastService.closeToast = closeToast;
708
+ const handlers = getToastHandlers();
709
+ handlers.showToast = showToast;
710
+ handlers.closeToast = closeToast;
702
711
  }
703
712
  static showError(message) {
704
- if (_ToastService.showToast) {
705
- _ToastService.showToast(message, "error");
713
+ const handlers = getToastHandlers();
714
+ if (handlers.showToast) {
715
+ handlers.showToast(message, "error");
706
716
  }
707
717
  }
708
718
  static showInfo(message) {
709
- if (_ToastService.showToast) {
710
- _ToastService.showToast(message, "info");
719
+ const handlers = getToastHandlers();
720
+ if (handlers.showToast) {
721
+ handlers.showToast(message, "info");
711
722
  }
712
723
  }
713
724
  static showWarning(message) {
714
- if (_ToastService.showToast) {
715
- _ToastService.showToast(message, "warning");
725
+ const handlers = getToastHandlers();
726
+ if (handlers.showToast) {
727
+ handlers.showToast(message, "warning");
716
728
  }
717
729
  }
718
730
  static showSuccess(message) {
719
- if (_ToastService.showToast) {
720
- _ToastService.showToast(message, "success");
731
+ const handlers = getToastHandlers();
732
+ if (handlers.showToast) {
733
+ handlers.showToast(message, "success");
721
734
  }
722
735
  }
723
736
  static close() {
724
- if (_ToastService.closeToast) {
725
- _ToastService.closeToast();
737
+ const handlers = getToastHandlers();
738
+ if (handlers.closeToast) {
739
+ handlers.closeToast();
726
740
  }
727
741
  }
728
742
  };
@@ -1191,10 +1205,9 @@ var init_LinkNodeButton = __esm({
1191
1205
  }
1192
1206
  return current;
1193
1207
  }, []);
1194
- const onClick = (0, import_react5.useCallback)(async (e) => {
1208
+ const onClick = (0, import_react5.useCallback)(async () => {
1195
1209
  if (!node.postUrl) {
1196
- ToastService_default.showError("No POST URL configured for this button");
1197
- return;
1210
+ return { isSuccessful: false, message: "No POST URL configured for this button" };
1198
1211
  }
1199
1212
  setIsLoading(true);
1200
1213
  try {
package/dist/server.mjs CHANGED
@@ -305,7 +305,7 @@ var ImageNode_default = ImageNode;
305
305
  // src/components/pageRenderingEngine/nodes/LinkNode.tsx
306
306
  import dynamic3 from "next/dynamic";
307
307
  import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
308
- var LinkNodeButton = dynamic3(() => import("./LinkNodeButton-GVOICN34.mjs"), {
308
+ var LinkNodeButton = dynamic3(() => import("./LinkNodeButton-U7T2NP22.mjs"), {
309
309
  ssr: false
310
310
  });
311
311
  function getNestedValue2(obj, path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acoustte-digital-services/digitalstore-controls-dev",
3
- "version": "0.8.1-dev.20260708070033",
3
+ "version": "0.8.1-dev.20260708102516",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,183 +0,0 @@
1
- "use client";
2
-
3
- "use client";
4
- import {
5
- OdataBuilder
6
- } from "./chunk-R2HV35IB.mjs";
7
- import {
8
- Constants,
9
- Hyperlink,
10
- Icon_default
11
- } from "./chunk-2GSYECIS.mjs";
12
- import "./chunk-IMNQO57B.mjs";
13
-
14
- // src/components/Pagination.tsx
15
- import { useMemo } from "react";
16
- import { jsx, jsxs } from "react/jsx-runtime";
17
- var Pagination = (props) => {
18
- const { dataset, path, query, showPageSizeSelector = false, showJumpToPage = false } = props;
19
- const builder = useMemo(() => {
20
- const b = new OdataBuilder(path);
21
- if (query) b.setQuery(query);
22
- return b;
23
- }, [path, query]);
24
- const activePageNumber = builder.getPageNumber(Constants.pagesize);
25
- const totalItems = dataset?.count || 0;
26
- const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
27
- const totalPages = Math.ceil(totalItems / itemsPerPage);
28
- const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
29
- const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
30
- const getPaginationRange = () => {
31
- const delta = 1;
32
- const range = [];
33
- if (totalPages <= 7) {
34
- return Array.from({ length: totalPages }, (_, i) => i + 1);
35
- }
36
- range.push(1);
37
- let start = Math.max(2, activePageNumber - delta);
38
- let end = Math.min(totalPages - 1, activePageNumber + delta);
39
- if (activePageNumber - delta <= 2) {
40
- end = Math.min(totalPages - 1, 4);
41
- }
42
- if (activePageNumber + delta >= totalPages - 1) {
43
- start = Math.max(2, totalPages - 4);
44
- }
45
- if (start > 2) {
46
- range.push("...");
47
- }
48
- for (let i = start; i <= end; i++) {
49
- range.push(i);
50
- }
51
- if (end < totalPages - 1) {
52
- range.push("...");
53
- }
54
- if (totalPages > 1) {
55
- range.push(totalPages);
56
- }
57
- return range;
58
- };
59
- const paginationRange = getPaginationRange();
60
- const PageButton = ({ page, children }) => /* @__PURE__ */ jsx(
61
- Hyperlink,
62
- {
63
- linkType: "Link" /* Link */,
64
- className: `
65
- min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2.5 md:px-3
66
- border text-sm font-medium transition-colors duration-150
67
- ${activePageNumber === page ? "bg-primary-base font-semibold" : ""}
68
- `,
69
- href: builder.getNewPageUrl(page),
70
- children
71
- }
72
- );
73
- const NavigationButton = ({ page, disabled, children }) => {
74
- if (disabled) {
75
- return /* @__PURE__ */ jsx("span", { className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border bg-neutral-base cursor-not-allowed", children });
76
- }
77
- return /* @__PURE__ */ jsx(
78
- Hyperlink,
79
- {
80
- className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border transition-colors duration-150",
81
- href: builder.getNewPageUrl(page),
82
- children
83
- }
84
- );
85
- };
86
- if (totalPages <= 1 && totalItems === 0) return null;
87
- return /* @__PURE__ */ jsxs("div", { className: "py-6 border-t bg-default", children: [
88
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
89
- /* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
90
- "Showing ",
91
- /* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
92
- startItem,
93
- "-",
94
- endItem
95
- ] }),
96
- " ",
97
- "out of ",
98
- /* @__PURE__ */ jsx("span", { className: "font-semibold", children: totalItems.toLocaleString() }),
99
- " results"
100
- ] }),
101
- totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
102
- /* @__PURE__ */ jsxs(
103
- NavigationButton,
104
- {
105
- page: activePageNumber - 1,
106
- disabled: activePageNumber === 1,
107
- children: [
108
- /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon_default, { name: "chevronLeft", className: "w-4 h-4 mr-1" }) }),
109
- /* @__PURE__ */ jsx("span", { className: "text-sm", children: "Prev" })
110
- ]
111
- }
112
- ),
113
- paginationRange.map((item, index) => {
114
- if (item === "...") {
115
- return /* @__PURE__ */ jsx(
116
- "span",
117
- {
118
- className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center text-gray-500",
119
- children: "..."
120
- },
121
- `ellipsis-${index}`
122
- );
123
- }
124
- const page = item;
125
- return /* @__PURE__ */ jsx(PageButton, { page, children: page }, page);
126
- }),
127
- /* @__PURE__ */ jsxs(
128
- NavigationButton,
129
- {
130
- page: activePageNumber + 1,
131
- disabled: activePageNumber === totalPages,
132
- children: [
133
- /* @__PURE__ */ jsx("span", { className: "text-sm", children: "Next" }),
134
- /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon_default, { name: "chevronRight", className: "w-4 h-4 ml-1" }) })
135
- ]
136
- }
137
- )
138
- ] }),
139
- showJumpToPage && totalPages > 5 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
140
- /* @__PURE__ */ jsx("span", { className: "text-sm", children: "Go to:" }),
141
- /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
142
- "input",
143
- {
144
- type: "number",
145
- min: "1",
146
- max: totalPages,
147
- defaultValue: activePageNumber,
148
- className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
149
- onKeyDown: (e) => {
150
- if (e.key === "Enter") {
151
- const input = e.target;
152
- const page = parseInt(input.value);
153
- if (page >= 1 && page <= totalPages && page !== activePageNumber) {
154
- window.location.href = builder.getNewPageUrl(page);
155
- }
156
- }
157
- }
158
- }
159
- ) })
160
- ] })
161
- ] }),
162
- showPageSizeSelector && /* @__PURE__ */ jsx("div", { className: "mt-4 pt-4 border-t bg-default", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center space-x-2", children: [
163
- /* @__PURE__ */ jsx("span", { className: "text-sm", children: "Show:" }),
164
- /* @__PURE__ */ jsx("div", { className: "flex space-x-1", children: [10, 25, 50, 100].map((size) => /* @__PURE__ */ jsx(
165
- Hyperlink,
166
- {
167
- className: `
168
- px-3 py-1 text-sm rounded border transition-colors duration-150
169
- ${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
170
- `,
171
- href: builder.getNewPageSizeUrl(size),
172
- children: size
173
- },
174
- size
175
- )) }),
176
- /* @__PURE__ */ jsx("span", { className: "text-sm", children: "per page" })
177
- ] }) })
178
- ] });
179
- };
180
- var Pagination_default = Pagination;
181
- export {
182
- Pagination_default as default
183
- };