@nearform/quantum 1.7.1 → 1.7.3

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  colors_default
3
- } from "./chunk-MJFCAXIN.mjs";
3
+ } from "./chunk-GTI4HTES.mjs";
4
4
  import {
5
5
  __export,
6
6
  __objRest,
@@ -1388,9 +1388,9 @@ var cardVariants = cva11(
1388
1388
  variants: {
1389
1389
  variant: {
1390
1390
  outline: [
1391
- "bg-background",
1391
+ "bg-background-surface",
1392
1392
  "border-border",
1393
- "dark:bg-grey-900",
1393
+ "dark:bg-background-surface-dark",
1394
1394
  "dark:border-grey-700"
1395
1395
  ],
1396
1396
  filled: [
@@ -3042,7 +3042,7 @@ var ModalContent = React23.forwardRef((_a, ref) => {
3042
3042
  __spreadProps(__spreadValues({
3043
3043
  ref,
3044
3044
  className: cn(
3045
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-6 shadow-lg bg-background dark:bg-foreground duration-200 sm:rounded-lg",
3045
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-6 shadow-lg bg-background-surface dark:bg-background-surface-dark duration-200 sm:rounded-lg",
3046
3046
  className
3047
3047
  )
3048
3048
  }, props), {
@@ -3179,7 +3179,7 @@ var PageHeaderContext = React24.createContext("md");
3179
3179
  var pageHeaderVariants = cva20(
3180
3180
  [
3181
3181
  "flex flex-wrap items-center justify-between gap-x-6 gap-y-2",
3182
- "rounded-lg bg-background dark:bg-background-dark",
3182
+ "rounded-lg bg-background-surface dark:bg-background-surface-dark",
3183
3183
  "text-foreground dark:text-foreground-dark"
3184
3184
  ],
3185
3185
  {
@@ -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, { useState as useState3, useEffect as useEffect2 } from "react";
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 allPages = [...Array(totalPages + 1).keys()].slice(1);
3321
- const [pageNumbers, setPageNumbers] = useState3(allPages);
3322
- const [showLeftDots, setShowLeftDots] = useState3(false);
3323
- const [showRightDots, setShowRightDots] = useState3(false);
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 useState4 } from "react";
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] = useState4(true);
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`;
@@ -3569,7 +3575,7 @@ var popoverVariants = cva23([
3569
3575
  "z-50",
3570
3576
  "border border-2 border-border-subtle dark:border-border-dark",
3571
3577
  "rounded-lg",
3572
- "bg-background dark:bg-background-dark",
3578
+ "bg-background-surface dark:bg-background-surface-dark",
3573
3579
  "text-foreground text-sm font-normal dark:text-white",
3574
3580
  "shadow",
3575
3581
  "outline-hidden",
@@ -3904,7 +3910,7 @@ var contentVariants = cva25([
3904
3910
  "relative",
3905
3911
  "z-50",
3906
3912
  "min-w-[8rem]",
3907
- "bg-background",
3913
+ "bg-background-surface",
3908
3914
  "rounded-lg",
3909
3915
  "border border-[2px]",
3910
3916
  "border-border-subtle",
@@ -3914,7 +3920,7 @@ var contentVariants = cva25([
3914
3920
  "data-[side=left]:slide-in-from-right-2",
3915
3921
  "data-[side=right]:slide-in-from-left-2",
3916
3922
  "data-[side=top]:slide-in-from-bottom-2",
3917
- "dark:bg-background-dark",
3923
+ "dark:bg-background-surface-dark",
3918
3924
  "dark:border-border-subtle-dark",
3919
3925
  "dark:text-foreground-dark"
3920
3926
  ]);
@@ -4034,7 +4040,7 @@ var SortAndShow = React31.forwardRef((_a, ref) => {
4034
4040
  ref,
4035
4041
  className: cn(
4036
4042
  "flex flex-wrap items-center gap-x-6 gap-y-2 px-4 py-3",
4037
- "rounded-lg bg-background dark:bg-background-dark",
4043
+ "rounded-lg bg-background-surface dark:bg-background-surface-dark",
4038
4044
  className
4039
4045
  )
4040
4046
  }, props)
@@ -4225,13 +4231,13 @@ var splitButtonMenuVariants = cva26([
4225
4231
  "rounded-lg",
4226
4232
  "border-2",
4227
4233
  "border-border-subtle",
4228
- "bg-background",
4234
+ "bg-background-surface",
4229
4235
  "text-sm",
4230
4236
  "text-foreground",
4231
4237
  "shadow",
4232
4238
  "outline-hidden",
4233
4239
  "dark:border-border-dark",
4234
- "dark:bg-background-dark",
4240
+ "dark:bg-background-surface-dark",
4235
4241
  "dark:text-foreground-dark"
4236
4242
  ]);
4237
4243
  var splitButtonItemVariants = cva26([
@@ -4735,7 +4741,7 @@ var Subnav = React36.forwardRef(
4735
4741
  "aria-labelledby": ariaLabelledBy != null ? ariaLabelledBy : ariaLabel ? void 0 : headingId,
4736
4742
  className: cn(
4737
4743
  "flex flex-col gap-4",
4738
- "bg-background dark:bg-background-dark",
4744
+ "bg-background-surface dark:bg-background-surface-dark",
4739
4745
  "text-foreground dark:text-foreground-dark",
4740
4746
  className
4741
4747
  )
@@ -4822,16 +4828,19 @@ SubnavLink.displayName = "SubnavLink";
4822
4828
  import * as React37 from "react";
4823
4829
  import { cva as cva30 } from "class-variance-authority";
4824
4830
  import { jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
4825
- var tableBodyVariants = cva30("bg-background dark:bg-background-dark", {
4826
- variants: {
4827
- variant: {
4828
- zebra: [
4829
- "[:where(&>*:nth-child(even))]:bg-background-subtle",
4830
- "dark:[:where(&>*:nth-child(even))]:bg-background-subtle-dark"
4831
- ]
4831
+ var tableBodyVariants = cva30(
4832
+ "bg-background-surface dark:bg-background-surface-dark",
4833
+ {
4834
+ variants: {
4835
+ variant: {
4836
+ zebra: [
4837
+ "[:where(&>*:nth-child(even))]:bg-background-subtle",
4838
+ "dark:[:where(&>*:nth-child(even))]:bg-background-subtle-dark"
4839
+ ]
4840
+ }
4832
4841
  }
4833
4842
  }
4834
- });
4843
+ );
4835
4844
  var alignVariants2 = cva30("", {
4836
4845
  variants: {
4837
4846
  align: {