wimui 0.63.4 → 0.64.0

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.
Files changed (32) hide show
  1. package/dist/components/ai/CodeDiffViewer/code-diff-viewer.module.cjs +1 -1
  2. package/dist/components/ai/CodeDiffViewer/code-diff-viewer.module.js +2 -2
  3. package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
  4. package/dist/components/data-display/Carousel/Carousel.d.ts +2 -0
  5. package/dist/components/data-display/Carousel/Carousel.js +119 -98
  6. package/dist/components/feedback/Tour/tour.module.cjs +1 -1
  7. package/dist/components/feedback/Tour/tour.module.js +1 -1
  8. package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
  9. package/dist/components/media/Lightbox/Lightbox.js +134 -116
  10. package/dist/components/navigation/CommandPalette/command-palette.module.cjs +1 -1
  11. package/dist/components/navigation/CommandPalette/command-palette.module.js +1 -1
  12. package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
  13. package/dist/components/navigation/Pagination/Pagination.d.ts +2 -0
  14. package/dist/components/navigation/Pagination/Pagination.js +169 -151
  15. package/dist/i18n/generated/common.cjs +1 -1
  16. package/dist/i18n/generated/common.d.ts +1 -1
  17. package/dist/i18n/generated/common.js +6 -3
  18. package/dist/i18n/generated/components.cjs +1 -1
  19. package/dist/i18n/generated/components.d.ts +1 -1
  20. package/dist/i18n/generated/components.js +9 -3
  21. package/dist/llms-full.txt +3 -3
  22. package/dist/llms.txt +1 -1
  23. package/dist/locales/en/common.json +2 -1
  24. package/dist/locales/en/components.json +3 -1
  25. package/dist/locales/ja/common.json +2 -1
  26. package/dist/locales/ja/components.json +3 -1
  27. package/dist/locales/pt/common.json +2 -1
  28. package/dist/locales/pt/components.json +3 -1
  29. package/dist/styles.css +1 -1
  30. package/dist/wimui.umd.css +1 -1
  31. package/dist/wimui.umd.js +2 -2
  32. package/package.json +1 -1
@@ -2,184 +2,202 @@
2
2
  import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
3
3
  import { useWimTranslation as n } from "../../../i18n/useWimTranslation.js";
4
4
  import { OverlayBase as r } from "../../_internal/OverlayBase.js";
5
- import { componentsNs as i } from "../../../i18n/generated/components.js";
6
- import a from "../../../icon/chevron-left.js";
7
- import o from "../../../icon/chevron-right.js";
8
- import s from "../../../icon/close.js";
9
- import c from "../../../icon/minus.js";
10
- import l from "../../../icon/plus.js";
11
- import { Icon as u } from "../Icon/Icon.js";
12
- import d from "./lightbox.module.js";
13
- import { createContext as f, useCallback as p, useContext as m, useEffect as h, useState as g } from "react";
14
- import _ from "classnames";
15
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
5
+ import { VisuallyHidden as i } from "../../layout/VisuallyHidden/VisuallyHidden.js";
6
+ import { componentsNs as a } from "../../../i18n/generated/components.js";
7
+ import o from "../../../icon/chevron-left.js";
8
+ import s from "../../../icon/chevron-right.js";
9
+ import c from "../../../icon/close.js";
10
+ import l from "../../../icon/minus.js";
11
+ import u from "../../../icon/plus.js";
12
+ import { Icon as d } from "../Icon/Icon.js";
13
+ import f from "./lightbox.module.js";
14
+ import { createContext as p, useCallback as m, useContext as h, useEffect as g, useState as _ } from "react";
15
+ import v from "classnames";
16
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
16
17
  //#region src/components/media/Lightbox/Lightbox.tsx
17
- var b = f(void 0), x = () => {
18
- let e = m(b);
18
+ var x = p(void 0), S = () => {
19
+ let e = h(x);
19
20
  if (!e) throw Error("Lightbox components must be used within Lightbox");
20
21
  return e;
21
- }, S = ({ children: e, open: t, onOpenChange: n, defaultOpen: r = !1, defaultIndex: i = 0 }) => {
22
- let [a, o] = g(r), [s, c] = g(i), [l, u] = g([]), d = t !== void 0, f = d ? t : a, m = p((e) => {
22
+ }, C = ({ children: e, open: t, onOpenChange: n, defaultOpen: r = !1, defaultIndex: i = 0 }) => {
23
+ let [a, o] = _(r), [s, c] = _(i), [l, u] = _([]), d = t !== void 0, f = d ? t : a, p = m((e) => {
23
24
  d || o(e), n?.(e);
24
- }, [d, n]), h = p((e) => {
25
+ }, [d, n]), h = m((e) => {
25
26
  let t = -1;
26
27
  return u((n) => (t = n.length, [...n, e])), t;
27
- }, []), _ = p((e) => {}, []);
28
- return /* @__PURE__ */ v(b.Provider, {
28
+ }, []), g = m((e) => {}, []);
29
+ return /* @__PURE__ */ y(x.Provider, {
29
30
  value: {
30
31
  open: f,
31
- setOpen: m,
32
+ setOpen: p,
32
33
  currentIndex: s,
33
34
  setCurrentIndex: c,
34
35
  items: l,
35
36
  setItems: u,
36
37
  registerItem: h,
37
- unregisterItem: _
38
+ unregisterItem: g
38
39
  },
39
40
  children: e
40
41
  });
41
- }, C = ({ children: r, className: a, onClick: o, asChild: s = !1, index: c, src: l, alt: u, caption: f, ...p }) => {
42
- let { setOpen: m, setCurrentIndex: h, items: g, setItems: y } = x(), { t: b } = n(i), S = (e) => {
42
+ }, w = ({ children: r, className: i, onClick: o, asChild: s = !1, index: c, src: l, alt: u, caption: d, ...p }) => {
43
+ let { setOpen: m, setCurrentIndex: h, items: g, setItems: _ } = S(), { t: b } = n(a), x = (e) => {
43
44
  if (o?.(e), c !== void 0) h(c);
44
45
  else if (l) {
45
46
  let e = g.findIndex((e) => e.src === l);
46
47
  if (e !== -1) h(e);
47
48
  else {
48
49
  let e = g.length;
49
- y((e) => [...e, {
50
+ _((e) => [...e, {
50
51
  src: l,
51
52
  alt: u,
52
- caption: f
53
+ caption: d
53
54
  }]), h(e);
54
55
  }
55
56
  }
56
57
  m(!0);
57
58
  }, C = s ? e : "button", w = c === void 0 ? void 0 : g[c]?.alt, T = p["aria-label"] !== void 0 || p["aria-labelledby"] !== void 0, E = u ?? w, D = T ? void 0 : E ? b("lightbox.open_named", { name: E }) : b("lightbox.open");
58
- return /* @__PURE__ */ v(C, {
59
+ return /* @__PURE__ */ y(C, {
59
60
  type: "button",
60
- className: _(d.trigger, a),
61
- onClick: S,
61
+ className: v(f.trigger, i),
62
+ onClick: x,
62
63
  "aria-label": D,
63
64
  ...p,
64
- children: /* @__PURE__ */ v(t, { children: r })
65
+ children: /* @__PURE__ */ y(t, { children: r })
65
66
  });
66
- }, w = ({ className: e, showCloseButton: t = !0, showNavigation: f = !0, showCounter: m = !0, closeOnOverlayClick: b = !0, ...S }) => {
67
- let { open: C, setOpen: w, currentIndex: T, setCurrentIndex: E, items: D } = x(), { t: O } = n(i), [k, A] = g(1), j = p(() => {
68
- E((T - 1 + D.length) % D.length), A(1);
67
+ }, T = ({ className: e, showCloseButton: t = !0, showNavigation: p = !0, showCounter: h = !0, closeOnOverlayClick: x = !0, ...C }) => {
68
+ let { open: w, setOpen: T, currentIndex: E, setCurrentIndex: D, items: O } = S(), { t: k } = n(a), [A, j] = _(1), [M, N] = _("");
69
+ !w && M && N("");
70
+ let P = m((e) => {
71
+ let t = O[e], n = t?.title || t?.alt, r = k("lightbox.image_status", {
72
+ current: e + 1,
73
+ total: O.length
74
+ });
75
+ N(n ? `${r}: ${n}` : r), D(e), j(1);
69
76
  }, [
70
- T,
71
- D.length,
72
- E
73
- ]), M = p(() => {
74
- E((T + 1) % D.length), A(1);
77
+ O,
78
+ D,
79
+ k
80
+ ]), F = m(() => {
81
+ P((E - 1 + O.length) % O.length);
75
82
  }, [
76
- T,
77
- D.length,
78
- E
79
- ]), N = () => {
80
- A((e) => e === 1 ? 2 : 1);
83
+ E,
84
+ O.length,
85
+ P
86
+ ]), I = m(() => {
87
+ P((E + 1) % O.length);
88
+ }, [
89
+ E,
90
+ O.length,
91
+ P
92
+ ]), L = () => {
93
+ j((e) => e === 1 ? 2 : 1);
81
94
  };
82
- h(() => {
83
- if (!C) return;
95
+ g(() => {
96
+ if (!w) return;
84
97
  let e = (e) => {
85
- e.key === "ArrowLeft" && j(), e.key === "ArrowRight" && M(), e.key === "Escape" && w(!1);
98
+ e.key === "ArrowLeft" && F(), e.key === "ArrowRight" && I(), e.key === "Escape" && T(!1);
86
99
  };
87
100
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
88
101
  }, [
89
- C,
90
- j,
91
- M,
92
- w
102
+ w,
103
+ F,
104
+ I,
105
+ T
93
106
  ]);
94
- let P = D[T];
95
- return P ? /* @__PURE__ */ v(r, {
96
- ...S,
97
- open: C,
98
- onOpenChange: w,
99
- closeOnOverlayClick: b,
100
- overlayClassName: d.overlay,
101
- className: _("wim-lightbox", d.contentRoot, e),
102
- "aria-label": S["aria-labelledby"] ? void 0 : S["aria-label"] ?? (P.title || P.alt || O("lightbox.dialog")),
107
+ let R = O[E];
108
+ return R ? /* @__PURE__ */ y(r, {
109
+ ...C,
110
+ open: w,
111
+ onOpenChange: T,
112
+ closeOnOverlayClick: x,
113
+ overlayClassName: f.overlay,
114
+ className: v("wim-lightbox", f.contentRoot, e),
115
+ "aria-label": C["aria-labelledby"] ? void 0 : C["aria-label"] ?? (R.title || R.alt || k("lightbox.dialog")),
103
116
  transitionProps: {
104
117
  preset: "fade",
105
- enter: d.contentEnter,
106
- enterFrom: d.contentEnterFrom,
107
- enterTo: d.contentEnterTo
118
+ enter: f.contentEnter,
119
+ enterFrom: f.contentEnterFrom,
120
+ enterTo: f.contentEnterTo
108
121
  },
109
- children: /* @__PURE__ */ y("div", {
110
- className: d.container,
122
+ children: /* @__PURE__ */ b("div", {
123
+ className: f.container,
111
124
  children: [
112
- /* @__PURE__ */ y("div", {
113
- className: d.header,
114
- children: [m && D.length > 1 && /* @__PURE__ */ v("div", {
115
- className: d.counter,
116
- children: O("lightbox.counter", {
117
- current: T + 1,
118
- total: D.length
125
+ /* @__PURE__ */ y(i, {
126
+ role: "status",
127
+ "aria-atomic": "true",
128
+ children: M
129
+ }),
130
+ /* @__PURE__ */ b("div", {
131
+ className: f.header,
132
+ children: [h && O.length > 1 && /* @__PURE__ */ y("div", {
133
+ className: f.counter,
134
+ children: k("lightbox.counter", {
135
+ current: E + 1,
136
+ total: O.length
119
137
  })
120
- }), /* @__PURE__ */ y("div", {
121
- className: d.controls,
122
- children: [/* @__PURE__ */ v("button", {
123
- className: d.iconButton,
124
- onClick: N,
125
- "aria-label": O(k > 1 ? "lightbox.zoom_out" : "lightbox.zoom_in"),
126
- children: k > 1 ? /* @__PURE__ */ v(u, { component: c }) : /* @__PURE__ */ v(u, { component: l })
127
- }), t && /* @__PURE__ */ v("button", {
128
- className: d.iconButton,
129
- onClick: () => w(!1),
130
- "aria-label": O("lightbox.close"),
131
- children: /* @__PURE__ */ v(u, { component: s })
138
+ }), /* @__PURE__ */ b("div", {
139
+ className: f.controls,
140
+ children: [/* @__PURE__ */ y("button", {
141
+ className: f.iconButton,
142
+ onClick: L,
143
+ "aria-label": k(A > 1 ? "lightbox.zoom_out" : "lightbox.zoom_in"),
144
+ children: A > 1 ? /* @__PURE__ */ y(d, { component: l }) : /* @__PURE__ */ y(d, { component: u })
145
+ }), t && /* @__PURE__ */ y("button", {
146
+ className: f.iconButton,
147
+ onClick: () => T(!1),
148
+ "aria-label": k("lightbox.close"),
149
+ children: /* @__PURE__ */ y(d, { component: c })
132
150
  })]
133
151
  })]
134
152
  }),
135
- /* @__PURE__ */ y("div", {
136
- className: d.viewport,
153
+ /* @__PURE__ */ b("div", {
154
+ className: f.viewport,
137
155
  children: [
138
- f && D.length > 1 && /* @__PURE__ */ v("button", {
139
- className: _(d.navButton, d.prev),
140
- onClick: j,
141
- "aria-label": O("lightbox.previous"),
142
- children: /* @__PURE__ */ v(u, { component: a })
156
+ p && O.length > 1 && /* @__PURE__ */ y("button", {
157
+ className: v(f.navButton, f.prev),
158
+ onClick: F,
159
+ "aria-label": k("lightbox.previous"),
160
+ children: /* @__PURE__ */ y(d, { component: o })
143
161
  }),
144
- /* @__PURE__ */ v("div", {
145
- className: d.mediaWrapper,
146
- style: { transform: `scale(${k})` },
147
- children: /* @__PURE__ */ v("img", {
148
- src: P.src,
149
- alt: P.alt || "",
150
- className: d.image
162
+ /* @__PURE__ */ y("div", {
163
+ className: f.mediaWrapper,
164
+ style: { transform: `scale(${A})` },
165
+ children: /* @__PURE__ */ y("img", {
166
+ src: R.src,
167
+ alt: R.alt || "",
168
+ className: f.image
151
169
  })
152
170
  }),
153
- f && D.length > 1 && /* @__PURE__ */ v("button", {
154
- className: _(d.navButton, d.next),
155
- onClick: M,
156
- "aria-label": O("lightbox.next"),
157
- children: /* @__PURE__ */ v(u, { component: o })
171
+ p && O.length > 1 && /* @__PURE__ */ y("button", {
172
+ className: v(f.navButton, f.next),
173
+ onClick: I,
174
+ "aria-label": k("lightbox.next"),
175
+ children: /* @__PURE__ */ y(d, { component: s })
158
176
  })
159
177
  ]
160
178
  }),
161
- (P.title || P.caption) && /* @__PURE__ */ y("div", {
162
- className: d.footer,
163
- children: [P.title && /* @__PURE__ */ v("h3", {
164
- className: d.title,
165
- children: P.title
166
- }), P.caption && /* @__PURE__ */ v("p", {
167
- className: d.caption,
168
- children: P.caption
179
+ (R.title || R.caption) && /* @__PURE__ */ b("div", {
180
+ className: f.footer,
181
+ children: [R.title && /* @__PURE__ */ y("h3", {
182
+ className: f.title,
183
+ children: R.title
184
+ }), R.caption && /* @__PURE__ */ y("p", {
185
+ className: f.caption,
186
+ children: R.caption
169
187
  })]
170
188
  })
171
189
  ]
172
190
  })
173
191
  }) : null;
174
- }, T = ({ items: e, children: t }) => {
175
- let { setItems: n } = x();
176
- return h(() => {
192
+ }, E = ({ items: e, children: t }) => {
193
+ let { setItems: n } = S();
194
+ return g(() => {
177
195
  n(e);
178
- }, [e, n]), /* @__PURE__ */ v("div", {
179
- className: d.gallery,
196
+ }, [e, n]), /* @__PURE__ */ y("div", {
197
+ className: f.gallery,
180
198
  children: t
181
199
  });
182
- }, E = S;
183
- E.Trigger = C, E.Content = w, E.Gallery = T, E.displayName = "Lightbox", C.displayName = "Lightbox.Trigger", w.displayName = "Lightbox.Content", T.displayName = "Lightbox.Gallery";
200
+ }, D = C;
201
+ D.Trigger = w, D.Content = T, D.Gallery = E, D.displayName = "Lightbox", w.displayName = "Lightbox.Trigger", T.displayName = "Lightbox.Content", E.displayName = "Lightbox.Gallery";
184
202
  //#endregion
185
- export { S as Lightbox, w as LightboxContent, T as LightboxGallery, E as LightboxRoot, E as default, C as LightboxTrigger, x as useLightbox };
203
+ export { C as Lightbox, T as LightboxContent, E as LightboxGallery, D as LightboxRoot, D as default, w as LightboxTrigger, S as useLightbox };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_overlay_6u2zl_23`,t=`_content_6u2zl_39`,n=`_slideIn_6u2zl_1`,r=`_inputWrapper_6u2zl_68`,i=`_inputRight_6u2zl_107`,a=`_input_6u2zl_68`,o=`_list_6u2zl_126`,s=`_group_6u2zl_136`,c=`_groupHeading_6u2zl_142`,l=`_item_6u2zl_150`,u=`_active_6u2zl_153`,d=`_shortcut_6u2zl_157`,f=`_empty_6u2zl_166`,p=`_footer_6u2zl_172`,m=`_kbd_6u2zl_186`,h=`_trigger_6u2zl_195`,g={overlay:e,content:t,slideIn:n,inputWrapper:r,inputRight:i,input:a,list:o,group:s,groupHeading:c,item:l,active:u,shortcut:d,empty:f,footer:p,kbd:m,trigger:h};exports.active=u,exports.content=t,exports.default=g,exports.empty=f,exports.footer=p,exports.group=s,exports.groupHeading=c,exports.input=a,exports.inputRight=i,exports.inputWrapper=r,exports.item=l,exports.kbd=m,exports.list=o,exports.overlay=e,exports.shortcut=d,exports.slideIn=n,exports.trigger=h;
2
+ var e=`_overlay_zrsc3_23`,t=`_content_zrsc3_39`,n=`_slideIn_zrsc3_1`,r=`_inputWrapper_zrsc3_68`,i=`_inputRight_zrsc3_107`,a=`_input_zrsc3_68`,o=`_list_zrsc3_126`,s=`_group_zrsc3_136`,c=`_groupHeading_zrsc3_142`,l=`_item_zrsc3_150`,u=`_active_zrsc3_153`,d=`_shortcut_zrsc3_157`,f=`_empty_zrsc3_166`,p=`_footer_zrsc3_172`,m=`_kbd_zrsc3_186`,h=`_trigger_zrsc3_195`,g={overlay:e,content:t,slideIn:n,inputWrapper:r,inputRight:i,input:a,list:o,group:s,groupHeading:c,item:l,active:u,shortcut:d,empty:f,footer:p,kbd:m,trigger:h};exports.active=u,exports.content=t,exports.default=g,exports.empty=f,exports.footer=p,exports.group=s,exports.groupHeading=c,exports.input=a,exports.inputRight=i,exports.inputWrapper=r,exports.item=l,exports.kbd=m,exports.list=o,exports.overlay=e,exports.shortcut=d,exports.slideIn=n,exports.trigger=h;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  //#region src/components/navigation/CommandPalette/command-palette.module.scss
3
- var e = "_overlay_6u2zl_23", t = "_content_6u2zl_39", n = "_slideIn_6u2zl_1", r = "_inputWrapper_6u2zl_68", i = "_inputRight_6u2zl_107", a = "_input_6u2zl_68", o = "_list_6u2zl_126", s = "_group_6u2zl_136", c = "_groupHeading_6u2zl_142", l = "_item_6u2zl_150", u = "_active_6u2zl_153", d = "_shortcut_6u2zl_157", f = "_empty_6u2zl_166", p = "_footer_6u2zl_172", m = "_kbd_6u2zl_186", h = "_trigger_6u2zl_195", g = {
3
+ var e = "_overlay_zrsc3_23", t = "_content_zrsc3_39", n = "_slideIn_zrsc3_1", r = "_inputWrapper_zrsc3_68", i = "_inputRight_zrsc3_107", a = "_input_zrsc3_68", o = "_list_zrsc3_126", s = "_group_zrsc3_136", c = "_groupHeading_zrsc3_142", l = "_item_zrsc3_150", u = "_active_zrsc3_153", d = "_shortcut_zrsc3_157", f = "_empty_zrsc3_166", p = "_footer_zrsc3_172", m = "_kbd_zrsc3_186", h = "_trigger_zrsc3_195", g = {
4
4
  overlay: e,
5
5
  content: t,
6
6
  slideIn: n,
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../../i18n/generated/common.cjs"),i=require("../../../icon/chevron-left.cjs"),a=require("../../../icon/chevron-right.cjs"),o=require("../../media/Icon/Icon.cjs"),s=require("../../form/Button/Button.cjs"),c=require("../../form/Input/Input.cjs"),l=require("../../form/Select/Select.cjs"),u=require("./pagination.module.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("classnames");f=e.__toESM(f,1);let p=require("react/jsx-runtime");var m=d.default.forwardRef(({asChild:e=!1,className:n,children:r,page:i,isActive:a,...o},s)=>(0,p.jsx)(e?t.Root:`button`,{ref:s,type:e?void 0:`button`,className:(0,f.default)(u.default.button,n),"aria-current":a?`page`:void 0,...o,children:e?(0,p.jsx)(t.Slottable,{children:r}):r}));m.displayName=`PaginationPage`;var h=`...`,g=({total:e,pageSize:g=10,current:_=1,onChange:v,onPageSizeChange:y,siblingCount:b=1,className:x,asChild:S=!1,children:C,renderPage:w,hideOnSinglePage:T=!1,simple:E=!1,showSizeChanger:D=!1,pageSizeOptions:ee=[10,20,50,100],showTotal:O,showQuickJumper:k=!1,labels:A={},"aria-label":j,"aria-labelledby":M})=>{let{t:N}=n.useWimTranslation(r.commonNs),{prevPage:P=N(`a11y.go_to_prev_page`),nextPage:F=N(`a11y.go_to_next_page`),pageAriaLabel:I=e=>N(`a11y.go_to_page`,{page:String(e)}),itemsPerPage:L=N(`pagination.items_per_page`),goTo:R=N(`pagination.go_to`),go:z=N(`pagination.go`),pageSizeAriaLabel:B=N(`a11y.items_per_page`),jumpToPageAriaLabel:V=N(`a11y.jump_to_page`),navAriaLabel:H=N(`a11y.pagination_nav`)}=A,[U,W]=(0,d.useState)(g),[G,K]=(0,d.useState)(``),q=U,J=Math.ceil(e/q),Y=(0,d.useMemo)(()=>{if(b+5>=J)return Array.from({length:J},(e,t)=>t+1);let e=Math.max(_-b,1),t=Math.min(_+b,J),n=e>2,r=t<J-2,i=J;if(!n&&r){let e=3+2*b;return[...Array.from({length:e},(e,t)=>t+1),h,J]}if(n&&!r){let e=3+2*b;return[1,h,...Array.from({length:e},(t,n)=>J-e+n+1)]}return n&&r?[1,h,...Array.from({length:t-e+1},(t,n)=>e+n),h,i]:[]},[J,b,_]);if(T&&J<=1)return null;let X=e=>{e<1||e>J||e===_||v?.(e,q)},Z=e=>{W(e),y?.(e),v?.(1,e)},Q=()=>{let e=parseInt(G);!isNaN(e)&&e>=1&&e<=J&&(X(e),K(``))},te=e=>{e.key===`Enter`&&Q()},ne=(_-1)*q+1,re=Math.min(_*q,e),$=S?t.Root:`nav`,ie=e=>{let t={page:e,isActive:e===_,onClick:()=>X(e),"aria-label":I(e)};return w?w(e,t):(0,p.jsx)(m,{...t,children:e})};return E?(0,p.jsxs)($,{className:(0,f.default)(`wim-pagination`,u.default.root,u.default.simple,x),"aria-label":M?void 0:j??H,"aria-labelledby":M,children:[(0,p.jsx)(t.Slottable,{children:C}),(0,p.jsxs)(`ul`,{className:u.default.root,children:[(0,p.jsx)(`li`,{className:(0,f.default)(u.default.item,_===1&&u.default.disabled),children:(0,p.jsx)(`button`,{className:u.default.button,onClick:()=>X(_-1),disabled:_===1,"aria-label":P,children:(0,p.jsx)(o.Icon,{component:i.default,size:`sm`})})}),(0,p.jsx)(`li`,{className:(0,f.default)(u.default.item,u.default.simplePager),children:(0,p.jsxs)(`span`,{children:[_,` / `,J]})}),(0,p.jsx)(`li`,{className:(0,f.default)(u.default.item,_===J&&u.default.disabled),children:(0,p.jsx)(`button`,{className:u.default.button,onClick:()=>X(_+1),disabled:_===J,"aria-label":F,children:(0,p.jsx)(o.Icon,{component:a.default,size:`sm`})})})]})]}):(0,p.jsx)(`div`,{className:(0,f.default)(`wim-pagination`,u.default.container,x),children:(0,p.jsxs)(`div`,{className:u.default.wrapper,children:[O&&(0,p.jsx)(`div`,{className:u.default.total,children:O(e,[ne,re])}),(0,p.jsxs)($,{className:u.default.root,"aria-label":M?void 0:j??H,"aria-labelledby":M,children:[(0,p.jsx)(t.Slottable,{children:C}),(0,p.jsxs)(`ul`,{className:u.default.root,children:[(0,p.jsx)(`li`,{className:(0,f.default)(u.default.item,_===1&&u.default.disabled),children:(0,p.jsx)(`button`,{className:u.default.button,onClick:()=>X(_-1),disabled:_===1,"aria-label":P,children:(0,p.jsx)(o.Icon,{component:i.default,size:`sm`})})}),(0,p.jsx)(`li`,{className:(0,f.default)(u.default.item,u.default.mobileIndicator),children:(0,p.jsxs)(`span`,{children:[_,` / `,J]})}),Y.map((e,t)=>e===h?(0,p.jsx)(`li`,{className:(0,f.default)(u.default.item,u.default.ellipsis),"aria-hidden":`true`,children:h},`ellipsis-${t}`):(0,p.jsx)(`li`,{className:(0,f.default)(u.default.item,u.default.number,e===_&&u.default.active),children:ie(e)},e)),(0,p.jsx)(`li`,{className:(0,f.default)(u.default.item,_===J&&u.default.disabled),children:(0,p.jsx)(`button`,{className:u.default.button,onClick:()=>X(_+1),disabled:_===J,"aria-label":F,children:(0,p.jsx)(o.Icon,{component:a.default,size:`sm`})})})]})]}),D&&(0,p.jsx)(`div`,{className:u.default.sizeChanger,children:(0,p.jsx)(l.Select,{value:String(q),onChange:e=>Z(Number(e)),options:ee.map(e=>({label:`${e} ${L}`,value:String(e)})),width:`auto`,"aria-label":B})}),k&&(0,p.jsxs)(`div`,{className:u.default.quickJumper,children:[(0,p.jsx)(`span`,{children:R}),(0,p.jsx)(c.Input,{type:`number`,min:1,max:J,value:G,onChange:e=>K(e.target.value),onKeyDown:te,width:`60px`,"aria-label":V}),(0,p.jsx)(s.Button,{size:`sm`,variant:`outline`,onClick:Q,disabled:!G,children:z})]})]})})};exports.Pagination=g,exports.default=g,exports.PaginationPage=m;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../../i18n/generated/common.cjs"),i=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),a=require("../../../icon/chevron-left.cjs"),o=require("../../../icon/chevron-right.cjs"),s=require("../../media/Icon/Icon.cjs"),ee=require("../../form/Button/Button.cjs"),te=require("../../form/Input/Input.cjs"),c=require("../../form/Select/Select.cjs"),l=require("./pagination.module.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("classnames");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=u.default.forwardRef(({asChild:e=!1,className:n,children:r,page:i,isActive:a,...o},s)=>(0,f.jsx)(e?t.Root:`button`,{ref:s,type:e?void 0:`button`,className:(0,d.default)(l.default.button,n),"aria-current":a?`page`:void 0,...o,children:e?(0,f.jsx)(t.Slottable,{children:r}):r}));p.displayName=`PaginationPage`;var m=`...`,h=({total:e,pageSize:h=10,current:g=1,onChange:_,onPageSizeChange:v,siblingCount:y=1,className:b,asChild:x=!1,children:S,renderPage:C,hideOnSinglePage:w=!1,simple:ne=!1,showSizeChanger:re=!1,pageSizeOptions:T=[10,20,50,100],showTotal:E,showQuickJumper:D=!1,labels:O={},"aria-label":k,"aria-labelledby":A})=>{let{t:j}=n.useWimTranslation(r.commonNs),{prevPage:M=j(`a11y.go_to_prev_page`),nextPage:N=j(`a11y.go_to_next_page`),pageAriaLabel:P=e=>j(`a11y.go_to_page`,{page:String(e)}),itemsPerPage:F=j(`pagination.items_per_page`),goTo:I=j(`pagination.go_to`),go:L=j(`pagination.go`),pageSizeAriaLabel:R=j(`a11y.items_per_page`),jumpToPageAriaLabel:z=j(`a11y.jump_to_page`),navAriaLabel:B=j(`a11y.pagination_nav`),pageStatus:V=(e,t)=>j(`pagination.page_status`,{current:String(e),total:String(t)})}=O,[H,U]=(0,u.useState)(h),[W,G]=(0,u.useState)(``),K=H,q=Math.ceil(e/K),[J,Y]=(0,u.useState)(g),[ie,ae]=(0,u.useState)(``);g!==J&&(Y(g),ae(V(g,q)));let X=(0,f.jsx)(i.VisuallyHidden,{role:`status`,"aria-atomic":`true`,children:ie}),oe=(0,u.useMemo)(()=>{if(y+5>=q)return Array.from({length:q},(e,t)=>t+1);let e=Math.max(g-y,1),t=Math.min(g+y,q),n=e>2,r=t<q-2,i=q;if(!n&&r){let e=3+2*y;return[...Array.from({length:e},(e,t)=>t+1),m,q]}if(n&&!r){let e=3+2*y;return[1,m,...Array.from({length:e},(t,n)=>q-e+n+1)]}return n&&r?[1,m,...Array.from({length:t-e+1},(t,n)=>e+n),m,i]:[]},[q,y,g]);if(w&&q<=1)return null;let Z=e=>{e<1||e>q||e===g||_?.(e,K)},se=e=>{U(e),v?.(e),_?.(1,e)},Q=()=>{let e=parseInt(W);!isNaN(e)&&e>=1&&e<=q&&(Z(e),G(``))},ce=e=>{e.key===`Enter`&&Q()},le=(g-1)*K+1,ue=Math.min(g*K,e),$=x?t.Root:`nav`,de=e=>{let t={page:e,isActive:e===g,onClick:()=>Z(e),"aria-label":P(e)};return C?C(e,t):(0,f.jsx)(p,{...t,children:e})};return ne?(0,f.jsxs)($,{className:(0,d.default)(`wim-pagination`,l.default.root,l.default.simple,b),"aria-label":A?void 0:k??B,"aria-labelledby":A,children:[(0,f.jsx)(t.Slottable,{children:S}),X,(0,f.jsxs)(`ul`,{className:l.default.root,children:[(0,f.jsx)(`li`,{className:(0,d.default)(l.default.item,g===1&&l.default.disabled),children:(0,f.jsx)(`button`,{className:l.default.button,onClick:()=>Z(g-1),disabled:g===1,"aria-label":M,children:(0,f.jsx)(s.Icon,{component:a.default,size:`sm`})})}),(0,f.jsx)(`li`,{className:(0,d.default)(l.default.item,l.default.simplePager),children:(0,f.jsxs)(`span`,{children:[g,` / `,q]})}),(0,f.jsx)(`li`,{className:(0,d.default)(l.default.item,g===q&&l.default.disabled),children:(0,f.jsx)(`button`,{className:l.default.button,onClick:()=>Z(g+1),disabled:g===q,"aria-label":N,children:(0,f.jsx)(s.Icon,{component:o.default,size:`sm`})})})]})]}):(0,f.jsx)(`div`,{className:(0,d.default)(`wim-pagination`,l.default.container,b),children:(0,f.jsxs)(`div`,{className:l.default.wrapper,children:[E&&(0,f.jsx)(`div`,{className:l.default.total,children:E(e,[le,ue])}),(0,f.jsxs)($,{className:l.default.root,"aria-label":A?void 0:k??B,"aria-labelledby":A,children:[(0,f.jsx)(t.Slottable,{children:S}),X,(0,f.jsxs)(`ul`,{className:l.default.root,children:[(0,f.jsx)(`li`,{className:(0,d.default)(l.default.item,g===1&&l.default.disabled),children:(0,f.jsx)(`button`,{className:l.default.button,onClick:()=>Z(g-1),disabled:g===1,"aria-label":M,children:(0,f.jsx)(s.Icon,{component:a.default,size:`sm`})})}),(0,f.jsx)(`li`,{className:(0,d.default)(l.default.item,l.default.mobileIndicator),children:(0,f.jsxs)(`span`,{children:[g,` / `,q]})}),oe.map((e,t)=>e===m?(0,f.jsx)(`li`,{className:(0,d.default)(l.default.item,l.default.ellipsis),"aria-hidden":`true`,children:m},`ellipsis-${t}`):(0,f.jsx)(`li`,{className:(0,d.default)(l.default.item,l.default.number,e===g&&l.default.active),children:de(e)},e)),(0,f.jsx)(`li`,{className:(0,d.default)(l.default.item,g===q&&l.default.disabled),children:(0,f.jsx)(`button`,{className:l.default.button,onClick:()=>Z(g+1),disabled:g===q,"aria-label":N,children:(0,f.jsx)(s.Icon,{component:o.default,size:`sm`})})})]})]}),re&&(0,f.jsx)(`div`,{className:l.default.sizeChanger,children:(0,f.jsx)(c.Select,{value:String(K),onChange:e=>se(Number(e)),options:T.map(e=>({label:`${e} ${F}`,value:String(e)})),width:`auto`,"aria-label":R})}),D&&(0,f.jsxs)(`div`,{className:l.default.quickJumper,children:[(0,f.jsx)(`span`,{children:I}),(0,f.jsx)(te.Input,{type:`number`,min:1,max:q,value:W,onChange:e=>G(e.target.value),onKeyDown:ce,width:`60px`,"aria-label":z}),(0,f.jsx)(ee.Button,{size:`sm`,variant:`outline`,onClick:Q,disabled:!W,children:L})]})]})})};exports.Pagination=h,exports.default=h,exports.PaginationPage=p;
@@ -76,6 +76,8 @@ export interface PaginationProps {
76
76
  jumpToPageAriaLabel?: string;
77
77
  navAriaLabel?: string;
78
78
  totalLabel?: string;
79
+ /** Announced to screen readers when the page changes. Receives the current page and the page count. */
80
+ pageStatus?: (current: number, totalPages: number) => string;
79
81
  };
80
82
  /** Accessible name for the navigation landmark. Takes precedence over `labels.navAriaLabel`. */
81
83
  "aria-label"?: string;