@digital-b2c/coreui-kit 0.11.9 → 0.11.10

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.d.cts CHANGED
@@ -243,9 +243,13 @@ interface PaginationProps {
243
243
  hasNumber?: boolean;
244
244
  disableArrows?: boolean;
245
245
  onPageChange?: (page: number) => void;
246
+ renderLink?: (props: AnchorHTMLAttributes<HTMLAnchorElement> & {
247
+ page: number;
248
+ children: ReactNode;
249
+ }) => ReactNode;
246
250
  }
247
251
 
248
- declare const Pagination: ({ className, totalPages, currentPage, loop, hasNumber, disableArrows, onPageChange, }: PaginationProps) => react_jsx_runtime.JSX.Element;
252
+ declare const Pagination: ({ className, totalPages, currentPage, loop, hasNumber, disableArrows, onPageChange, renderLink, }: PaginationProps) => react_jsx_runtime.JSX.Element;
249
253
 
250
254
  declare const Picture: ({ className, ...props }: PictureProps) => react_jsx_runtime.JSX.Element;
251
255
 
@@ -794,6 +798,10 @@ declare const FeaturedNewsHighlights: (({ variant, title, items, backgroundColor
794
798
  Title: ({ children }: FeaturedNewsHighlightsTitleProps) => react_jsx_runtime.JSX.Element;
795
799
  };
796
800
 
801
+ type NewsCardListPaginationProps = {
802
+ children: ReactNode;
803
+ };
804
+
797
805
  interface NewsCardListProps extends PropsWithChildren {
798
806
  className?: string;
799
807
  items: NewsCardProps[];
@@ -803,14 +811,14 @@ interface NewsCardListProps extends PropsWithChildren {
803
811
  onSearchSubmit?: (value: string) => void;
804
812
  searchInputProps?: InputProps;
805
813
  currentPage?: number;
806
- onPageChange?: (page: number) => void;
807
- totalPages?: number;
808
814
  renderLink?: (props: React.AnchorHTMLAttributes<HTMLAnchorElement> & {
809
815
  children: React.ReactNode;
810
816
  }) => React.ReactNode;
811
817
  }
812
818
 
813
- declare const NewsCardList: ({ items, backgroundColor, className, currentPage, totalPages, searchValue, onPageChange, onSearchChange, onSearchSubmit, searchInputProps, renderLink, }: NewsCardListProps) => react_jsx_runtime.JSX.Element;
819
+ declare const NewsCardList: (({ items, backgroundColor, className, currentPage, searchValue, onSearchChange, onSearchSubmit, searchInputProps, renderLink, children, }: NewsCardListProps) => react_jsx_runtime.JSX.Element) & {
820
+ Pagination: ({ children }: NewsCardListPaginationProps) => react_jsx_runtime.JSX.Element;
821
+ };
814
822
 
815
823
  type BlogPostBodyProps = {
816
824
  children: ReactNode;
@@ -830,6 +838,10 @@ declare const BlogPost: (({ title, description: body, image, date, tag, relatedA
830
838
  Body: ({ children }: BlogPostBodyProps) => react_jsx_runtime.JSX.Element;
831
839
  };
832
840
 
841
+ type BlogSearchResultsListPaginationProps = {
842
+ children: ReactNode;
843
+ };
844
+
833
845
  type BlogSearchResultsListSearchProps = {
834
846
  children: ReactNode;
835
847
  };
@@ -841,16 +853,14 @@ interface BlogSearchResultsListProps extends PropsWithChildren {
841
853
  searchValue: string;
842
854
  onSearchChange: (value: string) => void;
843
855
  onSearchSubmit: (value: string) => void;
844
- currentPage?: number;
845
- onPageChange?: (page: number) => void;
846
- totalPages?: number;
847
856
  renderLink?: (props: React.AnchorHTMLAttributes<HTMLAnchorElement> & {
848
857
  children: React.ReactNode;
849
858
  }) => React.ReactNode;
850
859
  }
851
860
 
852
- declare const BlogSearchResultsList: (({ items, searchResult, onSearchChange, onSearchSubmit, onPageChange, searchValue, currentPage, totalPages, className, renderLink, children, }: BlogSearchResultsListProps) => react_jsx_runtime.JSX.Element) & {
861
+ declare const BlogSearchResultsList: (({ items, searchResult, onSearchChange, onSearchSubmit, searchValue, className, renderLink, children, }: BlogSearchResultsListProps) => react_jsx_runtime.JSX.Element) & {
853
862
  Search: ({ children }: BlogSearchResultsListSearchProps) => react_jsx_runtime.JSX.Element;
863
+ Pagination: ({ children, }: BlogSearchResultsListPaginationProps) => react_jsx_runtime.JSX.Element;
854
864
  };
855
865
 
856
866
  type IntersectionObserverOptions = {
package/dist/index.d.ts CHANGED
@@ -243,9 +243,13 @@ interface PaginationProps {
243
243
  hasNumber?: boolean;
244
244
  disableArrows?: boolean;
245
245
  onPageChange?: (page: number) => void;
246
+ renderLink?: (props: AnchorHTMLAttributes<HTMLAnchorElement> & {
247
+ page: number;
248
+ children: ReactNode;
249
+ }) => ReactNode;
246
250
  }
247
251
 
248
- declare const Pagination: ({ className, totalPages, currentPage, loop, hasNumber, disableArrows, onPageChange, }: PaginationProps) => react_jsx_runtime.JSX.Element;
252
+ declare const Pagination: ({ className, totalPages, currentPage, loop, hasNumber, disableArrows, onPageChange, renderLink, }: PaginationProps) => react_jsx_runtime.JSX.Element;
249
253
 
250
254
  declare const Picture: ({ className, ...props }: PictureProps) => react_jsx_runtime.JSX.Element;
251
255
 
@@ -794,6 +798,10 @@ declare const FeaturedNewsHighlights: (({ variant, title, items, backgroundColor
794
798
  Title: ({ children }: FeaturedNewsHighlightsTitleProps) => react_jsx_runtime.JSX.Element;
795
799
  };
796
800
 
801
+ type NewsCardListPaginationProps = {
802
+ children: ReactNode;
803
+ };
804
+
797
805
  interface NewsCardListProps extends PropsWithChildren {
798
806
  className?: string;
799
807
  items: NewsCardProps[];
@@ -803,14 +811,14 @@ interface NewsCardListProps extends PropsWithChildren {
803
811
  onSearchSubmit?: (value: string) => void;
804
812
  searchInputProps?: InputProps;
805
813
  currentPage?: number;
806
- onPageChange?: (page: number) => void;
807
- totalPages?: number;
808
814
  renderLink?: (props: React.AnchorHTMLAttributes<HTMLAnchorElement> & {
809
815
  children: React.ReactNode;
810
816
  }) => React.ReactNode;
811
817
  }
812
818
 
813
- declare const NewsCardList: ({ items, backgroundColor, className, currentPage, totalPages, searchValue, onPageChange, onSearchChange, onSearchSubmit, searchInputProps, renderLink, }: NewsCardListProps) => react_jsx_runtime.JSX.Element;
819
+ declare const NewsCardList: (({ items, backgroundColor, className, currentPage, searchValue, onSearchChange, onSearchSubmit, searchInputProps, renderLink, children, }: NewsCardListProps) => react_jsx_runtime.JSX.Element) & {
820
+ Pagination: ({ children }: NewsCardListPaginationProps) => react_jsx_runtime.JSX.Element;
821
+ };
814
822
 
815
823
  type BlogPostBodyProps = {
816
824
  children: ReactNode;
@@ -830,6 +838,10 @@ declare const BlogPost: (({ title, description: body, image, date, tag, relatedA
830
838
  Body: ({ children }: BlogPostBodyProps) => react_jsx_runtime.JSX.Element;
831
839
  };
832
840
 
841
+ type BlogSearchResultsListPaginationProps = {
842
+ children: ReactNode;
843
+ };
844
+
833
845
  type BlogSearchResultsListSearchProps = {
834
846
  children: ReactNode;
835
847
  };
@@ -841,16 +853,14 @@ interface BlogSearchResultsListProps extends PropsWithChildren {
841
853
  searchValue: string;
842
854
  onSearchChange: (value: string) => void;
843
855
  onSearchSubmit: (value: string) => void;
844
- currentPage?: number;
845
- onPageChange?: (page: number) => void;
846
- totalPages?: number;
847
856
  renderLink?: (props: React.AnchorHTMLAttributes<HTMLAnchorElement> & {
848
857
  children: React.ReactNode;
849
858
  }) => React.ReactNode;
850
859
  }
851
860
 
852
- declare const BlogSearchResultsList: (({ items, searchResult, onSearchChange, onSearchSubmit, onPageChange, searchValue, currentPage, totalPages, className, renderLink, children, }: BlogSearchResultsListProps) => react_jsx_runtime.JSX.Element) & {
861
+ declare const BlogSearchResultsList: (({ items, searchResult, onSearchChange, onSearchSubmit, searchValue, className, renderLink, children, }: BlogSearchResultsListProps) => react_jsx_runtime.JSX.Element) & {
853
862
  Search: ({ children }: BlogSearchResultsListSearchProps) => react_jsx_runtime.JSX.Element;
863
+ Pagination: ({ children, }: BlogSearchResultsListPaginationProps) => react_jsx_runtime.JSX.Element;
854
864
  };
855
865
 
856
866
  type IntersectionObserverOptions = {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import clsx15 from 'clsx';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import React64, { forwardRef, useId, useRef, useState, useCallback, useMemo, Children, isValidElement, useEffect } from 'react';
3
+ import React65, { forwardRef, useId, useRef, useState, useCallback, useMemo, Children, isValidElement, useEffect, Fragment as Fragment$1 } from 'react';
4
4
  import gsap$1, { gsap } from 'gsap';
5
5
  import { useGSAP } from '@gsap/react';
6
6
  import { ScrollTrigger } from 'gsap/ScrollTrigger';
@@ -374,7 +374,7 @@ var svgs = {
374
374
  xBlack: icon_x_black_default,
375
375
  xWhite: icon_x_white_default
376
376
  };
377
- var Icon = React64.memo(
377
+ var Icon = React65.memo(
378
378
  (_a) => {
379
379
  var _b = _a, { type, size } = _b, props = __objRest(_b, ["type", "size"]);
380
380
  if (type) {
@@ -1129,7 +1129,8 @@ var Pagination = ({
1129
1129
  loop = true,
1130
1130
  hasNumber = false,
1131
1131
  disableArrows = false,
1132
- onPageChange
1132
+ onPageChange,
1133
+ renderLink
1133
1134
  }) => {
1134
1135
  const [activePage, setActivePage] = useState(currentPage);
1135
1136
  const goToPage = (page) => {
@@ -1161,8 +1162,15 @@ var Pagination = ({
1161
1162
  setActivePage(page);
1162
1163
  onPageChange == null ? void 0 : onPageChange(page);
1163
1164
  };
1165
+ const prevPage = activePage === 1 ? loop ? totalPages : 1 : activePage - 1;
1166
+ const nextPage = activePage === totalPages ? loop ? 1 : totalPages : activePage + 1;
1164
1167
  return /* @__PURE__ */ jsxs("div", { className: clsx15(Pagination_module_default.pagination, className), children: [
1165
- !disableArrows && /* @__PURE__ */ jsx(
1168
+ !disableArrows && (renderLink ? renderLink({
1169
+ page: prevPage,
1170
+ className: Pagination_module_default.prev,
1171
+ "aria-label": "Go to previous page",
1172
+ children: /* @__PURE__ */ jsx(Icon, { type: "filledChevronLeft" })
1173
+ }) : /* @__PURE__ */ jsx(
1166
1174
  "button",
1167
1175
  {
1168
1176
  className: Pagination_module_default.prev,
@@ -1171,24 +1179,35 @@ var Pagination = ({
1171
1179
  "aria-label": "Go to previous page",
1172
1180
  children: /* @__PURE__ */ jsx(Icon, { type: "filledChevronLeft" })
1173
1181
  }
1174
- ),
1182
+ )),
1175
1183
  /* @__PURE__ */ jsx("div", { className: Pagination_module_default.pages, children: Array.from({ length: totalPages }, (_, i) => {
1176
1184
  const page = i + 1;
1177
- return /* @__PURE__ */ jsx(
1185
+ const pageClassName = clsx15(Pagination_module_default.page, {
1186
+ [Pagination_module_default.active]: activePage === page,
1187
+ [Pagination_module_default.number]: hasNumber
1188
+ });
1189
+ return renderLink ? /* @__PURE__ */ jsx(Fragment$1, { children: renderLink({
1190
+ page,
1191
+ className: pageClassName,
1192
+ "aria-label": `Go to page ${page}`,
1193
+ children: hasNumber ? page : null
1194
+ }) }, page) : /* @__PURE__ */ jsx(
1178
1195
  "button",
1179
1196
  {
1180
1197
  onClick: () => goToPage(page),
1181
- className: clsx15(Pagination_module_default.page, {
1182
- [Pagination_module_default.active]: activePage === page,
1183
- [Pagination_module_default.number]: hasNumber
1184
- }),
1198
+ className: pageClassName,
1185
1199
  "aria-label": `Go to page ${page}`,
1186
1200
  children: hasNumber ? page : null
1187
1201
  },
1188
1202
  page
1189
1203
  );
1190
1204
  }) }),
1191
- !disableArrows && /* @__PURE__ */ jsx(
1205
+ !disableArrows && (renderLink ? renderLink({
1206
+ page: nextPage,
1207
+ className: Pagination_module_default.next,
1208
+ "aria-label": "Go to next page",
1209
+ children: /* @__PURE__ */ jsx(Icon, { type: "filledChevronRight" })
1210
+ }) : /* @__PURE__ */ jsx(
1192
1211
  "button",
1193
1212
  {
1194
1213
  className: Pagination_module_default.next,
@@ -1197,7 +1216,7 @@ var Pagination = ({
1197
1216
  "aria-label": "Go to next page",
1198
1217
  children: /* @__PURE__ */ jsx(Icon, { type: "filledChevronRight" })
1199
1218
  }
1200
- )
1219
+ ))
1201
1220
  ] });
1202
1221
  };
1203
1222
 
@@ -3620,21 +3639,27 @@ var NewsCardList_module_default = {
3620
3639
  "end-action-button": "NewsCardList_module_end-action-button",
3621
3640
  pagination: "NewsCardList_module_pagination"
3622
3641
  };
3642
+ var NewsCardListPagination = ({ children }) => {
3643
+ return /* @__PURE__ */ jsx(Fragment, { children });
3644
+ };
3623
3645
  var NewsCardList = ({
3624
3646
  items,
3625
3647
  backgroundColor,
3626
3648
  className,
3627
3649
  currentPage,
3628
- totalPages = 0,
3629
3650
  searchValue,
3630
- onPageChange,
3631
3651
  onSearchChange,
3632
3652
  onSearchSubmit,
3633
3653
  searchInputProps,
3634
- renderLink
3654
+ renderLink,
3655
+ children
3635
3656
  }) => {
3636
3657
  const featuredCards = items.slice(0, 4);
3637
3658
  const cards = currentPage !== 1 ? items : items.slice(4);
3659
+ const slots = resolveCompoundSlots(children, {
3660
+ pagination: NewsCardListPagination
3661
+ });
3662
+ const paginationNode = slots.pagination;
3638
3663
  return /* @__PURE__ */ jsx(
3639
3664
  "div",
3640
3665
  {
@@ -3679,21 +3704,19 @@ var NewsCardList = ({
3679
3704
  /* @__PURE__ */ jsx(BlogCardGrid2, { items: cards, hasContainer: false, renderLink })
3680
3705
  ] })
3681
3706
  ] }),
3682
- totalPages ? /* @__PURE__ */ jsx(
3683
- Pagination,
3684
- {
3685
- currentPage: currentPage || 1,
3686
- totalPages: totalPages || 0,
3687
- onPageChange,
3688
- className: clsx15("pagination", NewsCardList_module_default["pagination"]),
3689
- hasNumber: true
3690
- }
3691
- ) : null
3707
+ paginationNode ? React65.cloneElement(paginationNode, {
3708
+ className: clsx15("pagination", NewsCardList_module_default["pagination"])
3709
+ }) : null
3692
3710
  ] })
3693
3711
  }
3694
3712
  );
3695
3713
  };
3696
3714
 
3715
+ // src/widgets/NewsCardList/index.ts
3716
+ var NewsCardList2 = Object.assign(NewsCardList, {
3717
+ Pagination: NewsCardListPagination
3718
+ });
3719
+
3697
3720
  // src/widgets/BlogPost/BlogPost.module.scss
3698
3721
  var BlogPost_module_default = {
3699
3722
  "blog-post": "BlogPost_module_blog-post",
@@ -3773,26 +3796,30 @@ var BlogSearchResultsList_module_default = {
3773
3796
  "end-action-button": "BlogSearchResultsList_module_end-action-button",
3774
3797
  pagination: "BlogSearchResultsList_module_pagination"
3775
3798
  };
3799
+ var BlogSearchResultsListPagination = ({
3800
+ children
3801
+ }) => {
3802
+ return /* @__PURE__ */ jsx(Fragment, { children });
3803
+ };
3776
3804
  var BlogSearchResultsList = ({
3777
3805
  items,
3778
3806
  searchResult,
3779
3807
  onSearchChange,
3780
3808
  onSearchSubmit,
3781
- onPageChange,
3782
3809
  searchValue,
3783
- currentPage,
3784
- totalPages = 0,
3785
3810
  className,
3786
3811
  renderLink,
3787
3812
  children
3788
3813
  }) => {
3789
3814
  var _a;
3790
3815
  const slots = resolveCompoundSlots(children, {
3791
- search: BlogSearchResultsListSearch
3816
+ search: BlogSearchResultsListSearch,
3817
+ pagination: BlogSearchResultsListPagination
3792
3818
  });
3793
3819
  const searchNode = (_a = slots.search) != null ? _a : searchResult;
3820
+ const paginationNode = slots.pagination;
3794
3821
  return /* @__PURE__ */ jsx("div", { className: clsx15("search-results-list", BlogSearchResultsList_module_default["search-results-list"], className), children: /* @__PURE__ */ jsxs(Container, { className: clsx15("container", BlogSearchResultsList_module_default["container"]), children: [
3795
- typeof searchNode === "string" ? /* @__PURE__ */ jsx("span", { className: clsx15("search-result", BlogSearchResultsList_module_default["search-result"]), children: searchNode }) : React64.isValidElement(searchNode) ? React64.cloneElement(searchNode, {
3822
+ typeof searchNode === "string" ? /* @__PURE__ */ jsx("span", { className: clsx15("search-result", BlogSearchResultsList_module_default["search-result"]), children: searchNode }) : React65.isValidElement(searchNode) ? React65.cloneElement(searchNode, {
3796
3823
  className: clsx15("search-result", BlogSearchResultsList_module_default["search-result"])
3797
3824
  }) : null,
3798
3825
  /* @__PURE__ */ jsxs("div", { className: clsx15("wrapper", BlogSearchResultsList_module_default["wrapper"]), children: [
@@ -3820,22 +3847,16 @@ var BlogSearchResultsList = ({
3820
3847
  ),
3821
3848
  /* @__PURE__ */ jsx(BlogCardGrid2, { items, hasContainer: false, renderLink })
3822
3849
  ] }),
3823
- totalPages ? /* @__PURE__ */ jsx(
3824
- Pagination,
3825
- {
3826
- currentPage: currentPage || 1,
3827
- totalPages: totalPages || 0,
3828
- onPageChange,
3829
- className: clsx15("pagination", BlogSearchResultsList_module_default["pagination"]),
3830
- hasNumber: true
3831
- }
3832
- ) : null
3850
+ paginationNode ? React65.cloneElement(paginationNode, {
3851
+ className: clsx15("pagination", BlogSearchResultsList_module_default["pagination"])
3852
+ }) : null
3833
3853
  ] }) });
3834
3854
  };
3835
3855
 
3836
3856
  // src/widgets/BlogSearchResultsList/index.ts
3837
3857
  var BlogSearchResultsList2 = Object.assign(BlogSearchResultsList, {
3838
- Search: BlogSearchResultsListSearch
3858
+ Search: BlogSearchResultsListSearch,
3859
+ Pagination: BlogSearchResultsListPagination
3839
3860
  });
3840
3861
  function useIntersectionObserver({
3841
3862
  animateOnce = false,
@@ -3866,6 +3887,6 @@ function useIntersectionObserver({
3866
3887
  return { observeRef, isVisible };
3867
3888
  }
3868
3889
 
3869
- export { Anchor, Badge, BlogCardGrid2 as BlogCardGrid, BlogPost2 as BlogPost, BlogSearchResultsList2 as BlogSearchResultsList, BrandsStrip, Button, Card2 as Card, CardCollection2 as CardCollection, ConditionalWrapper, ContactModule2 as ContactModule, Container, CountingCard2 as CountingCard, EventList2 as EventList, FeaturedNewsHighlights2 as FeaturedNewsHighlights, FilterBar, Footer, HeroBanner2 as HeroBanner, HeroBannerCarousel, Icon, InfoCard2 as InfoCard, Input, InternalBrandsTab2 as InternalBrandsTab, MiniBanner2 as MiniBanner, MiniSectionCta2 as MiniSectionCta, NewsCard, NewsCardList, Pagination, Picture, PracticeCard, PracticePathCards2 as PracticePathCards, ResourceCardItem, ResourcesGridList, Sidebar, Teaser5050With3Text2 as Teaser5050With3Text, Teaser5050WithCta2 as Teaser5050WithCta, TextBody2 as TextBody, TextCenterCtaInBottom2 as TextCenterCtaInBottom, TextEvent2 as TextEvent, UpcomingEventCard, resolveCompoundSlots, svgs, useIntersectionObserver };
3890
+ export { Anchor, Badge, BlogCardGrid2 as BlogCardGrid, BlogPost2 as BlogPost, BlogSearchResultsList2 as BlogSearchResultsList, BrandsStrip, Button, Card2 as Card, CardCollection2 as CardCollection, ConditionalWrapper, ContactModule2 as ContactModule, Container, CountingCard2 as CountingCard, EventList2 as EventList, FeaturedNewsHighlights2 as FeaturedNewsHighlights, FilterBar, Footer, HeroBanner2 as HeroBanner, HeroBannerCarousel, Icon, InfoCard2 as InfoCard, Input, InternalBrandsTab2 as InternalBrandsTab, MiniBanner2 as MiniBanner, MiniSectionCta2 as MiniSectionCta, NewsCard, NewsCardList2 as NewsCardList, Pagination, Picture, PracticeCard, PracticePathCards2 as PracticePathCards, ResourceCardItem, ResourcesGridList, Sidebar, Teaser5050With3Text2 as Teaser5050With3Text, Teaser5050WithCta2 as Teaser5050WithCta, TextBody2 as TextBody, TextCenterCtaInBottom2 as TextCenterCtaInBottom, TextEvent2 as TextEvent, UpcomingEventCard, resolveCompoundSlots, svgs, useIntersectionObserver };
3870
3891
  //# sourceMappingURL=index.mjs.map
3871
3892
  //# sourceMappingURL=index.mjs.map