@yahoo/uds 3.152.1 → 3.153.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.
- package/dist/automated-config/dist/generated/autoVariants.cjs +25 -0
- package/dist/automated-config/dist/generated/autoVariants.d.cts +6 -0
- package/dist/automated-config/dist/generated/autoVariants.d.ts +6 -0
- package/dist/automated-config/dist/generated/autoVariants.js +25 -0
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +1368 -0
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +169 -1
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +169 -1
- package/dist/automated-config/dist/generated/generatedConfigs.js +1368 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +198 -0
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +2 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +2 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +198 -0
- package/dist/automated-config/dist/types/ComponentConfig.d.cts +2 -0
- package/dist/automated-config/dist/types/ComponentConfig.d.ts +2 -0
- package/dist/automated-config/dist/utils/buildConfigSchema.cjs +13 -20
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +14 -2
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +14 -2
- package/dist/automated-config/dist/utils/buildConfigSchema.js +13 -20
- package/dist/automated-config/dist/utils/componentStatePseudoStates.cjs +15 -0
- package/dist/automated-config/dist/utils/componentStatePseudoStates.js +14 -0
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.cjs +4 -2
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.d.cts +1 -1
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.d.ts +1 -1
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.js +4 -2
- package/dist/automated-config/dist/utils/index.cjs +114 -48
- package/dist/automated-config/dist/utils/index.d.cts +25 -2
- package/dist/automated-config/dist/utils/index.d.ts +25 -2
- package/dist/automated-config/dist/utils/index.js +114 -49
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Pagination/Pagination.cjs +62 -0
- package/dist/components/client/Pagination/Pagination.d.cts +28 -0
- package/dist/components/client/Pagination/Pagination.d.ts +29 -0
- package/dist/components/client/Pagination/Pagination.js +60 -0
- package/dist/components/client/Pagination/PaginationEllipsis.cjs +24 -0
- package/dist/components/client/Pagination/PaginationEllipsis.d.cts +10 -0
- package/dist/components/client/Pagination/PaginationEllipsis.d.ts +11 -0
- package/dist/components/client/Pagination/PaginationEllipsis.js +22 -0
- package/dist/components/client/Pagination/PaginationItem.cjs +52 -0
- package/dist/components/client/Pagination/PaginationItem.d.cts +10 -0
- package/dist/components/client/Pagination/PaginationItem.d.ts +11 -0
- package/dist/components/client/Pagination/PaginationItem.js +50 -0
- package/dist/components/client/Pagination/PaginationLink.cjs +53 -0
- package/dist/components/client/Pagination/PaginationLink.d.cts +9 -0
- package/dist/components/client/Pagination/PaginationLink.d.ts +10 -0
- package/dist/components/client/Pagination/PaginationLink.js +51 -0
- package/dist/components/client/Pagination/PaginationNext.cjs +56 -0
- package/dist/components/client/Pagination/PaginationNext.d.cts +9 -0
- package/dist/components/client/Pagination/PaginationNext.d.ts +10 -0
- package/dist/components/client/Pagination/PaginationNext.js +54 -0
- package/dist/components/client/Pagination/PaginationNumbers.cjs +52 -0
- package/dist/components/client/Pagination/PaginationNumbers.d.cts +9 -0
- package/dist/components/client/Pagination/PaginationNumbers.d.ts +10 -0
- package/dist/components/client/Pagination/PaginationNumbers.js +50 -0
- package/dist/components/client/Pagination/PaginationPrev.cjs +56 -0
- package/dist/components/client/Pagination/PaginationPrev.d.cts +9 -0
- package/dist/components/client/Pagination/PaginationPrev.d.ts +10 -0
- package/dist/components/client/Pagination/PaginationPrev.js +54 -0
- package/dist/components/client/Pagination/computeVisiblePages.cjs +22 -0
- package/dist/components/client/Pagination/computeVisiblePages.d.cts +18 -0
- package/dist/components/client/Pagination/computeVisiblePages.d.ts +19 -0
- package/dist/components/client/Pagination/computeVisiblePages.js +21 -0
- package/dist/components/client/Pagination/ellipsisDefault.cjs +33 -0
- package/dist/components/client/Pagination/ellipsisDefault.d.cts +10 -0
- package/dist/components/client/Pagination/ellipsisDefault.d.ts +11 -0
- package/dist/components/client/Pagination/ellipsisDefault.js +32 -0
- package/dist/components/client/Pagination/ellipsisNone.cjs +29 -0
- package/dist/components/client/Pagination/ellipsisNone.d.cts +10 -0
- package/dist/components/client/Pagination/ellipsisNone.d.ts +11 -0
- package/dist/components/client/Pagination/ellipsisNone.js +28 -0
- package/dist/components/client/Pagination/index.cjs +19 -0
- package/dist/components/client/Pagination/index.d.cts +10 -0
- package/dist/components/client/Pagination/index.d.ts +11 -0
- package/dist/components/client/Pagination/index.js +11 -0
- package/dist/components/client/Pagination/paginationContext.cjs +44 -0
- package/dist/components/client/Pagination/paginationContext.d.cts +34 -0
- package/dist/components/client/Pagination/paginationContext.d.ts +35 -0
- package/dist/components/client/Pagination/paginationContext.js +38 -0
- package/dist/components/client/Pagination/paginationStyles.cjs +72 -0
- package/dist/components/client/Pagination/paginationStyles.d.cts +14 -0
- package/dist/components/client/Pagination/paginationStyles.d.ts +15 -0
- package/dist/components/client/Pagination/paginationStyles.js +63 -0
- package/dist/components/client/index.cjs +14 -0
- package/dist/components/client/index.d.cts +8 -1
- package/dist/components/client/index.d.ts +8 -1
- package/dist/components/client/index.js +8 -1
- package/dist/components/index.cjs +14 -0
- package/dist/components/index.d.cts +8 -1
- package/dist/components/index.d.ts +8 -1
- package/dist/components/index.js +8 -1
- package/dist/config/dist/index.cjs +272 -2
- package/dist/config/dist/index.js +272 -2
- package/dist/css/dist/css/utils.cjs +5 -1
- package/dist/css/dist/css/utils.js +5 -1
- package/dist/css/dist/packages/config/dist/index.cjs +272 -2
- package/dist/css/dist/packages/config/dist/index.js +272 -2
- package/dist/index.cjs +16 -0
- package/dist/index.d.cts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +10 -3
- package/dist/styles/styler.d.cts +28 -22
- package/dist/styles/styler.d.ts +28 -22
- package/dist/styles/variants.d.cts +27 -0
- package/dist/styles/variants.d.ts +27 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.cjs +1368 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.js +1368 -1
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.cjs +16 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.js +15 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.cjs +113 -48
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.js +113 -48
- package/dist/tailwind-internal/dist/packages/config/dist/index.cjs +272 -2
- package/dist/tailwind-internal/dist/packages/config/dist/index.js +272 -2
- package/dist/tailwind-internal/dist/plugins/components.cjs +1 -0
- package/dist/tailwind-internal/dist/plugins/components.js +2 -1
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
- package/dist/tokens/automation/configs/index.cjs +1 -0
- package/dist/tokens/automation/configs/index.d.cts +2 -2
- package/dist/tokens/automation/configs/index.d.ts +2 -2
- package/dist/tokens/automation/configs/index.js +2 -2
- package/dist/tokens/automation/index.cjs +2 -0
- package/dist/tokens/automation/index.d.cts +3 -3
- package/dist/tokens/automation/index.d.ts +3 -3
- package/dist/tokens/automation/index.js +3 -3
- package/dist/tokens/index.cjs +2 -0
- package/dist/tokens/index.d.cts +4 -4
- package/dist/tokens/index.d.ts +4 -4
- package/dist/tokens/index.js +3 -3
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/types/dist/index.d.cts +83 -1
- package/dist/types/dist/index.d.ts +83 -1
- package/dist/uds/generated/componentData.cjs +1238 -858
- package/dist/uds/generated/componentData.js +1238 -858
- package/dist/uds/generated/tailwindPurge.cjs +31 -0
- package/dist/uds/generated/tailwindPurge.js +31 -0
- package/generated/componentData.json +2127 -1667
- package/generated/tailwindPurge.ts +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_utils_createSlot = require("../../../utils/createSlot.cjs");
|
|
6
|
+
const require_components_client_Pagination_paginationContext = require("./paginationContext.cjs");
|
|
7
|
+
const require_components_client_Pagination_paginationStyles = require("./paginationStyles.cjs");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/components/client/Pagination/PaginationLink.tsx
|
|
11
|
+
const Slot = require_utils_createSlot.createSlot();
|
|
12
|
+
const PaginationLink = (0, react.forwardRef)(function PaginationLink({ page, href, asChild = false, children, className, onClick, ...rest }, ref) {
|
|
13
|
+
const { activePage, size, variant, getItemAriaLabel, onPageChange } = require_components_client_Pagination_paginationContext.usePaginationContext();
|
|
14
|
+
const isActive = page === activePage;
|
|
15
|
+
const itemClass = require_components_client_Pagination_paginationStyles.usePaginationItemClassName(size, variant, isActive, className);
|
|
16
|
+
const labelClass = require_components_client_Pagination_paginationStyles.usePaginationItemLabelClassName(size);
|
|
17
|
+
const ariaLabel = getItemAriaLabel(page, isActive);
|
|
18
|
+
const handleClick = (event) => {
|
|
19
|
+
onClick?.(event);
|
|
20
|
+
if (!event.defaultPrevented && !isActive && onPageChange) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
onPageChange(page);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const Comp = asChild ? Slot : "a";
|
|
26
|
+
const label = children ?? page;
|
|
27
|
+
if (asChild && (0, react.isValidElement)(children)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
28
|
+
ref,
|
|
29
|
+
href: isActive ? void 0 : href,
|
|
30
|
+
className: itemClass,
|
|
31
|
+
"aria-current": isActive ? "page" : void 0,
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
onClick: isActive ? void 0 : handleClick,
|
|
34
|
+
...rest,
|
|
35
|
+
children
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
38
|
+
ref,
|
|
39
|
+
href: isActive ? void 0 : href,
|
|
40
|
+
className: itemClass,
|
|
41
|
+
"aria-current": isActive ? "page" : void 0,
|
|
42
|
+
"aria-label": ariaLabel,
|
|
43
|
+
onClick: isActive ? void 0 : handleClick,
|
|
44
|
+
...rest,
|
|
45
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
46
|
+
className: labelClass,
|
|
47
|
+
children: label
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
PaginationLink.displayName = "PaginationLink";
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.PaginationLink = PaginationLink;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalPaginationLinkProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Pagination/PaginationLink.d.ts
|
|
6
|
+
type PaginationLinkProps = UniversalPaginationLinkProps;
|
|
7
|
+
declare const PaginationLink: _$react.ForwardRefExoticComponent<UniversalPaginationLinkProps & _$react.RefAttributes<HTMLAnchorElement>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { PaginationLink, type PaginationLinkProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalPaginationLinkProps } from "../../../types/dist/index.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Pagination/PaginationLink.d.ts
|
|
7
|
+
type PaginationLinkProps = UniversalPaginationLinkProps;
|
|
8
|
+
declare const PaginationLink: _$react.ForwardRefExoticComponent<UniversalPaginationLinkProps & _$react.RefAttributes<HTMLAnchorElement>>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { PaginationLink, type PaginationLinkProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { createSlot } from "../../../utils/createSlot.js";
|
|
4
|
+
import { usePaginationContext } from "./paginationContext.js";
|
|
5
|
+
import { usePaginationItemClassName, usePaginationItemLabelClassName } from "./paginationStyles.js";
|
|
6
|
+
import { forwardRef, isValidElement } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/client/Pagination/PaginationLink.tsx
|
|
9
|
+
const Slot = createSlot();
|
|
10
|
+
const PaginationLink = forwardRef(function PaginationLink({ page, href, asChild = false, children, className, onClick, ...rest }, ref) {
|
|
11
|
+
const { activePage, size, variant, getItemAriaLabel, onPageChange } = usePaginationContext();
|
|
12
|
+
const isActive = page === activePage;
|
|
13
|
+
const itemClass = usePaginationItemClassName(size, variant, isActive, className);
|
|
14
|
+
const labelClass = usePaginationItemLabelClassName(size);
|
|
15
|
+
const ariaLabel = getItemAriaLabel(page, isActive);
|
|
16
|
+
const handleClick = (event) => {
|
|
17
|
+
onClick?.(event);
|
|
18
|
+
if (!event.defaultPrevented && !isActive && onPageChange) {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
onPageChange(page);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const Comp = asChild ? Slot : "a";
|
|
24
|
+
const label = children ?? page;
|
|
25
|
+
if (asChild && isValidElement(children)) return /* @__PURE__ */ jsx(Comp, {
|
|
26
|
+
ref,
|
|
27
|
+
href: isActive ? void 0 : href,
|
|
28
|
+
className: itemClass,
|
|
29
|
+
"aria-current": isActive ? "page" : void 0,
|
|
30
|
+
"aria-label": ariaLabel,
|
|
31
|
+
onClick: isActive ? void 0 : handleClick,
|
|
32
|
+
...rest,
|
|
33
|
+
children
|
|
34
|
+
});
|
|
35
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
36
|
+
ref,
|
|
37
|
+
href: isActive ? void 0 : href,
|
|
38
|
+
className: itemClass,
|
|
39
|
+
"aria-current": isActive ? "page" : void 0,
|
|
40
|
+
"aria-label": ariaLabel,
|
|
41
|
+
onClick: isActive ? void 0 : handleClick,
|
|
42
|
+
...rest,
|
|
43
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: labelClass,
|
|
45
|
+
children: label
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
PaginationLink.displayName = "PaginationLink";
|
|
50
|
+
//#endregion
|
|
51
|
+
export { PaginationLink };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_utils_createSlot = require("../../../utils/createSlot.cjs");
|
|
6
|
+
const require_components_Icon = require("../../Icon.cjs");
|
|
7
|
+
const require_components_client_Pagination_paginationContext = require("./paginationContext.cjs");
|
|
8
|
+
const require_components_client_Pagination_paginationStyles = require("./paginationStyles.cjs");
|
|
9
|
+
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
10
|
+
let react = require("react");
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
//#region src/components/client/Pagination/PaginationNext.tsx
|
|
13
|
+
const Slot = require_utils_createSlot.createSlot();
|
|
14
|
+
const PaginationNext = (0, react.forwardRef)(function PaginationNext({ label = "Next", asChild = false, className, onClick, children, ...rest }, ref) {
|
|
15
|
+
const { activePage, totalPages, size, variant, onPageChange } = require_components_client_Pagination_paginationContext.usePaginationContext();
|
|
16
|
+
const controlClass = require_components_client_Pagination_paginationStyles.usePaginationPrevNextClassName(size, variant, className);
|
|
17
|
+
const iconClass = require_components_client_Pagination_paginationStyles.usePaginationIconClassName(size);
|
|
18
|
+
const textClass = require_components_client_Pagination_paginationStyles.usePaginationItemLabelClassName(size);
|
|
19
|
+
const handleClick = (event) => {
|
|
20
|
+
onClick?.(event);
|
|
21
|
+
if (!event.defaultPrevented) onPageChange?.(activePage + 1);
|
|
22
|
+
};
|
|
23
|
+
if (activePage >= totalPages) return null;
|
|
24
|
+
const Comp = asChild ? Slot : "button";
|
|
25
|
+
const content = children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
26
|
+
className: textClass,
|
|
27
|
+
children: label
|
|
28
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
29
|
+
name: _yahoo_uds_icons.ChevronRight,
|
|
30
|
+
size: "sm",
|
|
31
|
+
color: "current",
|
|
32
|
+
className: iconClass,
|
|
33
|
+
"aria-hidden": true
|
|
34
|
+
})] });
|
|
35
|
+
if (asChild && (0, react.isValidElement)(children)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
36
|
+
ref,
|
|
37
|
+
type: "button",
|
|
38
|
+
className: controlClass,
|
|
39
|
+
"aria-label": "Go to next page",
|
|
40
|
+
onClick: handleClick,
|
|
41
|
+
...rest,
|
|
42
|
+
children
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
45
|
+
ref,
|
|
46
|
+
type: "button",
|
|
47
|
+
className: controlClass,
|
|
48
|
+
"aria-label": "Go to next page",
|
|
49
|
+
onClick: handleClick,
|
|
50
|
+
...rest,
|
|
51
|
+
children: content
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
PaginationNext.displayName = "PaginationNext";
|
|
55
|
+
//#endregion
|
|
56
|
+
exports.PaginationNext = PaginationNext;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalPaginationNextProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Pagination/PaginationNext.d.ts
|
|
6
|
+
type PaginationNextProps = UniversalPaginationNextProps;
|
|
7
|
+
declare const PaginationNext: _$react.ForwardRefExoticComponent<UniversalPaginationNextProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { PaginationNext, type PaginationNextProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalPaginationNextProps } from "../../../types/dist/index.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Pagination/PaginationNext.d.ts
|
|
7
|
+
type PaginationNextProps = UniversalPaginationNextProps;
|
|
8
|
+
declare const PaginationNext: _$react.ForwardRefExoticComponent<UniversalPaginationNextProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { PaginationNext, type PaginationNextProps };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { createSlot } from "../../../utils/createSlot.js";
|
|
4
|
+
import { Icon } from "../../Icon.js";
|
|
5
|
+
import { usePaginationContext } from "./paginationContext.js";
|
|
6
|
+
import { usePaginationIconClassName, usePaginationItemLabelClassName, usePaginationPrevNextClassName } from "./paginationStyles.js";
|
|
7
|
+
import { ChevronRight } from "@yahoo/uds-icons";
|
|
8
|
+
import { forwardRef, isValidElement } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/client/Pagination/PaginationNext.tsx
|
|
11
|
+
const Slot = createSlot();
|
|
12
|
+
const PaginationNext = forwardRef(function PaginationNext({ label = "Next", asChild = false, className, onClick, children, ...rest }, ref) {
|
|
13
|
+
const { activePage, totalPages, size, variant, onPageChange } = usePaginationContext();
|
|
14
|
+
const controlClass = usePaginationPrevNextClassName(size, variant, className);
|
|
15
|
+
const iconClass = usePaginationIconClassName(size);
|
|
16
|
+
const textClass = usePaginationItemLabelClassName(size);
|
|
17
|
+
const handleClick = (event) => {
|
|
18
|
+
onClick?.(event);
|
|
19
|
+
if (!event.defaultPrevented) onPageChange?.(activePage + 1);
|
|
20
|
+
};
|
|
21
|
+
if (activePage >= totalPages) return null;
|
|
22
|
+
const Comp = asChild ? Slot : "button";
|
|
23
|
+
const content = children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
24
|
+
className: textClass,
|
|
25
|
+
children: label
|
|
26
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
27
|
+
name: ChevronRight,
|
|
28
|
+
size: "sm",
|
|
29
|
+
color: "current",
|
|
30
|
+
className: iconClass,
|
|
31
|
+
"aria-hidden": true
|
|
32
|
+
})] });
|
|
33
|
+
if (asChild && isValidElement(children)) return /* @__PURE__ */ jsx(Comp, {
|
|
34
|
+
ref,
|
|
35
|
+
type: "button",
|
|
36
|
+
className: controlClass,
|
|
37
|
+
"aria-label": "Go to next page",
|
|
38
|
+
onClick: handleClick,
|
|
39
|
+
...rest,
|
|
40
|
+
children
|
|
41
|
+
});
|
|
42
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
43
|
+
ref,
|
|
44
|
+
type: "button",
|
|
45
|
+
className: controlClass,
|
|
46
|
+
"aria-label": "Go to next page",
|
|
47
|
+
onClick: handleClick,
|
|
48
|
+
...rest,
|
|
49
|
+
children: content
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
PaginationNext.displayName = "PaginationNext";
|
|
53
|
+
//#endregion
|
|
54
|
+
export { PaginationNext };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
6
|
+
const require_components_client_Pagination_paginationContext = require("./paginationContext.cjs");
|
|
7
|
+
const require_components_client_Pagination_paginationStyles = require("./paginationStyles.cjs");
|
|
8
|
+
const require_components_client_Pagination_PaginationEllipsis = require("./PaginationEllipsis.cjs");
|
|
9
|
+
const require_components_client_Pagination_PaginationItem = require("./PaginationItem.cjs");
|
|
10
|
+
const require_components_client_Pagination_PaginationLink = require("./PaginationLink.cjs");
|
|
11
|
+
let react = require("react");
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
//#region src/components/client/Pagination/PaginationNumbers.tsx
|
|
14
|
+
const PaginationNumbers = (0, react.forwardRef)(function PaginationNumbers({ renderItem, className }, ref) {
|
|
15
|
+
const { activePage, getPageHref, size } = require_components_client_Pagination_paginationContext.usePaginationContext();
|
|
16
|
+
const visiblePages = require_components_client_Pagination_paginationContext.useVisiblePages();
|
|
17
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
18
|
+
ref,
|
|
19
|
+
className: require_styles_styler.cx("m-0 inline-flex list-none items-center self-center p-0", require_components_client_Pagination_paginationStyles.usePaginationGapClassName(size), className),
|
|
20
|
+
children: visiblePages.map((item, index) => {
|
|
21
|
+
const key = item === "ellipsis" ? `ellipsis-${index}` : `page-${item}`;
|
|
22
|
+
if (item === "ellipsis") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
23
|
+
className: "inline-flex items-center",
|
|
24
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Pagination_PaginationEllipsis.PaginationEllipsis, {})
|
|
25
|
+
}, key);
|
|
26
|
+
const isActive = item === activePage;
|
|
27
|
+
const href = getPageHref?.(item);
|
|
28
|
+
if (renderItem) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
29
|
+
className: "inline-flex items-center",
|
|
30
|
+
children: renderItem(item, { isActive })
|
|
31
|
+
}, key);
|
|
32
|
+
if (href && !isActive) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
33
|
+
className: "inline-flex items-center",
|
|
34
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Pagination_PaginationLink.PaginationLink, {
|
|
35
|
+
page: item,
|
|
36
|
+
href,
|
|
37
|
+
children: item
|
|
38
|
+
})
|
|
39
|
+
}, key);
|
|
40
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
41
|
+
className: "inline-flex items-center",
|
|
42
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Pagination_PaginationItem.PaginationItem, {
|
|
43
|
+
page: item,
|
|
44
|
+
children: item
|
|
45
|
+
})
|
|
46
|
+
}, key);
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
PaginationNumbers.displayName = "PaginationNumbers";
|
|
51
|
+
//#endregion
|
|
52
|
+
exports.PaginationNumbers = PaginationNumbers;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalPaginationNumbersProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Pagination/PaginationNumbers.d.ts
|
|
6
|
+
type PaginationNumbersProps = UniversalPaginationNumbersProps;
|
|
7
|
+
declare const PaginationNumbers: _$react.ForwardRefExoticComponent<UniversalPaginationNumbersProps & _$react.RefAttributes<HTMLUListElement>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { PaginationNumbers, type PaginationNumbersProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalPaginationNumbersProps } from "../../../types/dist/index.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Pagination/PaginationNumbers.d.ts
|
|
7
|
+
type PaginationNumbersProps = UniversalPaginationNumbersProps;
|
|
8
|
+
declare const PaginationNumbers: _$react.ForwardRefExoticComponent<UniversalPaginationNumbersProps & _$react.RefAttributes<HTMLUListElement>>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { PaginationNumbers, type PaginationNumbersProps };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { cx } from "../../../styles/styler.js";
|
|
4
|
+
import { usePaginationContext, useVisiblePages } from "./paginationContext.js";
|
|
5
|
+
import { usePaginationGapClassName } from "./paginationStyles.js";
|
|
6
|
+
import { PaginationEllipsis } from "./PaginationEllipsis.js";
|
|
7
|
+
import { PaginationItem } from "./PaginationItem.js";
|
|
8
|
+
import { PaginationLink } from "./PaginationLink.js";
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/client/Pagination/PaginationNumbers.tsx
|
|
12
|
+
const PaginationNumbers = forwardRef(function PaginationNumbers({ renderItem, className }, ref) {
|
|
13
|
+
const { activePage, getPageHref, size } = usePaginationContext();
|
|
14
|
+
const visiblePages = useVisiblePages();
|
|
15
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
16
|
+
ref,
|
|
17
|
+
className: cx("m-0 inline-flex list-none items-center self-center p-0", usePaginationGapClassName(size), className),
|
|
18
|
+
children: visiblePages.map((item, index) => {
|
|
19
|
+
const key = item === "ellipsis" ? `ellipsis-${index}` : `page-${item}`;
|
|
20
|
+
if (item === "ellipsis") return /* @__PURE__ */ jsx("li", {
|
|
21
|
+
className: "inline-flex items-center",
|
|
22
|
+
children: /* @__PURE__ */ jsx(PaginationEllipsis, {})
|
|
23
|
+
}, key);
|
|
24
|
+
const isActive = item === activePage;
|
|
25
|
+
const href = getPageHref?.(item);
|
|
26
|
+
if (renderItem) return /* @__PURE__ */ jsx("li", {
|
|
27
|
+
className: "inline-flex items-center",
|
|
28
|
+
children: renderItem(item, { isActive })
|
|
29
|
+
}, key);
|
|
30
|
+
if (href && !isActive) return /* @__PURE__ */ jsx("li", {
|
|
31
|
+
className: "inline-flex items-center",
|
|
32
|
+
children: /* @__PURE__ */ jsx(PaginationLink, {
|
|
33
|
+
page: item,
|
|
34
|
+
href,
|
|
35
|
+
children: item
|
|
36
|
+
})
|
|
37
|
+
}, key);
|
|
38
|
+
return /* @__PURE__ */ jsx("li", {
|
|
39
|
+
className: "inline-flex items-center",
|
|
40
|
+
children: /* @__PURE__ */ jsx(PaginationItem, {
|
|
41
|
+
page: item,
|
|
42
|
+
children: item
|
|
43
|
+
})
|
|
44
|
+
}, key);
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
PaginationNumbers.displayName = "PaginationNumbers";
|
|
49
|
+
//#endregion
|
|
50
|
+
export { PaginationNumbers };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_utils_createSlot = require("../../../utils/createSlot.cjs");
|
|
6
|
+
const require_components_Icon = require("../../Icon.cjs");
|
|
7
|
+
const require_components_client_Pagination_paginationContext = require("./paginationContext.cjs");
|
|
8
|
+
const require_components_client_Pagination_paginationStyles = require("./paginationStyles.cjs");
|
|
9
|
+
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
10
|
+
let react = require("react");
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
//#region src/components/client/Pagination/PaginationPrev.tsx
|
|
13
|
+
const Slot = require_utils_createSlot.createSlot();
|
|
14
|
+
const PaginationPrev = (0, react.forwardRef)(function PaginationPrev({ label = "Previous", asChild = false, className, onClick, children, ...rest }, ref) {
|
|
15
|
+
const { activePage, size, variant, onPageChange } = require_components_client_Pagination_paginationContext.usePaginationContext();
|
|
16
|
+
const controlClass = require_components_client_Pagination_paginationStyles.usePaginationPrevNextClassName(size, variant, className);
|
|
17
|
+
const iconClass = require_components_client_Pagination_paginationStyles.usePaginationIconClassName(size);
|
|
18
|
+
const textClass = require_components_client_Pagination_paginationStyles.usePaginationItemLabelClassName(size);
|
|
19
|
+
const handleClick = (event) => {
|
|
20
|
+
onClick?.(event);
|
|
21
|
+
if (!event.defaultPrevented) onPageChange?.(activePage - 1);
|
|
22
|
+
};
|
|
23
|
+
if (activePage <= 1) return null;
|
|
24
|
+
const Comp = asChild ? Slot : "button";
|
|
25
|
+
const content = children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
26
|
+
name: _yahoo_uds_icons.ChevronLeft,
|
|
27
|
+
size: "sm",
|
|
28
|
+
color: "current",
|
|
29
|
+
className: iconClass,
|
|
30
|
+
"aria-hidden": true
|
|
31
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
32
|
+
className: textClass,
|
|
33
|
+
children: label
|
|
34
|
+
})] });
|
|
35
|
+
if (asChild && (0, react.isValidElement)(children)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
36
|
+
ref,
|
|
37
|
+
type: "button",
|
|
38
|
+
className: controlClass,
|
|
39
|
+
"aria-label": "Go to previous page",
|
|
40
|
+
onClick: handleClick,
|
|
41
|
+
...rest,
|
|
42
|
+
children
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
|
|
45
|
+
ref,
|
|
46
|
+
type: "button",
|
|
47
|
+
className: controlClass,
|
|
48
|
+
"aria-label": "Go to previous page",
|
|
49
|
+
onClick: handleClick,
|
|
50
|
+
...rest,
|
|
51
|
+
children: content
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
PaginationPrev.displayName = "PaginationPrev";
|
|
55
|
+
//#endregion
|
|
56
|
+
exports.PaginationPrev = PaginationPrev;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalPaginationPrevProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Pagination/PaginationPrev.d.ts
|
|
6
|
+
type PaginationPrevProps = UniversalPaginationPrevProps;
|
|
7
|
+
declare const PaginationPrev: _$react.ForwardRefExoticComponent<UniversalPaginationPrevProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { PaginationPrev, type PaginationPrevProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalPaginationPrevProps } from "../../../types/dist/index.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Pagination/PaginationPrev.d.ts
|
|
7
|
+
type PaginationPrevProps = UniversalPaginationPrevProps;
|
|
8
|
+
declare const PaginationPrev: _$react.ForwardRefExoticComponent<UniversalPaginationPrevProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { PaginationPrev, type PaginationPrevProps };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { createSlot } from "../../../utils/createSlot.js";
|
|
4
|
+
import { Icon } from "../../Icon.js";
|
|
5
|
+
import { usePaginationContext } from "./paginationContext.js";
|
|
6
|
+
import { usePaginationIconClassName, usePaginationItemLabelClassName, usePaginationPrevNextClassName } from "./paginationStyles.js";
|
|
7
|
+
import { ChevronLeft } from "@yahoo/uds-icons";
|
|
8
|
+
import { forwardRef, isValidElement } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/client/Pagination/PaginationPrev.tsx
|
|
11
|
+
const Slot = createSlot();
|
|
12
|
+
const PaginationPrev = forwardRef(function PaginationPrev({ label = "Previous", asChild = false, className, onClick, children, ...rest }, ref) {
|
|
13
|
+
const { activePage, size, variant, onPageChange } = usePaginationContext();
|
|
14
|
+
const controlClass = usePaginationPrevNextClassName(size, variant, className);
|
|
15
|
+
const iconClass = usePaginationIconClassName(size);
|
|
16
|
+
const textClass = usePaginationItemLabelClassName(size);
|
|
17
|
+
const handleClick = (event) => {
|
|
18
|
+
onClick?.(event);
|
|
19
|
+
if (!event.defaultPrevented) onPageChange?.(activePage - 1);
|
|
20
|
+
};
|
|
21
|
+
if (activePage <= 1) return null;
|
|
22
|
+
const Comp = asChild ? Slot : "button";
|
|
23
|
+
const content = children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
24
|
+
name: ChevronLeft,
|
|
25
|
+
size: "sm",
|
|
26
|
+
color: "current",
|
|
27
|
+
className: iconClass,
|
|
28
|
+
"aria-hidden": true
|
|
29
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
30
|
+
className: textClass,
|
|
31
|
+
children: label
|
|
32
|
+
})] });
|
|
33
|
+
if (asChild && isValidElement(children)) return /* @__PURE__ */ jsx(Comp, {
|
|
34
|
+
ref,
|
|
35
|
+
type: "button",
|
|
36
|
+
className: controlClass,
|
|
37
|
+
"aria-label": "Go to previous page",
|
|
38
|
+
onClick: handleClick,
|
|
39
|
+
...rest,
|
|
40
|
+
children
|
|
41
|
+
});
|
|
42
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
43
|
+
ref,
|
|
44
|
+
type: "button",
|
|
45
|
+
className: controlClass,
|
|
46
|
+
"aria-label": "Go to previous page",
|
|
47
|
+
onClick: handleClick,
|
|
48
|
+
...rest,
|
|
49
|
+
children: content
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
PaginationPrev.displayName = "PaginationPrev";
|
|
53
|
+
//#endregion
|
|
54
|
+
export { PaginationPrev };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_components_client_Pagination_ellipsisDefault = require("./ellipsisDefault.cjs");
|
|
5
|
+
const require_components_client_Pagination_ellipsisNone = require("./ellipsisNone.cjs");
|
|
6
|
+
//#region src/components/client/Pagination/computeVisiblePages.ts
|
|
7
|
+
const MIN_MAX_VISIBLE_WITH_ELLIPSIS = 3;
|
|
8
|
+
function computeVisiblePages({ activePage, totalPages, maxVisiblePageNumbers, ellipsisPlacement }) {
|
|
9
|
+
const max = ellipsisPlacement === "none" ? Math.max(1, maxVisiblePageNumbers) : Math.max(MIN_MAX_VISIBLE_WITH_ELLIPSIS, maxVisiblePageNumbers);
|
|
10
|
+
if (totalPages <= 0) return [];
|
|
11
|
+
if (typeof ellipsisPlacement === "function") return ellipsisPlacement({
|
|
12
|
+
activePage,
|
|
13
|
+
totalPages,
|
|
14
|
+
maxVisiblePageNumbers: max
|
|
15
|
+
});
|
|
16
|
+
switch (ellipsisPlacement) {
|
|
17
|
+
case "none": return require_components_client_Pagination_ellipsisNone.ellipsisNone(activePage, totalPages, max);
|
|
18
|
+
default: return require_components_client_Pagination_ellipsisDefault.ellipsisDefault(activePage, totalPages, max);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.computeVisiblePages = computeVisiblePages;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { PaginationEllipsisPlacement, PaginationVisibleItem } from "../../../types/dist/index.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/components/client/Pagination/computeVisiblePages.d.ts
|
|
5
|
+
interface ComputeVisiblePagesParams {
|
|
6
|
+
activePage: number;
|
|
7
|
+
totalPages: number;
|
|
8
|
+
maxVisiblePageNumbers: number;
|
|
9
|
+
ellipsisPlacement: PaginationEllipsisPlacement;
|
|
10
|
+
}
|
|
11
|
+
declare function computeVisiblePages({
|
|
12
|
+
activePage,
|
|
13
|
+
totalPages,
|
|
14
|
+
maxVisiblePageNumbers,
|
|
15
|
+
ellipsisPlacement
|
|
16
|
+
}: ComputeVisiblePagesParams): PaginationVisibleItem[];
|
|
17
|
+
//#endregion
|
|
18
|
+
export { ComputeVisiblePagesParams, computeVisiblePages };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { PaginationEllipsisPlacement, PaginationVisibleItem } from "../../../types/dist/index.js";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Pagination/computeVisiblePages.d.ts
|
|
6
|
+
interface ComputeVisiblePagesParams {
|
|
7
|
+
activePage: number;
|
|
8
|
+
totalPages: number;
|
|
9
|
+
maxVisiblePageNumbers: number;
|
|
10
|
+
ellipsisPlacement: PaginationEllipsisPlacement;
|
|
11
|
+
}
|
|
12
|
+
declare function computeVisiblePages({
|
|
13
|
+
activePage,
|
|
14
|
+
totalPages,
|
|
15
|
+
maxVisiblePageNumbers,
|
|
16
|
+
ellipsisPlacement
|
|
17
|
+
}: ComputeVisiblePagesParams): PaginationVisibleItem[];
|
|
18
|
+
//#endregion
|
|
19
|
+
export { ComputeVisiblePagesParams, computeVisiblePages };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { ellipsisDefault } from "./ellipsisDefault.js";
|
|
4
|
+
import { ellipsisNone } from "./ellipsisNone.js";
|
|
5
|
+
//#region src/components/client/Pagination/computeVisiblePages.ts
|
|
6
|
+
const MIN_MAX_VISIBLE_WITH_ELLIPSIS = 3;
|
|
7
|
+
function computeVisiblePages({ activePage, totalPages, maxVisiblePageNumbers, ellipsisPlacement }) {
|
|
8
|
+
const max = ellipsisPlacement === "none" ? Math.max(1, maxVisiblePageNumbers) : Math.max(MIN_MAX_VISIBLE_WITH_ELLIPSIS, maxVisiblePageNumbers);
|
|
9
|
+
if (totalPages <= 0) return [];
|
|
10
|
+
if (typeof ellipsisPlacement === "function") return ellipsisPlacement({
|
|
11
|
+
activePage,
|
|
12
|
+
totalPages,
|
|
13
|
+
maxVisiblePageNumbers: max
|
|
14
|
+
});
|
|
15
|
+
switch (ellipsisPlacement) {
|
|
16
|
+
case "none": return ellipsisNone(activePage, totalPages, max);
|
|
17
|
+
default: return ellipsisDefault(activePage, totalPages, max);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { computeVisiblePages };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
//#region src/components/client/Pagination/ellipsisDefault.ts
|
|
5
|
+
function range(start, end) {
|
|
6
|
+
const result = [];
|
|
7
|
+
for (let i = start; i <= end; i++) result.push(i);
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Pin first and last page when truncated; ellipses only where there is a gap.
|
|
12
|
+
*/
|
|
13
|
+
function ellipsisDefault(activePage, totalPages, maxVisiblePageNumbers) {
|
|
14
|
+
if (totalPages <= maxVisiblePageNumbers) return range(1, totalPages);
|
|
15
|
+
const middleBudget = Math.max(1, maxVisiblePageNumbers - 2);
|
|
16
|
+
const half = Math.floor((middleBudget - 1) / 2);
|
|
17
|
+
let windowStart = Math.max(2, activePage - half);
|
|
18
|
+
const windowEnd = Math.min(totalPages - 1, windowStart + middleBudget - 1);
|
|
19
|
+
windowStart = Math.max(2, windowEnd - middleBudget + 1);
|
|
20
|
+
const pageSet = new Set([1, totalPages]);
|
|
21
|
+
for (let i = windowStart; i <= windowEnd; i++) pageSet.add(i);
|
|
22
|
+
const sorted = [...pageSet].sort((a, b) => a - b);
|
|
23
|
+
const result = [];
|
|
24
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
25
|
+
const page = sorted[i];
|
|
26
|
+
const prev = sorted[i - 1];
|
|
27
|
+
if (i > 0 && page - prev > 1) result.push("ellipsis");
|
|
28
|
+
result.push(page);
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.ellipsisDefault = ellipsisDefault;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import { PaginationVisibleItem } from "../../../types/dist/index.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/components/client/Pagination/ellipsisDefault.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Pin first and last page when truncated; ellipses only where there is a gap.
|
|
7
|
+
*/
|
|
8
|
+
declare function ellipsisDefault(activePage: number, totalPages: number, maxVisiblePageNumbers: number): PaginationVisibleItem[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ellipsisDefault };
|