@geomak/ui 7.2.1 → 7.2.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.js CHANGED
@@ -5478,23 +5478,12 @@ function Pagination({
5478
5478
  onPageChange,
5479
5479
  maxPage,
5480
5480
  options,
5481
- onPerPageChange,
5482
- serverSide = false
5481
+ perPage,
5482
+ onPerPageChange
5483
5483
  }) {
5484
5484
  const picker = options.pickerOptions ?? DEFAULT_PICKER;
5485
- const matchedOption = picker.find(
5486
- (o) => o.label === options.perPage || o.value === options.perPage
5487
- );
5488
- const [perPageKey, setPerPageKey] = useState(() => matchedOption?.key ?? picker[0]?.key);
5489
- const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
5490
- useEffect(() => {
5491
- if (serverSide && options.perPage != null) {
5492
- const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
5493
- if (next) setPerPageKey(next.key);
5494
- }
5495
- }, [serverSide, options.perPage, picker]);
5496
- const currentOpt = picker.find((o) => o.key === displayPerPageKey);
5497
- const currentPerPageLabel = currentOpt?.label ?? currentOpt?.value ?? options.perPage ?? "";
5485
+ const currentOpt = picker.find((o) => o.value === perPage || o.label === perPage);
5486
+ const currentPerPageLabel = currentOpt?.label ?? currentOpt?.value ?? perPage ?? "";
5498
5487
  const FOCUS = "focus-visible:!ring-0 focus-visible:!border-accent";
5499
5488
  const navBtn = (icon, disabled, onClick, title) => /* @__PURE__ */ jsx(Button_default, { variant: "outline", size: "sm", disabled, onClick, icon, className: `w-7 !px-0 ${FOCUS}`, "aria-label": title, title });
5500
5489
  const chevronRight = /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" }) });
@@ -5513,10 +5502,7 @@ function Pagination({
5513
5502
  items: picker.map((o) => ({
5514
5503
  key: o.key,
5515
5504
  label: String(o.label ?? o.value ?? o.key),
5516
- onSelect: () => {
5517
- if (!serverSide) setPerPageKey(o.key);
5518
- onPerPageChange(o.label ?? o.value ?? o.key);
5519
- }
5505
+ onSelect: () => onPerPageChange(o.value ?? o.label ?? o.key)
5520
5506
  }))
5521
5507
  }
5522
5508
  )
@@ -5656,9 +5642,9 @@ function Table({
5656
5642
  activePage,
5657
5643
  onPageChange: handlePageChange,
5658
5644
  maxPage: MAX_PAGE,
5645
+ perPage,
5659
5646
  onPerPageChange: onPaginationChange,
5660
- options: pagination,
5661
- serverSide: isServerSide
5647
+ options: pagination
5662
5648
  }
5663
5649
  );
5664
5650
  return /* @__PURE__ */ jsxs("div", { className: `w-full h-max rounded-lg ${className}`.trim(), style, children: [