@nearform/quantum 1.7.1 → 1.7.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/dist/index.js +42 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3243,7 +3243,7 @@ var PageHeaderActions = React24.forwardRef((_a, ref) => {
|
|
|
3243
3243
|
PageHeaderActions.displayName = "PageHeaderActions";
|
|
3244
3244
|
|
|
3245
3245
|
// src/components/Pagination/index.tsx
|
|
3246
|
-
import React25
|
|
3246
|
+
import React25 from "react";
|
|
3247
3247
|
import { cva as cva21 } from "class-variance-authority";
|
|
3248
3248
|
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3249
3249
|
var PaginationVariants = cva21([
|
|
@@ -3288,6 +3288,44 @@ var StepButtonStyles = cva21([
|
|
|
3288
3288
|
"disabled:text-foreground-subtle",
|
|
3289
3289
|
"dark:disabled:text-foreground-subtle-dark"
|
|
3290
3290
|
]);
|
|
3291
|
+
var noOfSiblings = 1;
|
|
3292
|
+
var noOfPagesShown = noOfSiblings * 2 + 5;
|
|
3293
|
+
var range = (from, to) => Array.from({ length: Math.max(0, to - from + 1) }, (_, i) => from + i);
|
|
3294
|
+
var pageWindow = (currentPage, totalPages) => {
|
|
3295
|
+
if (totalPages <= noOfPagesShown) {
|
|
3296
|
+
return {
|
|
3297
|
+
pageNumbers: range(1, totalPages),
|
|
3298
|
+
showLeftDots: false,
|
|
3299
|
+
showRightDots: false
|
|
3300
|
+
};
|
|
3301
|
+
}
|
|
3302
|
+
if (currentPage <= noOfPagesShown - 3) {
|
|
3303
|
+
return {
|
|
3304
|
+
pageNumbers: [...range(1, noOfPagesShown - 2), totalPages],
|
|
3305
|
+
showLeftDots: false,
|
|
3306
|
+
showRightDots: true
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
if (currentPage < totalPages - 3) {
|
|
3310
|
+
return {
|
|
3311
|
+
pageNumbers: [
|
|
3312
|
+
1,
|
|
3313
|
+
...range(
|
|
3314
|
+
Math.max(2, currentPage - noOfSiblings),
|
|
3315
|
+
Math.min(totalPages - 1, currentPage + noOfSiblings)
|
|
3316
|
+
),
|
|
3317
|
+
totalPages
|
|
3318
|
+
],
|
|
3319
|
+
showLeftDots: true,
|
|
3320
|
+
showRightDots: true
|
|
3321
|
+
};
|
|
3322
|
+
}
|
|
3323
|
+
return {
|
|
3324
|
+
pageNumbers: [1, ...range(totalPages - noOfPagesShown + 3, totalPages)],
|
|
3325
|
+
showLeftDots: true,
|
|
3326
|
+
showRightDots: false
|
|
3327
|
+
};
|
|
3328
|
+
};
|
|
3291
3329
|
var Pagination = React25.forwardRef(
|
|
3292
3330
|
(_a, ref) => {
|
|
3293
3331
|
var _b = _a, {
|
|
@@ -3317,42 +3355,10 @@ var Pagination = React25.forwardRef(
|
|
|
3317
3355
|
currentRowsLength > 0 ? currentRowsLength / numberOfItemsPerPage : 0
|
|
3318
3356
|
);
|
|
3319
3357
|
}, [currentRowsLength, numberOfItemsPerPage]);
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
const noOfSiblings = 1;
|
|
3325
|
-
const noOfPagesShown = noOfSiblings * 2 + 5;
|
|
3326
|
-
useEffect2(() => {
|
|
3327
|
-
if (totalPages <= noOfPagesShown) {
|
|
3328
|
-
setPageNumbers(allPages);
|
|
3329
|
-
setShowRightDots(false);
|
|
3330
|
-
setShowLeftDots(false);
|
|
3331
|
-
} else if (currentPage <= noOfPagesShown - 3) {
|
|
3332
|
-
const pages = allPages.slice(0, noOfPagesShown - 2);
|
|
3333
|
-
pages.push(totalPages);
|
|
3334
|
-
setPageNumbers(pages);
|
|
3335
|
-
setShowRightDots(true);
|
|
3336
|
-
setShowLeftDots(false);
|
|
3337
|
-
} else if (noOfPagesShown - 3 < currentPage && currentPage < totalPages - 3) {
|
|
3338
|
-
const pages = [1];
|
|
3339
|
-
const start = Math.max(2, currentPage - noOfSiblings);
|
|
3340
|
-
const end = Math.min(totalPages - 1, currentPage + noOfSiblings);
|
|
3341
|
-
for (let i = start; i <= end; i++) {
|
|
3342
|
-
pages.push(i);
|
|
3343
|
-
}
|
|
3344
|
-
pages.push(totalPages);
|
|
3345
|
-
setPageNumbers(pages);
|
|
3346
|
-
setShowRightDots(true);
|
|
3347
|
-
setShowLeftDots(true);
|
|
3348
|
-
} else if (currentPage >= totalPages - 3) {
|
|
3349
|
-
const pages = allPages.slice(-noOfPagesShown + 2);
|
|
3350
|
-
pages.unshift(1);
|
|
3351
|
-
setPageNumbers(pages);
|
|
3352
|
-
setShowRightDots(false);
|
|
3353
|
-
setShowLeftDots(true);
|
|
3354
|
-
}
|
|
3355
|
-
}, [currentPage, totalPages]);
|
|
3358
|
+
const { pageNumbers, showLeftDots, showRightDots } = React25.useMemo(
|
|
3359
|
+
() => pageWindow(currentPage, totalPages),
|
|
3360
|
+
[currentPage, totalPages]
|
|
3361
|
+
);
|
|
3356
3362
|
const goToNextPage = () => {
|
|
3357
3363
|
if (currentPage !== totalPages) setCurrentPage(currentPage + 1);
|
|
3358
3364
|
};
|
|
@@ -3441,7 +3447,7 @@ var Pagination = React25.forwardRef(
|
|
|
3441
3447
|
Pagination.displayName = "Pagination";
|
|
3442
3448
|
|
|
3443
3449
|
// src/components/Password/index.tsx
|
|
3444
|
-
import React26, { useState as
|
|
3450
|
+
import React26, { useState as useState3 } from "react";
|
|
3445
3451
|
import { cva as cva22 } from "class-variance-authority";
|
|
3446
3452
|
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3447
3453
|
var toggleMaskVariants = cva22([
|
|
@@ -3502,7 +3508,7 @@ var Password = React26.forwardRef(
|
|
|
3502
3508
|
"hideLabel",
|
|
3503
3509
|
"aria-describedby"
|
|
3504
3510
|
]);
|
|
3505
|
-
const [isMaskOn, setIsMaskOn] =
|
|
3511
|
+
const [isMaskOn, setIsMaskOn] = useState3(true);
|
|
3506
3512
|
const generatedId = React26.useId();
|
|
3507
3513
|
const inputId = id != null ? id : generatedId;
|
|
3508
3514
|
const helpTextId = `${inputId}-helptext`;
|