@thecb/components 7.8.2-beta.3 → 7.8.2-beta.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "7.8.2-beta.3",
3
+ "version": "7.8.2-beta.5",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -13,6 +13,7 @@ export interface ClusterProps {
13
13
  justifySelf?: string;
14
14
  alignSelf?: string;
15
15
  flexGrow?: string;
16
+ innerWrapperAs?: string;
16
17
  }
17
18
 
18
19
  export const Cluster: React.FC<Expand<ClusterProps> &
@@ -68,19 +68,23 @@ export const getPagesPanel = (page, pagesCount) => {
68
68
  const space = page === 1 ? PAGING_INIT_SPACE : PAGING_SPACE;
69
69
  const pages = [{ index: 1, isButton: true }];
70
70
  if (page > space + 1) {
71
- pages.push({ isDelimiter: true });
71
+ pages.push({ isDelimiter: true, id: "first-delimiter" });
72
72
  }
73
73
  for (
74
74
  let j = Math.max(1, page - space) + 1;
75
75
  j < Math.min(lastPageNumber, page + space);
76
76
  j++
77
77
  ) {
78
- pages.push({ index: j, isButton: true });
78
+ pages.push({ index: j, isButton: true, id: `page-${j}` });
79
79
  }
80
80
  if (page < lastPageNumber - space) {
81
- pages.push({ isDelimiter: true });
81
+ pages.push({ isDelimiter: true, id: "last-delimiter" });
82
82
  }
83
- pages.push({ index: lastPageNumber, isButton: true });
83
+ pages.push({
84
+ index: lastPageNumber,
85
+ isButton: true,
86
+ id: `page-${lastPageNumber}`
87
+ });
84
88
  const activePage = pages.find(p => p.index === page);
85
89
  if (activePage) {
86
90
  activePage.active = true;
@@ -103,6 +107,7 @@ const Pagination = ({
103
107
  pageNext,
104
108
  pagePrevious,
105
109
  setCurrentPage,
110
+ ariaLabel,
106
111
  themeValues
107
112
  }) => {
108
113
  const { isMobile } = useContext(ThemeContext);
@@ -144,7 +149,9 @@ const Pagination = ({
144
149
  childGap={childGap}
145
150
  overflow={true}
146
151
  as="nav"
152
+ role="navigation"
147
153
  innerWrapperAs="ul"
154
+ aria-label={ariaLabel}
148
155
  extraStyles="> ul { padding: 0px; > li { list-style-type: none; } };"
149
156
  >
150
157
  {currentPage > 1 ? (
@@ -187,10 +194,10 @@ const Pagination = ({
187
194
  padding="0"
188
195
  extraStyles={`max-height: ${buttonHeight};`}
189
196
  as="li"
197
+ key={item.id}
190
198
  >
191
199
  <ButtonWithAction
192
200
  variant="ghost"
193
- key={item.index}
194
201
  text={item.index}
195
202
  disabled={item.active}
196
203
  extraDisabledStyles={extraDisabledStyles}
@@ -211,10 +218,9 @@ const Pagination = ({
211
218
  </ButtonWithAction>
212
219
  </Box>
213
220
  ) : (
214
- <Box padding="0 10px">
221
+ <Box padding="0 10px" as="li" key={item.id}>
215
222
  <Cluster justify="flex-end">
216
223
  <Text
217
- key={index}
218
224
  variant="pXL"
219
225
  weight={fontWeight}
220
226
  color={numberColor ?? themeValues.numberColor}
@@ -14,6 +14,7 @@ export interface PaginationProps {
14
14
  fontWeight?: string;
15
15
  numberColor?: string;
16
16
  pageCount: number;
17
+ ariaLabel?: string;
17
18
  pageNext: () => void;
18
19
  pagePrevious: () => void;
19
20
  setCurrentPage: ({ currentPage: number }) => void;