@eqtylab/equality 5.4.1 → 5.4.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.d.cts CHANGED
@@ -132,7 +132,7 @@ declare const AlertDialogDescription: React$1.ForwardRefExoticComponent<Omit<Ale
132
132
  * [Alert Dialog documentation](https://equality.eqtylab.io/components/alert-dialog)
133
133
  */
134
134
  declare const AlertDialogAction: React$1.ForwardRefExoticComponent<Omit<Omit<AlertDialogPrimitive.AlertDialogActionProps & React$1.RefAttributes<HTMLButtonElement>, "ref">, "prefix"> & VariantProps<(props?: ({
135
- variant?: "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
135
+ variant?: "link" | "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
136
136
  size?: "sm" | "md" | "lg" | null | undefined;
137
137
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
138
138
  prefix?: React$1.ReactNode;
@@ -151,7 +151,7 @@ declare const AlertDialogAction: React$1.ForwardRefExoticComponent<Omit<Omit<Ale
151
151
  * [Alert Dialog documentation](https://equality.eqtylab.io/components/alert-dialog)
152
152
  */
153
153
  declare const AlertDialogCancel: React$1.ForwardRefExoticComponent<Omit<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React$1.RefAttributes<HTMLButtonElement>, "ref">, "prefix"> & VariantProps<(props?: ({
154
- variant?: "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
154
+ variant?: "link" | "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
155
155
  size?: "sm" | "md" | "lg" | null | undefined;
156
156
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
157
157
  prefix?: React$1.ReactNode;
@@ -452,7 +452,7 @@ declare const BgGradient: ({ theme, placement, }: {
452
452
  }) => react_jsx_runtime.JSX.Element;
453
453
 
454
454
  declare const buttonVariants: (props?: ({
455
- variant?: "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
455
+ variant?: "link" | "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
456
456
  size?: "sm" | "md" | "lg" | null | undefined;
457
457
  } & class_variance_authority_types.ClassProp) | undefined) => string;
458
458
  type ButtonBaseProps = Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, 'prefix'>;
@@ -1841,39 +1841,52 @@ interface NotFoundProps {
1841
1841
  declare const NotFound: ({ className, title, description, showHomeButton, onHomeClick, }: NotFoundProps) => react_jsx_runtime.JSX.Element;
1842
1842
 
1843
1843
  interface PaginationProps {
1844
+ /** The active page, 1-based; one outside 1 to the last page shows as the nearest, so clamp your own state too */
1844
1845
  currentPage: number;
1846
+ /** Full dataset size; the controls render only when it exceeds the smallest page size */
1845
1847
  totalItems: number;
1848
+ /** Item count after filtering, which drives the page count and the info text */
1846
1849
  filteredItems: number;
1850
+ /** Number of items shown per page */
1847
1851
  itemsPerPage: number;
1852
+ /** Called with the new page when the user navigates */
1848
1853
  onPageChange: (page: number) => void;
1854
+ /** Called with the new page size; when set, the items-per-page dropdown shows */
1849
1855
  onItemsPerPageChange?: (itemsPerPage: number) => void;
1856
+ /** Choices in the items-per-page dropdown */
1850
1857
  itemsPerPageOptions?: number[];
1858
+ /** Whether to show the "X–Y of Z" info text and the items-per-page dropdown */
1851
1859
  showInfo?: boolean;
1860
+ /** Whether to show jump-to-first and jump-to-last buttons once there are more pages than `maxVisiblePages` */
1852
1861
  showFirstLast?: boolean;
1862
+ /** Most numbered page buttons shown at once */
1853
1863
  maxVisiblePages?: number;
1864
+ /** Additional classes on the root */
1854
1865
  className?: string;
1866
+ /** Noun after the total in the info text, such as `items` */
1855
1867
  type?: string;
1868
+ /** Element, or an element `id`, scrolled into view when the page changes */
1856
1869
  scrollTargetRef?: React$1.RefObject<HTMLElement | null> | string;
1857
1870
  }
1858
1871
  /**
1859
1872
  * **Props**
1860
- * - `currentPage: number`
1861
- * - `totalItems: number`
1862
- * - `filteredItems: number`
1863
- * - `itemsPerPage: number`
1864
- * - `onPageChange: (page: number) => void`
1865
- * - `onItemsPerPageChange?: (itemsPerPage: number) => void`
1866
- * - `itemsPerPageOptions?: number[]` (default `[10, 25, 50, 100]`)
1867
- * - `showInfo?: boolean` (default `true`)
1868
- * - `showFirstLast?: boolean` (default `true`)
1869
- * - `maxVisiblePages?: number` (default `5`)
1870
- * - `className?: string` (default `""`)
1871
- * - `type?: string` (default `""`)
1872
- * - `scrollTargetRef?: React.RefObject<HTMLElement | null> | string`
1873
+ * - `currentPage: number` — The active page, 1-based; one outside 1 to the last page shows as the nearest, so clamp your own state too
1874
+ * - `totalItems: number` — Full dataset size; the controls render only when it exceeds the smallest page size
1875
+ * - `filteredItems: number` — Item count after filtering, which drives the page count and the info text
1876
+ * - `itemsPerPage: number` — Number of items shown per page
1877
+ * - `onPageChange: (page: number) => void` — Called with the new page when the user navigates
1878
+ * - `onItemsPerPageChange?: (itemsPerPage: number) => void` — Called with the new page size; when set, the items-per-page dropdown shows
1879
+ * - `itemsPerPageOptions?: number[]` (default `[10, 25, 50, 100]`) — Choices in the items-per-page dropdown
1880
+ * - `showInfo?: boolean` (default `true`) — Whether to show the "X–Y of Z" info text and the items-per-page dropdown
1881
+ * - `showFirstLast?: boolean` (default `true`) — Whether to show jump-to-first and jump-to-last buttons once there are more pages than `maxVisiblePages`
1882
+ * - `maxVisiblePages?: number` (default `5`) — Most numbered page buttons shown at once
1883
+ * - `className?: string` (default `""`) — Additional classes on the root
1884
+ * - `type?: string` (default `""`) — Noun after the total in the info text, such as `items`
1885
+ * - `scrollTargetRef?: React.RefObject<HTMLElement | null> | string` — Element, or an element `id`, scrolled into view when the page changes
1873
1886
  *
1874
1887
  * [Pagination documentation](https://equality.eqtylab.io/components/pagination)
1875
1888
  */
1876
- declare const Pagination: ({ currentPage, totalItems, filteredItems, itemsPerPage, onPageChange, onItemsPerPageChange, itemsPerPageOptions, showInfo, showFirstLast, maxVisiblePages, className, type, scrollTargetRef, }: PaginationProps) => react_jsx_runtime.JSX.Element | null;
1889
+ declare const Pagination: ({ currentPage: requestedPage, totalItems, filteredItems, itemsPerPage, onPageChange, onItemsPerPageChange, itemsPerPageOptions, showInfo, showFirstLast, maxVisiblePages, className, type, scrollTargetRef, }: PaginationProps) => react_jsx_runtime.JSX.Element | null;
1877
1890
 
1878
1891
  interface PanelLabelProps {
1879
1892
  className?: string;
package/dist/index.d.ts CHANGED
@@ -132,7 +132,7 @@ declare const AlertDialogDescription: React$1.ForwardRefExoticComponent<Omit<Ale
132
132
  * [Alert Dialog documentation](https://equality.eqtylab.io/components/alert-dialog)
133
133
  */
134
134
  declare const AlertDialogAction: React$1.ForwardRefExoticComponent<Omit<Omit<AlertDialogPrimitive.AlertDialogActionProps & React$1.RefAttributes<HTMLButtonElement>, "ref">, "prefix"> & VariantProps<(props?: ({
135
- variant?: "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
135
+ variant?: "link" | "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
136
136
  size?: "sm" | "md" | "lg" | null | undefined;
137
137
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
138
138
  prefix?: React$1.ReactNode;
@@ -151,7 +151,7 @@ declare const AlertDialogAction: React$1.ForwardRefExoticComponent<Omit<Omit<Ale
151
151
  * [Alert Dialog documentation](https://equality.eqtylab.io/components/alert-dialog)
152
152
  */
153
153
  declare const AlertDialogCancel: React$1.ForwardRefExoticComponent<Omit<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React$1.RefAttributes<HTMLButtonElement>, "ref">, "prefix"> & VariantProps<(props?: ({
154
- variant?: "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
154
+ variant?: "link" | "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
155
155
  size?: "sm" | "md" | "lg" | null | undefined;
156
156
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
157
157
  prefix?: React$1.ReactNode;
@@ -452,7 +452,7 @@ declare const BgGradient: ({ theme, placement, }: {
452
452
  }) => react_jsx_runtime.JSX.Element;
453
453
 
454
454
  declare const buttonVariants: (props?: ({
455
- variant?: "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "link" | "navigation" | null | undefined;
455
+ variant?: "link" | "primary" | "danger" | "success" | "warning" | "secondary" | "tertiary" | "navigation" | null | undefined;
456
456
  size?: "sm" | "md" | "lg" | null | undefined;
457
457
  } & class_variance_authority_types.ClassProp) | undefined) => string;
458
458
  type ButtonBaseProps = Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, 'prefix'>;
@@ -1841,39 +1841,52 @@ interface NotFoundProps {
1841
1841
  declare const NotFound: ({ className, title, description, showHomeButton, onHomeClick, }: NotFoundProps) => react_jsx_runtime.JSX.Element;
1842
1842
 
1843
1843
  interface PaginationProps {
1844
+ /** The active page, 1-based; one outside 1 to the last page shows as the nearest, so clamp your own state too */
1844
1845
  currentPage: number;
1846
+ /** Full dataset size; the controls render only when it exceeds the smallest page size */
1845
1847
  totalItems: number;
1848
+ /** Item count after filtering, which drives the page count and the info text */
1846
1849
  filteredItems: number;
1850
+ /** Number of items shown per page */
1847
1851
  itemsPerPage: number;
1852
+ /** Called with the new page when the user navigates */
1848
1853
  onPageChange: (page: number) => void;
1854
+ /** Called with the new page size; when set, the items-per-page dropdown shows */
1849
1855
  onItemsPerPageChange?: (itemsPerPage: number) => void;
1856
+ /** Choices in the items-per-page dropdown */
1850
1857
  itemsPerPageOptions?: number[];
1858
+ /** Whether to show the "X–Y of Z" info text and the items-per-page dropdown */
1851
1859
  showInfo?: boolean;
1860
+ /** Whether to show jump-to-first and jump-to-last buttons once there are more pages than `maxVisiblePages` */
1852
1861
  showFirstLast?: boolean;
1862
+ /** Most numbered page buttons shown at once */
1853
1863
  maxVisiblePages?: number;
1864
+ /** Additional classes on the root */
1854
1865
  className?: string;
1866
+ /** Noun after the total in the info text, such as `items` */
1855
1867
  type?: string;
1868
+ /** Element, or an element `id`, scrolled into view when the page changes */
1856
1869
  scrollTargetRef?: React$1.RefObject<HTMLElement | null> | string;
1857
1870
  }
1858
1871
  /**
1859
1872
  * **Props**
1860
- * - `currentPage: number`
1861
- * - `totalItems: number`
1862
- * - `filteredItems: number`
1863
- * - `itemsPerPage: number`
1864
- * - `onPageChange: (page: number) => void`
1865
- * - `onItemsPerPageChange?: (itemsPerPage: number) => void`
1866
- * - `itemsPerPageOptions?: number[]` (default `[10, 25, 50, 100]`)
1867
- * - `showInfo?: boolean` (default `true`)
1868
- * - `showFirstLast?: boolean` (default `true`)
1869
- * - `maxVisiblePages?: number` (default `5`)
1870
- * - `className?: string` (default `""`)
1871
- * - `type?: string` (default `""`)
1872
- * - `scrollTargetRef?: React.RefObject<HTMLElement | null> | string`
1873
+ * - `currentPage: number` — The active page, 1-based; one outside 1 to the last page shows as the nearest, so clamp your own state too
1874
+ * - `totalItems: number` — Full dataset size; the controls render only when it exceeds the smallest page size
1875
+ * - `filteredItems: number` — Item count after filtering, which drives the page count and the info text
1876
+ * - `itemsPerPage: number` — Number of items shown per page
1877
+ * - `onPageChange: (page: number) => void` — Called with the new page when the user navigates
1878
+ * - `onItemsPerPageChange?: (itemsPerPage: number) => void` — Called with the new page size; when set, the items-per-page dropdown shows
1879
+ * - `itemsPerPageOptions?: number[]` (default `[10, 25, 50, 100]`) — Choices in the items-per-page dropdown
1880
+ * - `showInfo?: boolean` (default `true`) — Whether to show the "X–Y of Z" info text and the items-per-page dropdown
1881
+ * - `showFirstLast?: boolean` (default `true`) — Whether to show jump-to-first and jump-to-last buttons once there are more pages than `maxVisiblePages`
1882
+ * - `maxVisiblePages?: number` (default `5`) — Most numbered page buttons shown at once
1883
+ * - `className?: string` (default `""`) — Additional classes on the root
1884
+ * - `type?: string` (default `""`) — Noun after the total in the info text, such as `items`
1885
+ * - `scrollTargetRef?: React.RefObject<HTMLElement | null> | string` — Element, or an element `id`, scrolled into view when the page changes
1873
1886
  *
1874
1887
  * [Pagination documentation](https://equality.eqtylab.io/components/pagination)
1875
1888
  */
1876
- declare const Pagination: ({ currentPage, totalItems, filteredItems, itemsPerPage, onPageChange, onItemsPerPageChange, itemsPerPageOptions, showInfo, showFirstLast, maxVisiblePages, className, type, scrollTargetRef, }: PaginationProps) => react_jsx_runtime.JSX.Element | null;
1889
+ declare const Pagination: ({ currentPage: requestedPage, totalItems, filteredItems, itemsPerPage, onPageChange, onItemsPerPageChange, itemsPerPageOptions, showInfo, showFirstLast, maxVisiblePages, className, type, scrollTargetRef, }: PaginationProps) => react_jsx_runtime.JSX.Element | null;
1877
1890
 
1878
1891
  interface PanelLabelProps {
1879
1892
  className?: string;
package/dist/index.js CHANGED
@@ -3826,7 +3826,7 @@ var ChevronRightIcon3 = ChevronRight;
3826
3826
  var ChevronsLeftIcon = ChevronsLeft;
3827
3827
  var ChevronsRightIcon = ChevronsRight;
3828
3828
  var Pagination = ({
3829
- currentPage,
3829
+ currentPage: requestedPage,
3830
3830
  totalItems,
3831
3831
  filteredItems,
3832
3832
  itemsPerPage,
@@ -3841,6 +3841,7 @@ var Pagination = ({
3841
3841
  scrollTargetRef
3842
3842
  }) => {
3843
3843
  const totalPages = Math.ceil(filteredItems / itemsPerPage);
3844
+ const currentPage = Math.min(Math.max(requestedPage, 1), Math.max(totalPages, 1));
3844
3845
  const startItem = Math.min(filteredItems, 1 + (currentPage - 1) * itemsPerPage);
3845
3846
  const endItem = Math.min(currentPage * itemsPerPage, filteredItems);
3846
3847
  const hasFilteredItems = filteredItems > 0;
@@ -3907,6 +3908,7 @@ var Pagination = ({
3907
3908
  onClick: () => handlePageChange(i),
3908
3909
  "aria-label": `Page ${i} of ${totalPages}`,
3909
3910
  "aria-current": currentPage === i ? "page" : void 0,
3911
+ className: cn(currentPage !== i && styles43["wide-only"]),
3910
3912
  children: i
3911
3913
  },
3912
3914
  i
@@ -3916,30 +3918,55 @@ var Pagination = ({
3916
3918
  return pageButtons;
3917
3919
  };
3918
3920
  return /* @__PURE__ */ jsxs("div", { className: cn(styles43["pagination"], className), children: [
3919
- /* @__PURE__ */ jsx("div", { className: styles43["info-container"], children: showInfo && hasFilteredItems && /* @__PURE__ */ jsxs(Fragment, { children: [
3920
- /* @__PURE__ */ jsxs("span", { children: [
3921
- "Showing ",
3922
- startItem,
3923
- " to"
3921
+ /* @__PURE__ */ jsxs("div", { className: styles43["info-container"], children: [
3922
+ showInfo && hasFilteredItems && /* @__PURE__ */ jsxs("span", { children: [
3923
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
3924
+ startItem,
3925
+ "\u2013",
3926
+ endItem,
3927
+ " of ",
3928
+ filteredItems,
3929
+ type && /* @__PURE__ */ jsxs("span", { className: styles43["wide-only"], children: [
3930
+ " ",
3931
+ type
3932
+ ] })
3933
+ ] }),
3934
+ /* @__PURE__ */ jsxs("span", { className: styles43["spoken-count"], children: [
3935
+ startItem,
3936
+ " to ",
3937
+ endItem,
3938
+ " of ",
3939
+ filteredItems,
3940
+ " ",
3941
+ type
3942
+ ] })
3924
3943
  ] }),
3925
- onItemsPerPageChange ? /* @__PURE__ */ jsxs(Select, { value: itemsPerPage.toString(), onValueChange: handleItemsPerPageChange, children: [
3944
+ showInfo && hasFilteredItems && onItemsPerPageChange && /* @__PURE__ */ jsxs(Fragment, { children: [
3945
+ /* @__PURE__ */ jsxs(Select, { value: itemsPerPage.toString(), onValueChange: handleItemsPerPageChange, children: [
3946
+ /* @__PURE__ */ jsx(
3947
+ SelectTrigger,
3948
+ {
3949
+ className: styles43["items-per-page-trigger"],
3950
+ "aria-label": "Items per page",
3951
+ children: /* @__PURE__ */ jsx(SelectValue, {})
3952
+ }
3953
+ ),
3954
+ /* @__PURE__ */ jsx(SelectContent, { children: itemsPerPageOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.toString(), children: option }, option)) })
3955
+ ] }),
3926
3956
  /* @__PURE__ */ jsx(
3927
- SelectTrigger,
3957
+ "span",
3928
3958
  {
3929
- className: styles43["items-per-page-trigger"],
3930
- "aria-label": "Items per page",
3931
- children: /* @__PURE__ */ jsx(SelectValue, {})
3959
+ className: cn(
3960
+ styles43["page-size-label"],
3961
+ filteredItems < 100 && styles43["page-size-label--short"],
3962
+ filteredItems >= 100 && filteredItems < 1e3 && styles43["page-size-label--medium"]
3963
+ ),
3964
+ "aria-hidden": "true",
3965
+ children: "per page"
3932
3966
  }
3933
- ),
3934
- /* @__PURE__ */ jsx(SelectContent, { children: itemsPerPageOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.toString(), children: option }, option)) })
3935
- ] }) : /* @__PURE__ */ jsx("span", { children: endItem }),
3936
- /* @__PURE__ */ jsxs("span", { children: [
3937
- "of ",
3938
- filteredItems,
3939
- " ",
3940
- type
3967
+ )
3941
3968
  ] })
3942
- ] }) }),
3969
+ ] }),
3943
3970
  /* @__PURE__ */ jsxs("nav", { className: styles43["page-navigation-container"], "aria-label": "Pagination", children: [
3944
3971
  showFirstLastButtons && /* @__PURE__ */ jsx(
3945
3972
  Button,
@@ -3949,6 +3976,7 @@ var Pagination = ({
3949
3976
  onClick: handleFirstPage,
3950
3977
  disabled: isFirstPage,
3951
3978
  "aria-label": "First page",
3979
+ className: styles43["wide-only"],
3952
3980
  children: /* @__PURE__ */ jsx(ChevronsLeftIcon, {})
3953
3981
  }
3954
3982
  ),
@@ -3983,6 +4011,7 @@ var Pagination = ({
3983
4011
  onClick: handleLastPage,
3984
4012
  disabled: isLastPage,
3985
4013
  "aria-label": `Last page (${totalPages})`,
4014
+ className: styles43["wide-only"],
3986
4015
  children: /* @__PURE__ */ jsx(ChevronsRightIcon, {})
3987
4016
  }
3988
4017
  )