@thecb/components 7.8.2-beta.4 → 7.8.2-beta.6

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.4",
3
+ "version": "7.8.2-beta.6",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -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;
@@ -126,7 +130,7 @@ const Pagination = ({
126
130
  }
127
131
  `;
128
132
 
129
- const extraDisabledStyles = `
133
+ const currentPageStyles = `
130
134
  border: ${activeBorderWidth} solid ${numberColor ??
131
135
  themeValues.numberColor};
132
136
  color: ${numberColor ?? themeValues.activeColor};
@@ -136,6 +140,9 @@ const Pagination = ({
136
140
  }
137
141
  &:hover {
138
142
  background-color: initial;
143
+ border: ${activeBorderWidth} solid ${numberColor ??
144
+ themeValues.numberColor};
145
+ background-color: ${themeValues.activeBackgroundColor};
139
146
  }
140
147
  `;
141
148
 
@@ -145,6 +152,7 @@ const Pagination = ({
145
152
  childGap={childGap}
146
153
  overflow={true}
147
154
  as="nav"
155
+ role="navigation"
148
156
  innerWrapperAs="ul"
149
157
  aria-label={ariaLabel}
150
158
  extraStyles="> ul { padding: 0px; > li { list-style-type: none; } };"
@@ -152,7 +160,7 @@ const Pagination = ({
152
160
  {currentPage > 1 ? (
153
161
  <PrevNextButton
154
162
  action={pagePrevious}
155
- ariaLabel={`Previous Page Button`}
163
+ ariaLabel={`Previous Page`}
156
164
  arrowColor={arrowColor ?? themeValues.arrowColor}
157
165
  borderRadius={borderRadius}
158
166
  buttonHeight={buttonHeight}
@@ -189,36 +197,37 @@ const Pagination = ({
189
197
  padding="0"
190
198
  extraStyles={`max-height: ${buttonHeight};`}
191
199
  as="li"
192
- key={`pagination-button-${item.index}`}
200
+ key={item.id}
193
201
  >
194
202
  <ButtonWithAction
195
203
  variant="ghost"
196
204
  text={item.index}
197
- disabled={item.active}
198
- extraDisabledStyles={extraDisabledStyles}
199
205
  aria-current={item.active ? "page" : undefined}
200
- aria-label={`${item.active ? "Current " : ""}Page ${
201
- item.index
202
- } Button`}
206
+ aria-label={`${
207
+ item.index == pageCount ? "Last Page, " : ""
208
+ }page ${item.index}`}
203
209
  action={
204
210
  !item.active
205
211
  ? () => setCurrentPage({ pageNumber: item.index })
206
212
  : noop
207
213
  }
208
214
  textExtraStyles={`font-size: ${fontSize}; font-weight: ${fontWeight};`}
209
- extraStyles={extraStyles}
215
+ extraStyles={`${extraStyles}${
216
+ item.active ? currentPageStyles : ""
217
+ }`}
210
218
  dataQa={index}
211
219
  >
212
220
  {item.index}
213
221
  </ButtonWithAction>
214
222
  </Box>
215
223
  ) : (
216
- <Box padding="0 10px" as="li" key={`pagination-elipsis-${index}`}>
224
+ <Box padding="0 10px" as="li" key={item.id}>
217
225
  <Cluster justify="flex-end">
218
226
  <Text
219
227
  variant="pXL"
220
228
  weight={fontWeight}
221
229
  color={numberColor ?? themeValues.numberColor}
230
+ aria-label="ellipsis"
222
231
  >
223
232
  {"..."}
224
233
  </Text>
@@ -229,7 +238,7 @@ const Pagination = ({
229
238
  {currentPage < pageCount ? (
230
239
  <PrevNextButton
231
240
  action={pageNext}
232
- ariaLabel={`Next Page Button`}
241
+ ariaLabel={`Next Page`}
233
242
  arrowColor={arrowColor ?? themeValues.arrowColor}
234
243
  borderRadius={borderRadius}
235
244
  buttonHeight={buttonHeight}