@sytechui/pagination 2.2.27

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 ADDED
@@ -0,0 +1,589 @@
1
+ "use client";
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/index.ts
32
+ var index_exports = {};
33
+ __export(index_exports, {
34
+ Pagination: () => pagination_default,
35
+ PaginationCursor: () => pagination_cursor_default,
36
+ PaginationItem: () => pagination_item_default,
37
+ PaginationItemType: () => import_use_pagination5.PaginationItemType,
38
+ usePagination: () => usePagination,
39
+ usePaginationItem: () => usePaginationItem
40
+ });
41
+ module.exports = __toCommonJS(index_exports);
42
+
43
+ // src/pagination.tsx
44
+ var import_react3 = require("react");
45
+ var import_i18n = require("@react-aria/i18n");
46
+ var import_system4 = require("@sytechui/system");
47
+ var import_use_pagination3 = require("@sytechui/use-pagination");
48
+ var import_shared_icons = require("@sytechui/shared-icons");
49
+ var import_shared_utils4 = require("@sytechui/shared-utils");
50
+ var import_theme3 = require("@sytechui/theme");
51
+
52
+ // src/use-pagination.ts
53
+ var import_shared_utils = require("@sytechui/shared-utils");
54
+ var import_use_pagination = require("@sytechui/use-pagination");
55
+ var import_react = require("react");
56
+ var import_system = require("@sytechui/system");
57
+ var import_use_pagination2 = require("@sytechui/use-pagination");
58
+ var import_scroll_into_view_if_needed = __toESM(require("scroll-into-view-if-needed"));
59
+ var import_theme = require("@sytechui/theme");
60
+ var import_react_utils = require("@sytechui/react-utils");
61
+ var import_shared_utils2 = require("@sytechui/shared-utils");
62
+ var import_use_intersection_observer = require("@sytechui/use-intersection-observer");
63
+ var CURSOR_TRANSITION_TIMEOUT = 300;
64
+ function usePagination(originalProps) {
65
+ var _a, _b, _c, _d;
66
+ const globalContext = (0, import_system.useProviderContext)();
67
+ const [props, variantProps] = (0, import_system.mapPropsVariants)(originalProps, import_theme.pagination.variantKeys);
68
+ const {
69
+ as,
70
+ ref,
71
+ classNames,
72
+ dotsJump = 5,
73
+ loop = false,
74
+ showControls = false,
75
+ total = 1,
76
+ initialPage = 1,
77
+ page,
78
+ siblings,
79
+ boundaries,
80
+ onChange,
81
+ className,
82
+ renderItem,
83
+ getItemAriaLabel: getItemAriaLabelProp,
84
+ ...otherProps
85
+ } = props;
86
+ const Component = as || "nav";
87
+ const domRef = (0, import_react_utils.useDOMRef)(ref);
88
+ const cursorRef = (0, import_react.useRef)(null);
89
+ const itemsRef = (0, import_react.useRef)();
90
+ const cursorTimer = (0, import_react.useRef)();
91
+ const disableAnimation = (_b = (_a = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
92
+ const disableCursorAnimation = (_d = (_c = originalProps == null ? void 0 : originalProps.disableCursorAnimation) != null ? _c : disableAnimation) != null ? _d : false;
93
+ function getItemsRefMap() {
94
+ if (!itemsRef.current) {
95
+ itemsRef.current = /* @__PURE__ */ new Map();
96
+ }
97
+ return itemsRef.current;
98
+ }
99
+ function getItemRef(node, value) {
100
+ const map = getItemsRefMap();
101
+ if (node) {
102
+ map.set(value, node);
103
+ } else {
104
+ map.delete(value);
105
+ }
106
+ }
107
+ function scrollTo(value, skipAnimation) {
108
+ const map = getItemsRefMap();
109
+ const node = map.get(value);
110
+ if (!node || !cursorRef.current) return;
111
+ cursorTimer.current && clearTimeout(cursorTimer.current);
112
+ (0, import_scroll_into_view_if_needed.default)(node, {
113
+ scrollMode: "always",
114
+ behavior: "smooth",
115
+ block: "start",
116
+ inline: "start",
117
+ boundary: domRef.current
118
+ });
119
+ const { offsetLeft } = node;
120
+ if (skipAnimation) {
121
+ cursorRef.current.setAttribute("data-moving", "false");
122
+ cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`;
123
+ return;
124
+ }
125
+ cursorRef.current.setAttribute("data-moving", "true");
126
+ cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1.1)`;
127
+ cursorTimer.current = setTimeout(() => {
128
+ if (cursorRef.current) {
129
+ cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`;
130
+ }
131
+ cursorTimer.current = setTimeout(() => {
132
+ var _a2;
133
+ (_a2 = cursorRef.current) == null ? void 0 : _a2.setAttribute("data-moving", "false");
134
+ cursorTimer.current && clearTimeout(cursorTimer.current);
135
+ }, CURSOR_TRANSITION_TIMEOUT);
136
+ }, CURSOR_TRANSITION_TIMEOUT);
137
+ }
138
+ const { range, activePage, setPage, previous, next, first, last } = (0, import_use_pagination2.usePagination)({
139
+ page,
140
+ total,
141
+ initialPage,
142
+ siblings,
143
+ boundaries,
144
+ showControls,
145
+ onChange
146
+ });
147
+ const [setRef, isVisible] = (0, import_use_intersection_observer.useIntersectionObserver)();
148
+ (0, import_react.useEffect)(() => {
149
+ if (domRef.current) {
150
+ setRef(domRef.current);
151
+ }
152
+ }, [domRef.current]);
153
+ const activePageRef = (0, import_react.useRef)(activePage);
154
+ (0, import_react.useEffect)(() => {
155
+ if (activePage && !disableAnimation && isVisible) {
156
+ scrollTo(activePage, activePage === activePageRef.current);
157
+ }
158
+ activePageRef.current = activePage;
159
+ }, [
160
+ page,
161
+ activePage,
162
+ disableAnimation,
163
+ disableCursorAnimation,
164
+ isVisible,
165
+ originalProps.dotsJump,
166
+ originalProps.isCompact,
167
+ originalProps.showControls
168
+ ]);
169
+ const slots = (0, import_react.useMemo)(
170
+ () => (0, import_theme.pagination)({
171
+ ...variantProps,
172
+ disableAnimation,
173
+ disableCursorAnimation
174
+ }),
175
+ [(0, import_shared_utils.objectToDeps)(variantProps), disableCursorAnimation, disableAnimation]
176
+ );
177
+ const baseStyles = (0, import_theme.cn)(classNames == null ? void 0 : classNames.base, className);
178
+ const onNext = () => {
179
+ if (loop && activePage === total) {
180
+ return first();
181
+ }
182
+ return next();
183
+ };
184
+ const onPrevious = () => {
185
+ if (loop && activePage === 1) {
186
+ return last();
187
+ }
188
+ return previous();
189
+ };
190
+ const getBaseProps = (props2 = {}) => {
191
+ return {
192
+ ...props2,
193
+ ref: domRef,
194
+ role: "navigation",
195
+ "aria-label": props2["aria-label"] || "pagination navigation",
196
+ "data-slot": "base",
197
+ "data-controls": (0, import_shared_utils2.dataAttr)(showControls),
198
+ "data-loop": (0, import_shared_utils2.dataAttr)(loop),
199
+ "data-dots-jump": dotsJump,
200
+ "data-total": total,
201
+ "data-active-page": activePage,
202
+ className: slots.base({ class: (0, import_theme.cn)(baseStyles, props2 == null ? void 0 : props2.className) }),
203
+ ...otherProps
204
+ };
205
+ };
206
+ const getWrapperProps = (props2 = {}) => {
207
+ return {
208
+ ...props2,
209
+ "data-slot": "wrapper",
210
+ className: slots.wrapper({ class: (0, import_theme.cn)(classNames == null ? void 0 : classNames.wrapper, props2 == null ? void 0 : props2.className) })
211
+ };
212
+ };
213
+ const getItemAriaLabel = (page2) => {
214
+ if (!page2) return;
215
+ if (getItemAriaLabelProp) {
216
+ return getItemAriaLabelProp(page2);
217
+ }
218
+ switch (page2) {
219
+ case import_use_pagination.PaginationItemType.DOTS:
220
+ return "dots element";
221
+ case import_use_pagination.PaginationItemType.PREV:
222
+ return "previous page button";
223
+ case import_use_pagination.PaginationItemType.NEXT:
224
+ return "next page button";
225
+ case "first":
226
+ return "first page button";
227
+ case "last":
228
+ return "last page button";
229
+ default:
230
+ return `pagination item ${page2}`;
231
+ }
232
+ };
233
+ const getItemProps = (props2 = {}) => {
234
+ return {
235
+ ...props2,
236
+ ref: (node) => getItemRef(node, props2.value),
237
+ "data-slot": "item",
238
+ isActive: props2.value === activePage,
239
+ className: slots.item({ class: (0, import_theme.cn)(classNames == null ? void 0 : classNames.item, props2 == null ? void 0 : props2.className) }),
240
+ onPress: () => {
241
+ if (props2.value !== activePage) {
242
+ setPage(props2.value);
243
+ }
244
+ }
245
+ };
246
+ };
247
+ const getCursorProps = (props2 = {}) => {
248
+ return {
249
+ ...props2,
250
+ ref: cursorRef,
251
+ activePage,
252
+ "data-slot": "cursor",
253
+ className: slots.cursor({ class: (0, import_theme.cn)(classNames == null ? void 0 : classNames.cursor, props2 == null ? void 0 : props2.className) })
254
+ };
255
+ };
256
+ return {
257
+ Component,
258
+ showControls,
259
+ dotsJump,
260
+ slots,
261
+ classNames,
262
+ loop,
263
+ total,
264
+ range,
265
+ activePage,
266
+ getItemRef,
267
+ disableAnimation,
268
+ disableCursorAnimation,
269
+ setPage,
270
+ onPrevious,
271
+ onNext,
272
+ renderItem,
273
+ getBaseProps,
274
+ getWrapperProps,
275
+ getItemProps,
276
+ getCursorProps,
277
+ getItemAriaLabel
278
+ };
279
+ }
280
+
281
+ // src/pagination-item.tsx
282
+ var import_system2 = require("@sytechui/system");
283
+
284
+ // src/use-pagination-item.ts
285
+ var import_react2 = require("react");
286
+ var import_utils = require("@react-aria/utils");
287
+ var import_shared_utils3 = require("@sytechui/shared-utils");
288
+ var import_react_utils2 = require("@sytechui/react-utils");
289
+ var import_interactions = require("@react-aria/interactions");
290
+ var import_focus = require("@react-aria/focus");
291
+ var import_theme2 = require("@sytechui/theme");
292
+ function usePaginationItem(props) {
293
+ const {
294
+ as,
295
+ ref,
296
+ value,
297
+ children,
298
+ isActive,
299
+ isDisabled,
300
+ onPress,
301
+ onClick,
302
+ getAriaLabel,
303
+ className,
304
+ ...otherProps
305
+ } = props;
306
+ const isLink = !!(props == null ? void 0 : props.href);
307
+ const Component = as || isLink ? "a" : "li";
308
+ const shouldFilterDOMProps = typeof Component === "string";
309
+ const domRef = (0, import_react_utils2.useDOMRef)(ref);
310
+ const router = (0, import_utils.useRouter)();
311
+ const ariaLabel = (0, import_react2.useMemo)(
312
+ () => isActive ? `${getAriaLabel == null ? void 0 : getAriaLabel(value)} active` : getAriaLabel == null ? void 0 : getAriaLabel(value),
313
+ [value, isActive]
314
+ );
315
+ const { isPressed, pressProps } = (0, import_interactions.usePress)({
316
+ isDisabled,
317
+ onPress
318
+ });
319
+ const { focusProps, isFocused, isFocusVisible } = (0, import_focus.useFocusRing)({});
320
+ const { isHovered, hoverProps } = (0, import_interactions.useHover)({ isDisabled });
321
+ const getItemProps = (props2 = {}) => {
322
+ return {
323
+ ref: domRef,
324
+ role: "button",
325
+ tabIndex: isDisabled ? -1 : 0,
326
+ "aria-label": ariaLabel,
327
+ "aria-current": (0, import_shared_utils3.dataAttr)(isActive),
328
+ "aria-disabled": (0, import_shared_utils3.dataAttr)(isDisabled),
329
+ "data-disabled": (0, import_shared_utils3.dataAttr)(isDisabled),
330
+ "data-active": (0, import_shared_utils3.dataAttr)(isActive),
331
+ "data-focus": (0, import_shared_utils3.dataAttr)(isFocused),
332
+ "data-hover": (0, import_shared_utils3.dataAttr)(isHovered),
333
+ "data-pressed": (0, import_shared_utils3.dataAttr)(isPressed),
334
+ "data-focus-visible": (0, import_shared_utils3.dataAttr)(isFocusVisible),
335
+ ...(0, import_shared_utils3.mergeProps)(
336
+ props2,
337
+ pressProps,
338
+ focusProps,
339
+ hoverProps,
340
+ (0, import_react_utils2.filterDOMProps)(otherProps, {
341
+ enabled: shouldFilterDOMProps
342
+ })
343
+ ),
344
+ className: (0, import_theme2.cn)(className, props2.className),
345
+ onClick: (e) => {
346
+ (0, import_shared_utils3.chain)(pressProps == null ? void 0 : pressProps.onClick, onClick)(e);
347
+ (0, import_utils.handleLinkClick)(e, router, props2.href, props2.routerOptions);
348
+ }
349
+ };
350
+ };
351
+ return {
352
+ Component,
353
+ children,
354
+ ariaLabel,
355
+ isFocused,
356
+ isFocusVisible,
357
+ getItemProps
358
+ };
359
+ }
360
+
361
+ // src/pagination-item.tsx
362
+ var import_jsx_runtime = require("react/jsx-runtime");
363
+ var PaginationItem = (0, import_system2.forwardRef)((props, ref) => {
364
+ const { Component, children, getItemProps } = usePaginationItem({ ...props, ref });
365
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...getItemProps(), children });
366
+ });
367
+ PaginationItem.displayName = "HeroUI.PaginationItem";
368
+ var pagination_item_default = PaginationItem;
369
+
370
+ // src/pagination-cursor.tsx
371
+ var import_system3 = require("@sytechui/system");
372
+ var import_react_utils3 = require("@sytechui/react-utils");
373
+ var import_jsx_runtime2 = require("react/jsx-runtime");
374
+ var PaginationCursor = (0, import_system3.forwardRef)((props, ref) => {
375
+ const { as, activePage, ...otherProps } = props;
376
+ const Component = as || "span";
377
+ const domRef = (0, import_react_utils3.useDOMRef)(ref);
378
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, { ref: domRef, "aria-hidden": true, ...otherProps, children: activePage });
379
+ });
380
+ PaginationCursor.displayName = "HeroUI.PaginationCursor";
381
+ var pagination_cursor_default = PaginationCursor;
382
+
383
+ // src/pagination.tsx
384
+ var import_jsx_runtime3 = require("react/jsx-runtime");
385
+ var import_react4 = require("react");
386
+ var Pagination = (0, import_system4.forwardRef)((props, ref) => {
387
+ const {
388
+ Component,
389
+ dotsJump,
390
+ slots,
391
+ classNames,
392
+ total,
393
+ range,
394
+ loop,
395
+ activePage,
396
+ disableCursorAnimation,
397
+ disableAnimation,
398
+ renderItem: renderItemProp,
399
+ onNext,
400
+ onPrevious,
401
+ setPage,
402
+ getItemAriaLabel,
403
+ getItemRef,
404
+ getBaseProps,
405
+ getWrapperProps,
406
+ getItemProps,
407
+ getCursorProps
408
+ } = usePagination({ ...props, ref });
409
+ const { direction } = (0, import_i18n.useLocale)();
410
+ const isRTL = direction === "rtl";
411
+ const renderChevronIcon = (0, import_react3.useCallback)(
412
+ (key) => {
413
+ if (key === import_use_pagination3.PaginationItemType.PREV && !isRTL || key === import_use_pagination3.PaginationItemType.NEXT && isRTL) {
414
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_shared_icons.ChevronIcon, {});
415
+ }
416
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
417
+ import_shared_icons.ChevronIcon,
418
+ {
419
+ className: slots.chevronNext({
420
+ class: classNames == null ? void 0 : classNames.chevronNext
421
+ })
422
+ }
423
+ );
424
+ },
425
+ [slots, isRTL]
426
+ );
427
+ const renderPrevItem = (0, import_react3.useCallback)(
428
+ (value) => {
429
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
430
+ pagination_item_default,
431
+ {
432
+ className: slots.prev({
433
+ class: classNames == null ? void 0 : classNames.prev
434
+ }),
435
+ "data-slot": "prev",
436
+ getAriaLabel: getItemAriaLabel,
437
+ isDisabled: !loop && activePage === 1,
438
+ value,
439
+ onPress: onPrevious,
440
+ children: renderChevronIcon(import_use_pagination3.PaginationItemType.PREV)
441
+ },
442
+ import_use_pagination3.PaginationItemType.PREV
443
+ );
444
+ },
445
+ [slots, classNames, loop, activePage, isRTL, total, getItemAriaLabel, onPrevious]
446
+ );
447
+ const renderNextItem = (0, import_react3.useCallback)(
448
+ (value) => {
449
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
450
+ pagination_item_default,
451
+ {
452
+ className: slots.next({
453
+ class: (0, import_theme3.cn)(classNames == null ? void 0 : classNames.next)
454
+ }),
455
+ "data-slot": "next",
456
+ getAriaLabel: getItemAriaLabel,
457
+ isDisabled: !loop && activePage === total,
458
+ value,
459
+ onPress: onNext,
460
+ children: renderChevronIcon(import_use_pagination3.PaginationItemType.NEXT)
461
+ },
462
+ import_use_pagination3.PaginationItemType.NEXT
463
+ );
464
+ },
465
+ [slots, classNames, loop, activePage, isRTL, total, getItemAriaLabel, onNext]
466
+ );
467
+ const renderItem = (0, import_react3.useCallback)(
468
+ (value, index) => {
469
+ const isBefore = index < range.indexOf(activePage);
470
+ if (renderItemProp && typeof renderItemProp === "function") {
471
+ let page = typeof value == "number" ? value : index;
472
+ if (value === import_use_pagination3.PaginationItemType.NEXT) {
473
+ page = activePage + 1;
474
+ }
475
+ if (value === import_use_pagination3.PaginationItemType.PREV) {
476
+ page = activePage - 1;
477
+ }
478
+ if (value === import_use_pagination3.PaginationItemType.DOTS) {
479
+ page = isBefore ? activePage - dotsJump >= 1 ? activePage - dotsJump : 1 : activePage + dotsJump <= total ? activePage + dotsJump : total;
480
+ }
481
+ const itemChildren = {
482
+ [import_use_pagination3.PaginationItemType.PREV]: renderChevronIcon(import_use_pagination3.PaginationItemType.PREV),
483
+ [import_use_pagination3.PaginationItemType.NEXT]: renderChevronIcon(import_use_pagination3.PaginationItemType.NEXT),
484
+ [import_use_pagination3.PaginationItemType.DOTS]: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
485
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_shared_icons.EllipsisIcon, { className: slots == null ? void 0 : slots.ellipsis({ class: classNames == null ? void 0 : classNames.ellipsis }) }),
486
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
487
+ import_shared_icons.ForwardIcon,
488
+ {
489
+ className: slots == null ? void 0 : slots.forwardIcon({ class: classNames == null ? void 0 : classNames.forwardIcon }),
490
+ "data-before": (0, import_shared_utils4.dataAttr)(isBefore)
491
+ }
492
+ )
493
+ ] })
494
+ };
495
+ return renderItemProp({
496
+ value,
497
+ index,
498
+ key: `${value}-${index}`,
499
+ page,
500
+ total,
501
+ children: typeof value === "number" ? value : itemChildren[value],
502
+ activePage,
503
+ dotsJump,
504
+ isBefore,
505
+ isActive: value === activePage,
506
+ isPrevious: value === activePage - 1,
507
+ isNext: value === activePage + 1,
508
+ isFirst: value === 1,
509
+ isLast: value === total,
510
+ onNext,
511
+ onPrevious,
512
+ setPage,
513
+ onPress: () => setPage(page),
514
+ ref: typeof value === "number" ? (node) => getItemRef(node, value) : void 0,
515
+ className: slots.item({ class: classNames == null ? void 0 : classNames.item }),
516
+ getAriaLabel: getItemAriaLabel
517
+ });
518
+ }
519
+ if (value === import_use_pagination3.PaginationItemType.PREV) {
520
+ return renderPrevItem(value);
521
+ }
522
+ if (value === import_use_pagination3.PaginationItemType.NEXT) {
523
+ return renderNextItem(value);
524
+ }
525
+ if (value === import_use_pagination3.PaginationItemType.DOTS) {
526
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
527
+ pagination_item_default,
528
+ {
529
+ className: slots.item({
530
+ class: (0, import_theme3.cn)(classNames == null ? void 0 : classNames.item, "group")
531
+ }),
532
+ "data-slot": "item",
533
+ getAriaLabel: getItemAriaLabel,
534
+ value,
535
+ onPress: () => isBefore ? setPage(activePage - dotsJump >= 1 ? activePage - dotsJump : 1) : setPage(activePage + dotsJump <= total ? activePage + dotsJump : total),
536
+ children: [
537
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_shared_icons.EllipsisIcon, { className: slots == null ? void 0 : slots.ellipsis({ class: classNames == null ? void 0 : classNames.ellipsis }) }),
538
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
539
+ import_shared_icons.ForwardIcon,
540
+ {
541
+ className: slots == null ? void 0 : slots.forwardIcon({ class: classNames == null ? void 0 : classNames.forwardIcon }),
542
+ "data-before": (0, import_shared_utils4.dataAttr)(isRTL ? !isBefore : isBefore)
543
+ }
544
+ )
545
+ ]
546
+ },
547
+ import_use_pagination3.PaginationItemType.DOTS + isBefore
548
+ );
549
+ }
550
+ return /* @__PURE__ */ (0, import_react4.createElement)(pagination_item_default, { ...getItemProps({ value }), key: value, getAriaLabel: getItemAriaLabel }, value);
551
+ },
552
+ [
553
+ isRTL,
554
+ activePage,
555
+ dotsJump,
556
+ getItemProps,
557
+ loop,
558
+ range,
559
+ renderItemProp,
560
+ slots,
561
+ classNames,
562
+ total,
563
+ getItemAriaLabel,
564
+ onNext,
565
+ onPrevious,
566
+ setPage,
567
+ renderPrevItem,
568
+ renderNextItem
569
+ ]
570
+ );
571
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, { ...getBaseProps(), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("ul", { ...getWrapperProps(), children: [
572
+ !disableCursorAnimation && !disableAnimation && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(pagination_cursor_default, { ...getCursorProps() }),
573
+ range.map(renderItem)
574
+ ] }) });
575
+ });
576
+ Pagination.displayName = "HeroUI.Pagination";
577
+ var pagination_default = Pagination;
578
+
579
+ // src/index.ts
580
+ var import_use_pagination5 = require("@sytechui/use-pagination");
581
+ // Annotate the CommonJS export names for ESM import in node:
582
+ 0 && (module.exports = {
583
+ Pagination,
584
+ PaginationCursor,
585
+ PaginationItem,
586
+ PaginationItemType,
587
+ usePagination,
588
+ usePaginationItem
589
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import {
3
+ pagination_default
4
+ } from "./chunk-BIG4ST5P.mjs";
5
+ import {
6
+ pagination_cursor_default
7
+ } from "./chunk-MA7OMMHX.mjs";
8
+ import {
9
+ pagination_item_default
10
+ } from "./chunk-BNRXGTRW.mjs";
11
+ import {
12
+ usePaginationItem
13
+ } from "./chunk-5S65XA6Q.mjs";
14
+ import {
15
+ usePagination
16
+ } from "./chunk-RL6XUYZP.mjs";
17
+
18
+ // src/index.ts
19
+ import { PaginationItemType } from "@sytechui/use-pagination";
20
+ export {
21
+ pagination_default as Pagination,
22
+ pagination_cursor_default as PaginationCursor,
23
+ pagination_item_default as PaginationItem,
24
+ PaginationItemType,
25
+ usePagination,
26
+ usePaginationItem
27
+ };
@@ -0,0 +1,12 @@
1
+ import * as _sytechui_system from '@sytechui/system';
2
+ import { HTMLHeroUIProps } from '@sytechui/system';
3
+
4
+ interface PaginationCursorProps extends HTMLHeroUIProps<"span"> {
5
+ /**
6
+ * The current active page.
7
+ */
8
+ activePage?: number;
9
+ }
10
+ declare const PaginationCursor: _sytechui_system.InternalForwardRefRenderFunction<"span", PaginationCursorProps, never>;
11
+
12
+ export { type PaginationCursorProps, PaginationCursor as default };
@@ -0,0 +1,12 @@
1
+ import * as _sytechui_system from '@sytechui/system';
2
+ import { HTMLHeroUIProps } from '@sytechui/system';
3
+
4
+ interface PaginationCursorProps extends HTMLHeroUIProps<"span"> {
5
+ /**
6
+ * The current active page.
7
+ */
8
+ activePage?: number;
9
+ }
10
+ declare const PaginationCursor: _sytechui_system.InternalForwardRefRenderFunction<"span", PaginationCursorProps, never>;
11
+
12
+ export { type PaginationCursorProps, PaginationCursor as default };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/pagination-cursor.tsx
22
+ var pagination_cursor_exports = {};
23
+ __export(pagination_cursor_exports, {
24
+ default: () => pagination_cursor_default
25
+ });
26
+ module.exports = __toCommonJS(pagination_cursor_exports);
27
+ var import_system = require("@sytechui/system");
28
+ var import_react_utils = require("@sytechui/react-utils");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ var PaginationCursor = (0, import_system.forwardRef)((props, ref) => {
31
+ const { as, activePage, ...otherProps } = props;
32
+ const Component = as || "span";
33
+ const domRef = (0, import_react_utils.useDOMRef)(ref);
34
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: domRef, "aria-hidden": true, ...otherProps, children: activePage });
35
+ });
36
+ PaginationCursor.displayName = "HeroUI.PaginationCursor";
37
+ var pagination_cursor_default = PaginationCursor;
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ pagination_cursor_default
4
+ } from "./chunk-MA7OMMHX.mjs";
5
+ export {
6
+ pagination_cursor_default as default
7
+ };