@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/dist/index.cjs.js +18 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +18 -14
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/pagination/Pagination.js +24 -15
package/package.json
CHANGED
|
@@ -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({
|
|
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
|
|
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
|
|
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={
|
|
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={`${
|
|
201
|
-
item.index
|
|
202
|
-
}
|
|
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={
|
|
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
|
|
241
|
+
ariaLabel={`Next Page`}
|
|
233
242
|
arrowColor={arrowColor ?? themeValues.arrowColor}
|
|
234
243
|
borderRadius={borderRadius}
|
|
235
244
|
buttonHeight={buttonHeight}
|