@diwauhris/ui 1.7.2 → 1.7.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.
package/lib/index.cjs CHANGED
@@ -829,12 +829,12 @@ function Combobox({ value, onChange, options, placeholder, className, disabled,
829
829
  const listboxId = `${uid}-listbox`;
830
830
  const optionId = (index) => `${uid}-option-${index}`;
831
831
  const q = search.toLowerCase().trim();
832
- const filtered = q.length < 2 ? [] : options.filter((opt) => opt.label.toLowerCase().includes(q)).sort((a, b) => {
832
+ const DISPLAY_LIMIT = 100;
833
+ const filtered = q.length === 0 ? options : options.filter((opt) => opt.label.toLowerCase().includes(q)).sort((a, b) => {
833
834
  const al = a.label.toLowerCase();
834
835
  const bl = b.label.toLowerCase();
835
836
  return (al === q ? 0 : al.startsWith(q) ? 1 : al.indexOf(q) + 2) - (bl === q ? 0 : bl.startsWith(q) ? 1 : bl.indexOf(q) + 2);
836
837
  });
837
- const DISPLAY_LIMIT = 100;
838
838
  const displayed = filtered.length > DISPLAY_LIMIT ? filtered.slice(0, DISPLAY_LIMIT) : filtered;
839
839
  (0, react.useEffect)(() => {
840
840
  setSearch(value);
@@ -925,7 +925,7 @@ function Combobox({ value, onChange, options, placeholder, className, disabled,
925
925
  children: "Loading..."
926
926
  }) : filtered.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
927
927
  className: "px-3 py-2 text-sm text-slate-400 font-semibold",
928
- children: q.length < 2 ? "Type at least 2 characters to search..." : "No matches — press Enter to use this value"
928
+ children: "No matches — press Enter to use this value"
929
929
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [displayed.map((opt, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
930
930
  id: optionId(i),
931
931
  role: "option",
@@ -2906,8 +2906,21 @@ function Pagination({ page, totalPages, onPageChange, ariaLabel = "Pagination",
2906
2906
  const rangeEnd = showRecordCount ? Math.min(page * pageSize, totalItems) : null;
2907
2907
  const pageNumbers = getPageNumbers(page, totalPages);
2908
2908
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2909
- className: "flex flex-col items-center gap-1.5",
2910
- children: [totalPages > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
2909
+ className: "flex items-center justify-between gap-4",
2910
+ children: [showRecordCount ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
2911
+ className: "text-[11px] font-bold tabular-nums text-slate-400",
2912
+ "aria-live": "polite",
2913
+ children: [
2914
+ "Showing ",
2915
+ rangeStart,
2916
+ "–",
2917
+ rangeEnd,
2918
+ " of ",
2919
+ totalItems,
2920
+ " ",
2921
+ itemLabel
2922
+ ]
2923
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {}), totalPages > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
2911
2924
  "aria-label": ariaLabel,
2912
2925
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("ol", {
2913
2926
  className: "list-none flex items-center gap-1",
@@ -2951,19 +2964,6 @@ function Pagination({ page, totalPages, onPageChange, ariaLabel = "Pagination",
2951
2964
  }) })
2952
2965
  ]
2953
2966
  })
2954
- }), showRecordCount && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
2955
- className: "text-[11px] font-bold tabular-nums text-slate-400",
2956
- "aria-live": "polite",
2957
- children: [
2958
- "Showing ",
2959
- rangeStart,
2960
- "–",
2961
- rangeEnd,
2962
- " of ",
2963
- totalItems,
2964
- " ",
2965
- itemLabel
2966
- ]
2967
2967
  })]
2968
2968
  });
2969
2969
  }
package/lib/index.mjs CHANGED
@@ -804,12 +804,12 @@ function Combobox({ value, onChange, options, placeholder, className, disabled,
804
804
  const listboxId = `${uid}-listbox`;
805
805
  const optionId = (index) => `${uid}-option-${index}`;
806
806
  const q = search.toLowerCase().trim();
807
- const filtered = q.length < 2 ? [] : options.filter((opt) => opt.label.toLowerCase().includes(q)).sort((a, b) => {
807
+ const DISPLAY_LIMIT = 100;
808
+ const filtered = q.length === 0 ? options : options.filter((opt) => opt.label.toLowerCase().includes(q)).sort((a, b) => {
808
809
  const al = a.label.toLowerCase();
809
810
  const bl = b.label.toLowerCase();
810
811
  return (al === q ? 0 : al.startsWith(q) ? 1 : al.indexOf(q) + 2) - (bl === q ? 0 : bl.startsWith(q) ? 1 : bl.indexOf(q) + 2);
811
812
  });
812
- const DISPLAY_LIMIT = 100;
813
813
  const displayed = filtered.length > DISPLAY_LIMIT ? filtered.slice(0, DISPLAY_LIMIT) : filtered;
814
814
  useEffect(() => {
815
815
  setSearch(value);
@@ -900,7 +900,7 @@ function Combobox({ value, onChange, options, placeholder, className, disabled,
900
900
  children: "Loading..."
901
901
  }) : filtered.length === 0 ? /* @__PURE__ */ jsx("div", {
902
902
  className: "px-3 py-2 text-sm text-slate-400 font-semibold",
903
- children: q.length < 2 ? "Type at least 2 characters to search..." : "No matches — press Enter to use this value"
903
+ children: "No matches — press Enter to use this value"
904
904
  }) : /* @__PURE__ */ jsxs(Fragment, { children: [displayed.map((opt, i) => /* @__PURE__ */ jsx("div", {
905
905
  id: optionId(i),
906
906
  role: "option",
@@ -2881,8 +2881,21 @@ function Pagination({ page, totalPages, onPageChange, ariaLabel = "Pagination",
2881
2881
  const rangeEnd = showRecordCount ? Math.min(page * pageSize, totalItems) : null;
2882
2882
  const pageNumbers = getPageNumbers(page, totalPages);
2883
2883
  return /* @__PURE__ */ jsxs("div", {
2884
- className: "flex flex-col items-center gap-1.5",
2885
- children: [totalPages > 1 && /* @__PURE__ */ jsx("nav", {
2884
+ className: "flex items-center justify-between gap-4",
2885
+ children: [showRecordCount ? /* @__PURE__ */ jsxs("p", {
2886
+ className: "text-[11px] font-bold tabular-nums text-slate-400",
2887
+ "aria-live": "polite",
2888
+ children: [
2889
+ "Showing ",
2890
+ rangeStart,
2891
+ "–",
2892
+ rangeEnd,
2893
+ " of ",
2894
+ totalItems,
2895
+ " ",
2896
+ itemLabel
2897
+ ]
2898
+ }) : /* @__PURE__ */ jsx("span", {}), totalPages > 1 && /* @__PURE__ */ jsx("nav", {
2886
2899
  "aria-label": ariaLabel,
2887
2900
  children: /* @__PURE__ */ jsxs("ol", {
2888
2901
  className: "list-none flex items-center gap-1",
@@ -2926,19 +2939,6 @@ function Pagination({ page, totalPages, onPageChange, ariaLabel = "Pagination",
2926
2939
  }) })
2927
2940
  ]
2928
2941
  })
2929
- }), showRecordCount && /* @__PURE__ */ jsxs("p", {
2930
- className: "text-[11px] font-bold tabular-nums text-slate-400",
2931
- "aria-live": "polite",
2932
- children: [
2933
- "Showing ",
2934
- rangeStart,
2935
- "–",
2936
- rangeEnd,
2937
- " of ",
2938
- totalItems,
2939
- " ",
2940
- itemLabel
2941
- ]
2942
2942
  })]
2943
2943
  });
2944
2944
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@diwauhris/ui",
3
3
  "private": false,
4
- "version": "1.7.2",
4
+ "version": "1.7.4",
5
5
  "type": "module",
6
6
  "description": "DIWA UHRIS UI component library — React + Tailwind CSS",
7
7
  "keywords": [
@@ -90,3 +90,5 @@
90
90
  "vite-plugin-dts": "^5.0.3"
91
91
  }
92
92
  }
93
+
94
+