@digital-b2c/coreui-kit 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -21
- package/README.md +52 -52
- package/dist/index.cjs +45 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +20 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +45 -9
- package/dist/index.mjs.map +1 -1
- package/dist/types/global.d.ts +25 -25
- package/package.json +100 -100
package/dist/index.d.cts
CHANGED
|
@@ -247,13 +247,17 @@ interface PaginationProps {
|
|
|
247
247
|
hasNumber?: boolean;
|
|
248
248
|
disableArrows?: boolean;
|
|
249
249
|
onPageChange?: (page: number) => void;
|
|
250
|
+
showEllipsis?: boolean;
|
|
251
|
+
siblingCount?: number;
|
|
252
|
+
boundaryCount?: number;
|
|
253
|
+
hidePagesBorder?: boolean;
|
|
250
254
|
renderLink?: (props: AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
251
255
|
page: number;
|
|
252
256
|
children: ReactNode;
|
|
253
257
|
}) => ReactNode;
|
|
254
258
|
}
|
|
255
259
|
|
|
256
|
-
declare const Pagination: ({ className, totalPages, currentPage, loop, hasNumber, disableArrows, onPageChange, renderLink, }: PaginationProps) => react_jsx_runtime.JSX.Element;
|
|
260
|
+
declare const Pagination: ({ className, totalPages, currentPage, loop, hasNumber, disableArrows, onPageChange, showEllipsis, boundaryCount, siblingCount, hidePagesBorder, renderLink, }: PaginationProps) => react_jsx_runtime.JSX.Element;
|
|
257
261
|
|
|
258
262
|
declare const Picture: ({ className, ...props }: PictureProps) => react_jsx_runtime.JSX.Element;
|
|
259
263
|
|
|
@@ -712,7 +716,7 @@ interface Teaser5050WithCtaProps {
|
|
|
712
716
|
variant?: 'left' | 'right';
|
|
713
717
|
title?: ReactNode;
|
|
714
718
|
subtitle?: ReactNode;
|
|
715
|
-
ctas
|
|
719
|
+
ctas: ICtaLogo[];
|
|
716
720
|
image?: PictureProps;
|
|
717
721
|
children?: ReactNode;
|
|
718
722
|
bgColor?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -247,13 +247,17 @@ interface PaginationProps {
|
|
|
247
247
|
hasNumber?: boolean;
|
|
248
248
|
disableArrows?: boolean;
|
|
249
249
|
onPageChange?: (page: number) => void;
|
|
250
|
+
showEllipsis?: boolean;
|
|
251
|
+
siblingCount?: number;
|
|
252
|
+
boundaryCount?: number;
|
|
253
|
+
hidePagesBorder?: boolean;
|
|
250
254
|
renderLink?: (props: AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
251
255
|
page: number;
|
|
252
256
|
children: ReactNode;
|
|
253
257
|
}) => ReactNode;
|
|
254
258
|
}
|
|
255
259
|
|
|
256
|
-
declare const Pagination: ({ className, totalPages, currentPage, loop, hasNumber, disableArrows, onPageChange, renderLink, }: PaginationProps) => react_jsx_runtime.JSX.Element;
|
|
260
|
+
declare const Pagination: ({ className, totalPages, currentPage, loop, hasNumber, disableArrows, onPageChange, showEllipsis, boundaryCount, siblingCount, hidePagesBorder, renderLink, }: PaginationProps) => react_jsx_runtime.JSX.Element;
|
|
257
261
|
|
|
258
262
|
declare const Picture: ({ className, ...props }: PictureProps) => react_jsx_runtime.JSX.Element;
|
|
259
263
|
|
|
@@ -712,7 +716,7 @@ interface Teaser5050WithCtaProps {
|
|
|
712
716
|
variant?: 'left' | 'right';
|
|
713
717
|
title?: ReactNode;
|
|
714
718
|
subtitle?: ReactNode;
|
|
715
|
-
ctas
|
|
719
|
+
ctas: ICtaLogo[];
|
|
716
720
|
image?: PictureProps;
|
|
717
721
|
children?: ReactNode;
|
|
718
722
|
bgColor?: string;
|
package/dist/index.mjs
CHANGED
|
@@ -506,15 +506,15 @@ var useViewPort = () => {
|
|
|
506
506
|
window.addEventListener("resize", onWindowResizeDebounce);
|
|
507
507
|
return () => window.removeEventListener("resize", onWindowResizeDebounce);
|
|
508
508
|
}, [onWindowResizeDebounce]);
|
|
509
|
-
const is = (what,
|
|
509
|
+
const is = (what, range2) => {
|
|
510
510
|
const isArray = Array.isArray(what);
|
|
511
|
-
if (!
|
|
511
|
+
if (!range2 && !isArray) {
|
|
512
512
|
return what === device;
|
|
513
513
|
}
|
|
514
|
-
if (!
|
|
514
|
+
if (!range2 && isArray) {
|
|
515
515
|
return device ? what.includes(device) : false;
|
|
516
516
|
}
|
|
517
|
-
const list =
|
|
517
|
+
const list = range2 === "above" ? ORDER : [...ORDER].reverse();
|
|
518
518
|
const devices = getOtherDevices(list, what, true);
|
|
519
519
|
return device && devices.includes(device);
|
|
520
520
|
};
|
|
@@ -1113,6 +1113,31 @@ var InfoCard2 = Object.assign(InfoCard, {
|
|
|
1113
1113
|
Subtitle: InfoCardSubtitle
|
|
1114
1114
|
});
|
|
1115
1115
|
|
|
1116
|
+
// src/utils/getPaginationRange.ts
|
|
1117
|
+
var DOTS = "...";
|
|
1118
|
+
var range = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
1119
|
+
var getPaginationRange = (totalPages, currentPage, siblingCount = 1, boundaryCount = 1) => {
|
|
1120
|
+
const totalPageNumbers = siblingCount * 2 + boundaryCount * 2 + 3;
|
|
1121
|
+
if (totalPageNumbers >= totalPages) {
|
|
1122
|
+
return range(1, totalPages);
|
|
1123
|
+
}
|
|
1124
|
+
const leftSiblingIndex = Math.max(currentPage - siblingCount, boundaryCount + 1);
|
|
1125
|
+
const rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages - boundaryCount);
|
|
1126
|
+
const showLeftDots = leftSiblingIndex > boundaryCount + 2;
|
|
1127
|
+
const showRightDots = rightSiblingIndex < totalPages - boundaryCount - 1;
|
|
1128
|
+
const firstPages = range(1, boundaryCount);
|
|
1129
|
+
const lastPages = range(totalPages - boundaryCount + 1, totalPages);
|
|
1130
|
+
if (!showLeftDots && showRightDots) {
|
|
1131
|
+
const leftRange = range(1, boundaryCount + siblingCount * 2 + 2);
|
|
1132
|
+
return [...leftRange, DOTS, ...lastPages];
|
|
1133
|
+
}
|
|
1134
|
+
if (showLeftDots && !showRightDots) {
|
|
1135
|
+
const rightRange = range(totalPages - (boundaryCount + siblingCount * 2 + 1), totalPages);
|
|
1136
|
+
return [...firstPages, DOTS, ...rightRange];
|
|
1137
|
+
}
|
|
1138
|
+
return [...firstPages, DOTS, ...range(leftSiblingIndex, rightSiblingIndex), DOTS, ...lastPages];
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1116
1141
|
// src/components/Pagination/Pagination.module.scss
|
|
1117
1142
|
var Pagination_module_default = {
|
|
1118
1143
|
pagination: "Pagination_module_pagination",
|
|
@@ -1120,8 +1145,10 @@ var Pagination_module_default = {
|
|
|
1120
1145
|
prev: "Pagination_module_prev",
|
|
1121
1146
|
pages: "Pagination_module_pages",
|
|
1122
1147
|
page: "Pagination_module_page",
|
|
1148
|
+
"no-border": "Pagination_module_no-border",
|
|
1149
|
+
number: "Pagination_module_number",
|
|
1123
1150
|
active: "Pagination_module_active",
|
|
1124
|
-
|
|
1151
|
+
dots: "Pagination_module_dots"
|
|
1125
1152
|
};
|
|
1126
1153
|
var Pagination = ({
|
|
1127
1154
|
className,
|
|
@@ -1131,6 +1158,10 @@ var Pagination = ({
|
|
|
1131
1158
|
hasNumber = false,
|
|
1132
1159
|
disableArrows = false,
|
|
1133
1160
|
onPageChange,
|
|
1161
|
+
showEllipsis,
|
|
1162
|
+
boundaryCount,
|
|
1163
|
+
siblingCount,
|
|
1164
|
+
hidePagesBorder = false,
|
|
1134
1165
|
renderLink
|
|
1135
1166
|
}) => {
|
|
1136
1167
|
const [activePage, setActivePage] = useState(currentPage);
|
|
@@ -1165,6 +1196,7 @@ var Pagination = ({
|
|
|
1165
1196
|
};
|
|
1166
1197
|
const prevPage = activePage === 1 ? loop ? totalPages : 1 : activePage - 1;
|
|
1167
1198
|
const nextPage = activePage === totalPages ? loop ? 1 : totalPages : activePage + 1;
|
|
1199
|
+
const pageItems = showEllipsis ? getPaginationRange(totalPages, activePage, siblingCount, boundaryCount) : Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
1168
1200
|
return /* @__PURE__ */ jsxs("div", { className: clsx16(Pagination_module_default.pagination, className), children: [
|
|
1169
1201
|
!disableArrows && (renderLink ? renderLink({
|
|
1170
1202
|
page: prevPage,
|
|
@@ -1181,11 +1213,15 @@ var Pagination = ({
|
|
|
1181
1213
|
children: /* @__PURE__ */ jsx(Icon, { type: "filledChevronLeft" })
|
|
1182
1214
|
}
|
|
1183
1215
|
)),
|
|
1184
|
-
/* @__PURE__ */ jsx("div", { className: Pagination_module_default.pages, children:
|
|
1185
|
-
|
|
1216
|
+
/* @__PURE__ */ jsx("div", { className: Pagination_module_default.pages, children: pageItems.map((item, index) => {
|
|
1217
|
+
if (item === "...") {
|
|
1218
|
+
return /* @__PURE__ */ jsx("span", { className: Pagination_module_default.dots, "aria-hidden": "true", children: "\u2026" }, `dots-${index}`);
|
|
1219
|
+
}
|
|
1220
|
+
const page = item;
|
|
1186
1221
|
const pageClassName = clsx16(Pagination_module_default.page, {
|
|
1187
1222
|
[Pagination_module_default.active]: activePage === page,
|
|
1188
|
-
[Pagination_module_default.number]: hasNumber
|
|
1223
|
+
[Pagination_module_default.number]: hasNumber,
|
|
1224
|
+
[Pagination_module_default["no-border"]]: hidePagesBorder
|
|
1189
1225
|
});
|
|
1190
1226
|
return renderLink ? /* @__PURE__ */ jsx(Fragment$1, { children: renderLink({
|
|
1191
1227
|
page,
|
|
@@ -3362,7 +3398,7 @@ var Teaser5050WithCta = ({
|
|
|
3362
3398
|
titleNode && /* @__PURE__ */ jsx("div", { className: clsx16(Teaser5050WithCta_module_default.title, "h3"), children: titleNode }),
|
|
3363
3399
|
subtitleNode && /* @__PURE__ */ jsx("div", { className: "subheading", children: subtitleNode })
|
|
3364
3400
|
] }),
|
|
3365
|
-
|
|
3401
|
+
/* @__PURE__ */ jsx("div", { className: Teaser5050WithCta_module_default.ctaWrapper, children: ctas.map((cta, key) => /* @__PURE__ */ jsx(
|
|
3366
3402
|
Button,
|
|
3367
3403
|
{
|
|
3368
3404
|
className: Teaser5050WithCta_module_default.cta,
|