@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.cjs CHANGED
@@ -5515,23 +5515,12 @@ function Pagination({
5515
5515
  onPageChange,
5516
5516
  maxPage,
5517
5517
  options,
5518
- onPerPageChange,
5519
- serverSide = false
5518
+ perPage,
5519
+ onPerPageChange
5520
5520
  }) {
5521
5521
  const picker = options.pickerOptions ?? DEFAULT_PICKER;
5522
- const matchedOption = picker.find(
5523
- (o) => o.label === options.perPage || o.value === options.perPage
5524
- );
5525
- const [perPageKey, setPerPageKey] = React29.useState(() => matchedOption?.key ?? picker[0]?.key);
5526
- const displayPerPageKey = serverSide ? matchedOption?.key ?? perPageKey : perPageKey;
5527
- React29.useEffect(() => {
5528
- if (serverSide && options.perPage != null) {
5529
- const next = picker.find((o) => o.label === options.perPage || o.value === options.perPage);
5530
- if (next) setPerPageKey(next.key);
5531
- }
5532
- }, [serverSide, options.perPage, picker]);
5533
- const currentOpt = picker.find((o) => o.key === displayPerPageKey);
5534
- const currentPerPageLabel = currentOpt?.label ?? currentOpt?.value ?? options.perPage ?? "";
5522
+ const currentOpt = picker.find((o) => o.value === perPage || o.label === perPage);
5523
+ const currentPerPageLabel = currentOpt?.label ?? currentOpt?.value ?? perPage ?? "";
5535
5524
  const FOCUS = "focus-visible:!ring-0 focus-visible:!border-accent";
5536
5525
  const navBtn = (icon, disabled, onClick, title) => /* @__PURE__ */ jsxRuntime.jsx(Button_default, { variant: "outline", size: "sm", disabled, onClick, icon, className: `w-7 !px-0 ${FOCUS}`, "aria-label": title, title });
5537
5526
  const chevronRight = /* @__PURE__ */ jsxRuntime.jsx("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" }) });
@@ -5550,10 +5539,7 @@ function Pagination({
5550
5539
  items: picker.map((o) => ({
5551
5540
  key: o.key,
5552
5541
  label: String(o.label ?? o.value ?? o.key),
5553
- onSelect: () => {
5554
- if (!serverSide) setPerPageKey(o.key);
5555
- onPerPageChange(o.label ?? o.value ?? o.key);
5556
- }
5542
+ onSelect: () => onPerPageChange(o.value ?? o.label ?? o.key)
5557
5543
  }))
5558
5544
  }
5559
5545
  )
@@ -5693,9 +5679,9 @@ function Table({
5693
5679
  activePage,
5694
5680
  onPageChange: handlePageChange,
5695
5681
  maxPage: MAX_PAGE,
5682
+ perPage,
5696
5683
  onPerPageChange: onPaginationChange,
5697
- options: pagination,
5698
- serverSide: isServerSide
5684
+ options: pagination
5699
5685
  }
5700
5686
  );
5701
5687
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `w-full h-max rounded-lg ${className}`.trim(), style, children: [