@nearform/quantum 1.7.0 → 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/global.css +10 -6
- package/dist/global.css.map +1 -1
- package/dist/index.js +60 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -44
- 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([
|
|
@@ -3261,9 +3261,10 @@ var PageNumberStyles = cva21([
|
|
|
3261
3261
|
"rounded-xs",
|
|
3262
3262
|
"text-foreground-muted",
|
|
3263
3263
|
"dark:text-foreground-muted-dark",
|
|
3264
|
+
"hover:bg-button-tertiary-hover",
|
|
3265
|
+
"dark:hover:bg-button-tertiary-hover-dark",
|
|
3264
3266
|
"active:bg-accent",
|
|
3265
3267
|
"active:text-primary-10",
|
|
3266
|
-
"dark:hover:bg-background-dark",
|
|
3267
3268
|
"dark:active:bg-primary-30",
|
|
3268
3269
|
"dark:active:text-grey-900"
|
|
3269
3270
|
]);
|
|
@@ -3277,6 +3278,54 @@ var PageNumberActiveStyles = cva21([
|
|
|
3277
3278
|
"dark:hover:bg-primary-30",
|
|
3278
3279
|
"dark:hover:text-grey-900"
|
|
3279
3280
|
]);
|
|
3281
|
+
var StepButtonStyles = cva21([
|
|
3282
|
+
"px-4",
|
|
3283
|
+
"rounded-xs",
|
|
3284
|
+
"text-foreground",
|
|
3285
|
+
"dark:text-foreground-dark",
|
|
3286
|
+
"enabled:hover:bg-button-tertiary-hover",
|
|
3287
|
+
"dark:enabled:hover:bg-button-tertiary-hover-dark",
|
|
3288
|
+
"disabled:text-foreground-subtle",
|
|
3289
|
+
"dark:disabled:text-foreground-subtle-dark"
|
|
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
|
+
};
|
|
3280
3329
|
var Pagination = React25.forwardRef(
|
|
3281
3330
|
(_a, ref) => {
|
|
3282
3331
|
var _b = _a, {
|
|
@@ -3306,42 +3355,10 @@ var Pagination = React25.forwardRef(
|
|
|
3306
3355
|
currentRowsLength > 0 ? currentRowsLength / numberOfItemsPerPage : 0
|
|
3307
3356
|
);
|
|
3308
3357
|
}, [currentRowsLength, numberOfItemsPerPage]);
|
|
3309
|
-
const
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
const noOfSiblings = 1;
|
|
3314
|
-
const noOfPagesShown = noOfSiblings * 2 + 5;
|
|
3315
|
-
useEffect2(() => {
|
|
3316
|
-
if (totalPages <= noOfPagesShown) {
|
|
3317
|
-
setPageNumbers(allPages);
|
|
3318
|
-
setShowRightDots(false);
|
|
3319
|
-
setShowLeftDots(false);
|
|
3320
|
-
} else if (currentPage <= noOfPagesShown - 3) {
|
|
3321
|
-
const pages = allPages.slice(0, noOfPagesShown - 2);
|
|
3322
|
-
pages.push(totalPages);
|
|
3323
|
-
setPageNumbers(pages);
|
|
3324
|
-
setShowRightDots(true);
|
|
3325
|
-
setShowLeftDots(false);
|
|
3326
|
-
} else if (noOfPagesShown - 3 < currentPage && currentPage < totalPages - 3) {
|
|
3327
|
-
const pages = [1];
|
|
3328
|
-
const start = Math.max(2, currentPage - noOfSiblings);
|
|
3329
|
-
const end = Math.min(totalPages - 1, currentPage + noOfSiblings);
|
|
3330
|
-
for (let i = start; i <= end; i++) {
|
|
3331
|
-
pages.push(i);
|
|
3332
|
-
}
|
|
3333
|
-
pages.push(totalPages);
|
|
3334
|
-
setPageNumbers(pages);
|
|
3335
|
-
setShowRightDots(true);
|
|
3336
|
-
setShowLeftDots(true);
|
|
3337
|
-
} else if (currentPage >= totalPages - 3) {
|
|
3338
|
-
const pages = allPages.slice(-noOfPagesShown + 2);
|
|
3339
|
-
pages.unshift(1);
|
|
3340
|
-
setPageNumbers(pages);
|
|
3341
|
-
setShowRightDots(false);
|
|
3342
|
-
setShowLeftDots(true);
|
|
3343
|
-
}
|
|
3344
|
-
}, [currentPage, totalPages]);
|
|
3358
|
+
const { pageNumbers, showLeftDots, showRightDots } = React25.useMemo(
|
|
3359
|
+
() => pageWindow(currentPage, totalPages),
|
|
3360
|
+
[currentPage, totalPages]
|
|
3361
|
+
);
|
|
3345
3362
|
const goToNextPage = () => {
|
|
3346
3363
|
if (currentPage !== totalPages) setCurrentPage(currentPage + 1);
|
|
3347
3364
|
};
|
|
@@ -3356,18 +3373,19 @@ var Pagination = React25.forwardRef(
|
|
|
3356
3373
|
ref
|
|
3357
3374
|
}, props), {
|
|
3358
3375
|
children: /* @__PURE__ */ jsxs19("ul", { children: [
|
|
3359
|
-
/* @__PURE__ */ jsx27("li", {
|
|
3376
|
+
/* @__PURE__ */ jsx27("li", { children: /* @__PURE__ */ jsx27(
|
|
3360
3377
|
"button",
|
|
3361
3378
|
{
|
|
3362
3379
|
type: "button",
|
|
3363
3380
|
"aria-label": previousLabel,
|
|
3381
|
+
className: StepButtonStyles(),
|
|
3364
3382
|
onClick: goToPrevPage,
|
|
3365
3383
|
disabled: currentPage === 1 || totalPages === 0,
|
|
3366
3384
|
children: /* @__PURE__ */ jsx27(
|
|
3367
3385
|
assets_exports.BsChevronLeft,
|
|
3368
3386
|
{
|
|
3369
3387
|
"aria-hidden": "true",
|
|
3370
|
-
className: "w-3 h-9 pt-3 pb-3 -mb-1
|
|
3388
|
+
className: "w-3 h-9 pt-3 pb-3 -mb-1"
|
|
3371
3389
|
}
|
|
3372
3390
|
)
|
|
3373
3391
|
}
|
|
@@ -3404,18 +3422,19 @@ var Pagination = React25.forwardRef(
|
|
|
3404
3422
|
}
|
|
3405
3423
|
) : null
|
|
3406
3424
|
] }, pgNumber)),
|
|
3407
|
-
/* @__PURE__ */ jsx27("li", {
|
|
3425
|
+
/* @__PURE__ */ jsx27("li", { children: /* @__PURE__ */ jsx27(
|
|
3408
3426
|
"button",
|
|
3409
3427
|
{
|
|
3410
3428
|
type: "button",
|
|
3411
3429
|
"aria-label": nextLabel,
|
|
3430
|
+
className: StepButtonStyles(),
|
|
3412
3431
|
onClick: goToNextPage,
|
|
3413
3432
|
disabled: currentPage === totalPages || totalPages === 0,
|
|
3414
3433
|
children: /* @__PURE__ */ jsx27(
|
|
3415
3434
|
assets_exports.BsChevronRight,
|
|
3416
3435
|
{
|
|
3417
3436
|
"aria-hidden": "true",
|
|
3418
|
-
className: "w-3 h-9 py-3 -mb-1
|
|
3437
|
+
className: "w-3 h-9 py-3 -mb-1"
|
|
3419
3438
|
}
|
|
3420
3439
|
)
|
|
3421
3440
|
}
|
|
@@ -3428,7 +3447,7 @@ var Pagination = React25.forwardRef(
|
|
|
3428
3447
|
Pagination.displayName = "Pagination";
|
|
3429
3448
|
|
|
3430
3449
|
// src/components/Password/index.tsx
|
|
3431
|
-
import React26, { useState as
|
|
3450
|
+
import React26, { useState as useState3 } from "react";
|
|
3432
3451
|
import { cva as cva22 } from "class-variance-authority";
|
|
3433
3452
|
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3434
3453
|
var toggleMaskVariants = cva22([
|
|
@@ -3489,7 +3508,7 @@ var Password = React26.forwardRef(
|
|
|
3489
3508
|
"hideLabel",
|
|
3490
3509
|
"aria-describedby"
|
|
3491
3510
|
]);
|
|
3492
|
-
const [isMaskOn, setIsMaskOn] =
|
|
3511
|
+
const [isMaskOn, setIsMaskOn] = useState3(true);
|
|
3493
3512
|
const generatedId = React26.useId();
|
|
3494
3513
|
const inputId = id != null ? id : generatedId;
|
|
3495
3514
|
const helpTextId = `${inputId}-helptext`;
|