@aivex/ui 1.1.0-dev.18 → 1.1.0-dev.19

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
@@ -9709,30 +9709,33 @@ function cd({ onClick: e, disabled: t, "aria-label": n, children: r }) {
9709
9709
  children: [/* @__PURE__ */ o(w, { variant: "default" }), r]
9710
9710
  });
9711
9711
  }
9712
- function ld({ page: e, isActive: t, onClick: n }) {
9712
+ function ld({ page: e, isActive: t, disabled: n, onClick: r }) {
9713
9713
  return /* @__PURE__ */ s("button", {
9714
9714
  type: "button",
9715
9715
  "aria-label": `Page ${e}`,
9716
9716
  "aria-current": t ? "page" : void 0,
9717
- onClick: n,
9718
- className: S("aivex:relative aivex:overflow-hidden aivex:group aivex:flex aivex:h-8 aivex:px-xs aivex:items-center aivex:justify-center aivex:rounded-full aivex:transition-colors", t ? "aivex:bg-bg-brand-subtle aivex:text-text-brand" : "aivex:text-text-secondary"),
9717
+ disabled: n,
9718
+ onClick: r,
9719
+ className: S("aivex:relative aivex:overflow-hidden aivex:group aivex:flex aivex:h-8 aivex:px-xs aivex:items-center aivex:justify-center aivex:rounded-full aivex:transition-colors aivex:disabled:opacity-disable aivex:disabled:pointer-events-none", t ? "aivex:bg-bg-brand-subtle aivex:text-text-brand" : "aivex:text-text-secondary"),
9719
9720
  children: [/* @__PURE__ */ o(w, { variant: t ? "strong" : "default" }), /* @__PURE__ */ o("span", {
9720
9721
  className: "aivex:relative aivex:min-w-6 aivex:text-center aivex:text-label-lg",
9721
9722
  children: e
9722
9723
  })]
9723
9724
  });
9724
9725
  }
9725
- function ud({ className: e, total: t, page: n, pageSize: r, pageSizeOptions: i, onChange: a, onPageSizeChange: c, ref: l, ...u }) {
9726
- let d = Math.max(1, Math.ceil(t / r)), f = Math.floor((n - 1) / 10), p = f * 10 + 1, m = Math.min(p + 9, d), h = Array.from({ length: m - p + 1 }, (e, t) => p + t), g = f === 0, _ = m === d, v = (e) => {
9727
- a?.(e);
9728
- }, y = (e) => {
9729
- c?.(Number(e)), a?.(1);
9726
+ function ud({ className: e, totalPages: t, page: n, pageSize: r, disabled: i, pageSizeOptions: a, onChange: c, onPageSizeChange: l, ref: u, ...d }) {
9727
+ let f = h(void 0);
9728
+ t != null && (f.current = t);
9729
+ let p = t ?? f.current;
9730
+ if (p == null) return null;
9731
+ let m = Math.max(1, p), g = Math.min(Math.max(1, n), m), _ = Math.floor((g - 1) / 10), v = _ * 10 + 1, y = Math.min(v + 9, m), b = Array.from({ length: y - v + 1 }, (e, t) => v + t), x = _ === 0, C = y === m, w = (e) => {
9732
+ l?.(Number(e));
9730
9733
  };
9731
9734
  return /* @__PURE__ */ s("nav", {
9732
- ref: l,
9735
+ ref: u,
9733
9736
  "aria-label": "Pagination",
9734
9737
  className: S("aivex:flex aivex:items-center", e),
9735
- ...u,
9738
+ ...d,
9736
9739
  children: [
9737
9740
  /* @__PURE__ */ o("div", { className: "aivex:flex-1" }),
9738
9741
  /* @__PURE__ */ s("div", {
@@ -9742,35 +9745,36 @@ function ud({ className: e, total: t, page: n, pageSize: r, pageSizeOptions: i,
9742
9745
  className: "aivex:flex aivex:gap-2",
9743
9746
  children: [/* @__PURE__ */ o(cd, {
9744
9747
  "aria-label": "First page",
9745
- disabled: g,
9746
- onClick: () => v(1),
9748
+ disabled: i || x,
9749
+ onClick: () => c(1),
9747
9750
  children: /* @__PURE__ */ o(nt, { size: 16 })
9748
9751
  }), /* @__PURE__ */ o(cd, {
9749
9752
  "aria-label": "Previous page group",
9750
- disabled: g,
9751
- onClick: () => v(p - 1),
9753
+ disabled: i || x,
9754
+ onClick: () => c(v - 10),
9752
9755
  children: /* @__PURE__ */ o(ot, { size: 16 })
9753
9756
  })]
9754
9757
  }),
9755
9758
  /* @__PURE__ */ o("div", {
9756
9759
  className: "aivex:flex aivex:gap-2",
9757
- children: h.map((e) => /* @__PURE__ */ o(ld, {
9760
+ children: b.map((e) => /* @__PURE__ */ o(ld, {
9758
9761
  page: e,
9759
- isActive: e === n,
9760
- onClick: () => v(e)
9762
+ isActive: e === g,
9763
+ disabled: i,
9764
+ onClick: () => c(e)
9761
9765
  }, e))
9762
9766
  }),
9763
9767
  /* @__PURE__ */ s("div", {
9764
9768
  className: "aivex:flex aivex:gap-2",
9765
9769
  children: [/* @__PURE__ */ o(cd, {
9766
9770
  "aria-label": "Next page group",
9767
- disabled: _,
9768
- onClick: () => v(m + 1),
9771
+ disabled: i || C,
9772
+ onClick: () => c(y + 1),
9769
9773
  children: /* @__PURE__ */ o(st, { size: 16 })
9770
9774
  }), /* @__PURE__ */ o(cd, {
9771
9775
  "aria-label": "Last page",
9772
- disabled: _,
9773
- onClick: () => v(d),
9776
+ disabled: i || C,
9777
+ onClick: () => c(m),
9774
9778
  children: /* @__PURE__ */ o(rt, { size: 16 })
9775
9779
  })]
9776
9780
  })
@@ -9778,15 +9782,16 @@ function ud({ className: e, total: t, page: n, pageSize: r, pageSizeOptions: i,
9778
9782
  }),
9779
9783
  /* @__PURE__ */ o("div", {
9780
9784
  className: "aivex:flex-1 aivex:flex aivex:items-center aivex:justify-end",
9781
- children: /* @__PURE__ */ o(sd, {
9785
+ children: a && /* @__PURE__ */ o(sd, {
9782
9786
  size: "sm",
9783
9787
  className: "aivex:w-[116px] aivex:shrink-0",
9784
9788
  value: String(r),
9785
- groups: [{ options: i.map(({ value: e, label: t }) => ({
9789
+ disabled: i,
9790
+ groups: [{ options: a.map(({ value: e, label: t }) => ({
9786
9791
  value: String(e),
9787
9792
  label: t
9788
9793
  })) }],
9789
- onChange: y
9794
+ onChange: w
9790
9795
  })
9791
9796
  })
9792
9797
  ]