@eqtylab/equality 5.4.0 → 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'>;
@@ -881,19 +881,25 @@ interface DateRange {
881
881
  to?: Date;
882
882
  }
883
883
  interface DateRangePickerProps {
884
+ /** The selected range; either end may be unset */
884
885
  dateRange: DateRange;
886
+ /** Called with the new range when a day is picked or the range is cleared */
885
887
  onSelect: (range: DateRange) => void;
888
+ /** Additional classes on the trigger button */
886
889
  className?: string;
890
+ /** IANA time zone the days follow, such as `Europe/Paris`. @default the browser's zone */
891
+ timeZone?: string;
887
892
  }
888
893
  /**
889
894
  * **Props**
890
- * - `dateRange: DateRange`
891
- * - `onSelect: (range: DateRange) => void`
892
- * - `className?: string`
895
+ * - `dateRange: DateRange` — The selected range; either end may be unset
896
+ * - `onSelect: (range: DateRange) => void` — Called with the new range when a day is picked or the range is cleared
897
+ * - `className?: string` — Additional classes on the trigger button
898
+ * - `timeZone?: string` (default `the browser's zone`) — IANA time zone the days follow, such as `Europe/Paris`.
893
899
  *
894
900
  * [Date Range Picker documentation](https://equality.eqtylab.io/components/date-range-picker)
895
901
  */
896
- declare const DateRangePicker: ({ dateRange, onSelect, className }: DateRangePickerProps) => react_jsx_runtime.JSX.Element;
902
+ declare const DateRangePicker: ({ dateRange, onSelect, className, timeZone }: DateRangePickerProps) => react_jsx_runtime.JSX.Element;
897
903
 
898
904
  declare const displayFieldVariants: (props?: ({
899
905
  variant?: "success" | "neutral" | "neutralCheck" | "failure" | null | undefined;
@@ -1835,39 +1841,52 @@ interface NotFoundProps {
1835
1841
  declare const NotFound: ({ className, title, description, showHomeButton, onHomeClick, }: NotFoundProps) => react_jsx_runtime.JSX.Element;
1836
1842
 
1837
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 */
1838
1845
  currentPage: number;
1846
+ /** Full dataset size; the controls render only when it exceeds the smallest page size */
1839
1847
  totalItems: number;
1848
+ /** Item count after filtering, which drives the page count and the info text */
1840
1849
  filteredItems: number;
1850
+ /** Number of items shown per page */
1841
1851
  itemsPerPage: number;
1852
+ /** Called with the new page when the user navigates */
1842
1853
  onPageChange: (page: number) => void;
1854
+ /** Called with the new page size; when set, the items-per-page dropdown shows */
1843
1855
  onItemsPerPageChange?: (itemsPerPage: number) => void;
1856
+ /** Choices in the items-per-page dropdown */
1844
1857
  itemsPerPageOptions?: number[];
1858
+ /** Whether to show the "X–Y of Z" info text and the items-per-page dropdown */
1845
1859
  showInfo?: boolean;
1860
+ /** Whether to show jump-to-first and jump-to-last buttons once there are more pages than `maxVisiblePages` */
1846
1861
  showFirstLast?: boolean;
1862
+ /** Most numbered page buttons shown at once */
1847
1863
  maxVisiblePages?: number;
1864
+ /** Additional classes on the root */
1848
1865
  className?: string;
1866
+ /** Noun after the total in the info text, such as `items` */
1849
1867
  type?: string;
1868
+ /** Element, or an element `id`, scrolled into view when the page changes */
1850
1869
  scrollTargetRef?: React$1.RefObject<HTMLElement | null> | string;
1851
1870
  }
1852
1871
  /**
1853
1872
  * **Props**
1854
- * - `currentPage: number`
1855
- * - `totalItems: number`
1856
- * - `filteredItems: number`
1857
- * - `itemsPerPage: number`
1858
- * - `onPageChange: (page: number) => void`
1859
- * - `onItemsPerPageChange?: (itemsPerPage: number) => void`
1860
- * - `itemsPerPageOptions?: number[]` (default `[10, 25, 50, 100]`)
1861
- * - `showInfo?: boolean` (default `true`)
1862
- * - `showFirstLast?: boolean` (default `true`)
1863
- * - `maxVisiblePages?: number` (default `5`)
1864
- * - `className?: string` (default `""`)
1865
- * - `type?: string` (default `""`)
1866
- * - `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
1867
1886
  *
1868
1887
  * [Pagination documentation](https://equality.eqtylab.io/components/pagination)
1869
1888
  */
1870
- 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;
1871
1890
 
1872
1891
  interface PanelLabelProps {
1873
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'>;
@@ -881,19 +881,25 @@ interface DateRange {
881
881
  to?: Date;
882
882
  }
883
883
  interface DateRangePickerProps {
884
+ /** The selected range; either end may be unset */
884
885
  dateRange: DateRange;
886
+ /** Called with the new range when a day is picked or the range is cleared */
885
887
  onSelect: (range: DateRange) => void;
888
+ /** Additional classes on the trigger button */
886
889
  className?: string;
890
+ /** IANA time zone the days follow, such as `Europe/Paris`. @default the browser's zone */
891
+ timeZone?: string;
887
892
  }
888
893
  /**
889
894
  * **Props**
890
- * - `dateRange: DateRange`
891
- * - `onSelect: (range: DateRange) => void`
892
- * - `className?: string`
895
+ * - `dateRange: DateRange` — The selected range; either end may be unset
896
+ * - `onSelect: (range: DateRange) => void` — Called with the new range when a day is picked or the range is cleared
897
+ * - `className?: string` — Additional classes on the trigger button
898
+ * - `timeZone?: string` (default `the browser's zone`) — IANA time zone the days follow, such as `Europe/Paris`.
893
899
  *
894
900
  * [Date Range Picker documentation](https://equality.eqtylab.io/components/date-range-picker)
895
901
  */
896
- declare const DateRangePicker: ({ dateRange, onSelect, className }: DateRangePickerProps) => react_jsx_runtime.JSX.Element;
902
+ declare const DateRangePicker: ({ dateRange, onSelect, className, timeZone }: DateRangePickerProps) => react_jsx_runtime.JSX.Element;
897
903
 
898
904
  declare const displayFieldVariants: (props?: ({
899
905
  variant?: "success" | "neutral" | "neutralCheck" | "failure" | null | undefined;
@@ -1835,39 +1841,52 @@ interface NotFoundProps {
1835
1841
  declare const NotFound: ({ className, title, description, showHomeButton, onHomeClick, }: NotFoundProps) => react_jsx_runtime.JSX.Element;
1836
1842
 
1837
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 */
1838
1845
  currentPage: number;
1846
+ /** Full dataset size; the controls render only when it exceeds the smallest page size */
1839
1847
  totalItems: number;
1848
+ /** Item count after filtering, which drives the page count and the info text */
1840
1849
  filteredItems: number;
1850
+ /** Number of items shown per page */
1841
1851
  itemsPerPage: number;
1852
+ /** Called with the new page when the user navigates */
1842
1853
  onPageChange: (page: number) => void;
1854
+ /** Called with the new page size; when set, the items-per-page dropdown shows */
1843
1855
  onItemsPerPageChange?: (itemsPerPage: number) => void;
1856
+ /** Choices in the items-per-page dropdown */
1844
1857
  itemsPerPageOptions?: number[];
1858
+ /** Whether to show the "X–Y of Z" info text and the items-per-page dropdown */
1845
1859
  showInfo?: boolean;
1860
+ /** Whether to show jump-to-first and jump-to-last buttons once there are more pages than `maxVisiblePages` */
1846
1861
  showFirstLast?: boolean;
1862
+ /** Most numbered page buttons shown at once */
1847
1863
  maxVisiblePages?: number;
1864
+ /** Additional classes on the root */
1848
1865
  className?: string;
1866
+ /** Noun after the total in the info text, such as `items` */
1849
1867
  type?: string;
1868
+ /** Element, or an element `id`, scrolled into view when the page changes */
1850
1869
  scrollTargetRef?: React$1.RefObject<HTMLElement | null> | string;
1851
1870
  }
1852
1871
  /**
1853
1872
  * **Props**
1854
- * - `currentPage: number`
1855
- * - `totalItems: number`
1856
- * - `filteredItems: number`
1857
- * - `itemsPerPage: number`
1858
- * - `onPageChange: (page: number) => void`
1859
- * - `onItemsPerPageChange?: (itemsPerPage: number) => void`
1860
- * - `itemsPerPageOptions?: number[]` (default `[10, 25, 50, 100]`)
1861
- * - `showInfo?: boolean` (default `true`)
1862
- * - `showFirstLast?: boolean` (default `true`)
1863
- * - `maxVisiblePages?: number` (default `5`)
1864
- * - `className?: string` (default `""`)
1865
- * - `type?: string` (default `""`)
1866
- * - `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
1867
1886
  *
1868
1887
  * [Pagination documentation](https://equality.eqtylab.io/components/pagination)
1869
1888
  */
1870
- 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;
1871
1890
 
1872
1891
  interface PanelLabelProps {
1873
1892
  className?: string;
package/dist/index.js CHANGED
@@ -1378,21 +1378,68 @@ var PopoverContent = React16.forwardRef(({ className, align = "center", sideOffs
1378
1378
  }
1379
1379
  ) }));
1380
1380
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
1381
+
1382
+ // src/lib/zoned-day.ts
1383
+ var formatters = /* @__PURE__ */ new Map();
1384
+ var formatterFor = (timeZone) => {
1385
+ const key = timeZone ?? "";
1386
+ let formatter = formatters.get(key);
1387
+ if (!formatter) {
1388
+ formatter = new Intl.DateTimeFormat("en-US", {
1389
+ timeZone,
1390
+ year: "numeric",
1391
+ month: "numeric",
1392
+ day: "numeric"
1393
+ });
1394
+ formatters.set(key, formatter);
1395
+ }
1396
+ return formatter;
1397
+ };
1398
+ var dayOf = (instant, timeZone) => {
1399
+ const parts = formatterFor(timeZone).formatToParts(instant);
1400
+ const part = (type) => Number(parts.find((p) => p.type === type)?.value);
1401
+ return { year: part("year"), month: part("month") - 1, day: part("day") };
1402
+ };
1403
+ var dayKey = ({ year, month, day }) => year * 1e4 + month * 100 + day;
1404
+ var addDays = ({ year, month, day }, count2) => {
1405
+ const date = new Date(Date.UTC(year, month, day + count2));
1406
+ return { year: date.getUTCFullYear(), month: date.getUTCMonth(), day: date.getUTCDate() };
1407
+ };
1408
+ var SEARCH_WINDOW = 15 * 60 * 60 * 1e3;
1409
+ var startOfDay = (target, timeZone) => {
1410
+ const key = dayKey(target);
1411
+ const utcMidnight = Date.UTC(target.year, target.month, target.day);
1412
+ let low = utcMidnight - SEARCH_WINDOW;
1413
+ let high = utcMidnight + SEARCH_WINDOW;
1414
+ while (low < high) {
1415
+ const middle = Math.floor((low + high) / 2);
1416
+ if (dayKey(dayOf(new Date(middle), timeZone)) < key) low = middle + 1;
1417
+ else high = middle;
1418
+ }
1419
+ return new Date(low);
1420
+ };
1421
+ var endOfDay = (target, timeZone) => new Date(startOfDay(addDays(target, 1), timeZone).getTime() - 1);
1381
1422
  var CalendarDaysIcon = CalendarDays;
1382
1423
  var ChevronLeftIcon = ChevronLeft;
1383
1424
  var ChevronRightIcon = ChevronRight;
1384
- var DateRangePicker = ({ dateRange, onSelect, className }) => {
1425
+ var validDate = (date) => date && !Number.isNaN(date.getTime()) ? date : void 0;
1426
+ var DateRangePicker = ({ dateRange, onSelect, className, timeZone }) => {
1427
+ const today = dayOf(/* @__PURE__ */ new Date(), timeZone);
1385
1428
  const [selecting, setSelecting] = useState(null);
1386
- const [displayedMonth, setDisplayedMonth] = useState((/* @__PURE__ */ new Date()).getMonth());
1387
- const [displayedYear, setDisplayedYear] = useState((/* @__PURE__ */ new Date()).getFullYear());
1388
- const daysInMonth = new Date(displayedYear, displayedMonth + 1, 0).getDate();
1389
- const firstDayOfMonth = new Date(displayedYear, displayedMonth, 1).getDay();
1429
+ const [displayedMonth, setDisplayedMonth] = useState(today.month);
1430
+ const [displayedYear, setDisplayedYear] = useState(today.year);
1431
+ const from = validDate(dateRange.from);
1432
+ const to = validDate(dateRange.to);
1433
+ const daysInMonth = new Date(Date.UTC(displayedYear, displayedMonth + 1, 0)).getUTCDate();
1434
+ const firstDayOfMonth = new Date(Date.UTC(displayedYear, displayedMonth, 1)).getUTCDay();
1390
1435
  const days = Array.from(
1391
1436
  { length: daysInMonth },
1392
- (_, i) => new Date(displayedYear, displayedMonth, i + 1)
1437
+ (_, i) => ({ year: displayedYear, month: displayedMonth, day: i + 1 })
1393
1438
  );
1439
+ const fromKey = from && dayKey(dayOf(from, timeZone));
1440
+ const toKey = to && dayKey(dayOf(to, timeZone));
1394
1441
  const paddingDays = Array.from({ length: firstDayOfMonth }, (_, _i) => null);
1395
- const hasSelection = dateRange.from || dateRange.to;
1442
+ const hasSelection = from || to;
1396
1443
  const MONTHS = [
1397
1444
  "January",
1398
1445
  "February",
@@ -1409,11 +1456,8 @@ var DateRangePicker = ({ dateRange, onSelect, className }) => {
1409
1456
  ];
1410
1457
  const DAY_HEADERS = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
1411
1458
  const formatDate = (date) => {
1412
- return date.toLocaleDateString("en-US", {
1413
- year: "numeric",
1414
- month: "2-digit",
1415
- day: "2-digit"
1416
- });
1459
+ const { year, month, day } = dayOf(date, timeZone);
1460
+ return `${String(month + 1).padStart(2, "0")}/${String(day).padStart(2, "0")}/${year}`;
1417
1461
  };
1418
1462
  const formatRange = (range) => {
1419
1463
  if (!range.from && !range.to) return "Select Date Range";
@@ -1421,15 +1465,9 @@ var DateRangePicker = ({ dateRange, onSelect, className }) => {
1421
1465
  if (!range.from) return `Until ${formatDate(range.to)}`;
1422
1466
  return `${formatDate(range.from)} - ${formatDate(range.to)}`;
1423
1467
  };
1424
- const isDateSelected = (day, dateRange2) => {
1425
- const matchesFrom = dateRange2.from && day.getDate() === dateRange2.from.getDate() && day.getMonth() === dateRange2.from.getMonth() && day.getFullYear() === dateRange2.from.getFullYear();
1426
- const matchesTo = dateRange2.to && day.getDate() === dateRange2.to.getDate() && day.getMonth() === dateRange2.to.getMonth() && day.getFullYear() === dateRange2.to.getFullYear();
1427
- return !!matchesFrom || !!matchesTo;
1428
- };
1429
- const checkIsToday = (day) => {
1430
- const today = /* @__PURE__ */ new Date();
1431
- return day.getDate() === today.getDate() && day.getMonth() === today.getMonth() && day.getFullYear() === today.getFullYear();
1432
- };
1468
+ const isDateSelected = (day) => dayKey(day) === fromKey || dayKey(day) === toKey;
1469
+ const todayKey = dayKey(today);
1470
+ const checkIsToday = (day) => dayKey(day) === todayKey;
1433
1471
  const goToPreviousMonth = () => {
1434
1472
  if (displayedMonth === 0) {
1435
1473
  setDisplayedMonth(11);
@@ -1446,34 +1484,23 @@ var DateRangePicker = ({ dateRange, onSelect, className }) => {
1446
1484
  setDisplayedMonth(displayedMonth + 1);
1447
1485
  }
1448
1486
  };
1449
- const isInRange = (date) => {
1450
- if (!dateRange.from || !dateRange.to) return false;
1451
- return date >= dateRange.from && date <= dateRange.to;
1487
+ const isInRange = (day) => {
1488
+ if (fromKey === void 0 || toKey === void 0) return false;
1489
+ return dayKey(day) >= fromKey && dayKey(day) <= toKey;
1452
1490
  };
1453
- const handleDateSelect = (selectedDate) => {
1454
- const startOfDay = (date) => {
1455
- const d = new Date(date);
1456
- d.setHours(0, 0, 0, 0);
1457
- return d;
1458
- };
1459
- const endOfDay = (date) => {
1460
- const d = new Date(date);
1461
- d.setHours(23, 59, 59, 999);
1462
- return d;
1463
- };
1464
- if (!selecting || !dateRange) {
1465
- onSelect({ from: startOfDay(selectedDate), to: void 0 });
1491
+ const handleDateSelect = (selectedDay) => {
1492
+ if (!selecting || !from) {
1493
+ onSelect({ from: startOfDay(selectedDay, timeZone), to: void 0 });
1466
1494
  setSelecting("to");
1467
1495
  return;
1468
1496
  }
1469
- if (selecting === "to") {
1470
- if (dateRange.from && selectedDate < dateRange.from) {
1471
- onSelect({ from: startOfDay(selectedDate), to: endOfDay(dateRange.from) });
1472
- } else {
1473
- onSelect({ from: startOfDay(dateRange.from), to: endOfDay(selectedDate) });
1474
- }
1475
- setSelecting(null);
1497
+ const fromDay = dayOf(from, timeZone);
1498
+ if (dayKey(selectedDay) < dayKey(fromDay)) {
1499
+ onSelect({ from: startOfDay(selectedDay, timeZone), to: endOfDay(fromDay, timeZone) });
1500
+ } else {
1501
+ onSelect({ from: startOfDay(fromDay, timeZone), to: endOfDay(selectedDay, timeZone) });
1476
1502
  }
1503
+ setSelecting(null);
1477
1504
  };
1478
1505
  const clearSelection = () => {
1479
1506
  onSelect({ from: void 0, to: void 0 });
@@ -1499,7 +1526,7 @@ var DateRangePicker = ({ dateRange, onSelect, className }) => {
1499
1526
  }
1500
1527
  ),
1501
1528
  className,
1502
- children: /* @__PURE__ */ jsx("span", { className: styles20["date-range"], children: formatRange(dateRange) })
1529
+ children: /* @__PURE__ */ jsx("span", { className: styles20["date-range"], children: formatRange({ from, to }) })
1503
1530
  }
1504
1531
  ) }) }),
1505
1532
  /* @__PURE__ */ jsxs(PopoverContent, { className: styles20["popover-content"], align: "end", children: [
@@ -1533,7 +1560,7 @@ var DateRangePicker = ({ dateRange, onSelect, className }) => {
1533
1560
  /* @__PURE__ */ jsxs("div", { className: styles20["calendar-grid"], children: [
1534
1561
  paddingDays.map((_, index) => /* @__PURE__ */ jsx("div", {}, `padding-${index}`)),
1535
1562
  days.map((day, index) => {
1536
- const isSelected = isDateSelected(day, dateRange);
1563
+ const isSelected = isDateSelected(day);
1537
1564
  const isToday = checkIsToday(day);
1538
1565
  const inRange = isInRange(day);
1539
1566
  return /* @__PURE__ */ jsx(
@@ -1546,8 +1573,9 @@ var DateRangePicker = ({ dateRange, onSelect, className }) => {
1546
1573
  isToday && !isSelected && styles20["calendar-day-btn--today"],
1547
1574
  inRange && !isSelected && styles20["calendar-day-btn--in-range"]
1548
1575
  ),
1576
+ "aria-current": isToday ? "date" : void 0,
1549
1577
  onClick: () => handleDateSelect(day),
1550
- children: day.getDate()
1578
+ children: day.day
1551
1579
  },
1552
1580
  index
1553
1581
  );
@@ -3798,7 +3826,7 @@ var ChevronRightIcon3 = ChevronRight;
3798
3826
  var ChevronsLeftIcon = ChevronsLeft;
3799
3827
  var ChevronsRightIcon = ChevronsRight;
3800
3828
  var Pagination = ({
3801
- currentPage,
3829
+ currentPage: requestedPage,
3802
3830
  totalItems,
3803
3831
  filteredItems,
3804
3832
  itemsPerPage,
@@ -3813,6 +3841,7 @@ var Pagination = ({
3813
3841
  scrollTargetRef
3814
3842
  }) => {
3815
3843
  const totalPages = Math.ceil(filteredItems / itemsPerPage);
3844
+ const currentPage = Math.min(Math.max(requestedPage, 1), Math.max(totalPages, 1));
3816
3845
  const startItem = Math.min(filteredItems, 1 + (currentPage - 1) * itemsPerPage);
3817
3846
  const endItem = Math.min(currentPage * itemsPerPage, filteredItems);
3818
3847
  const hasFilteredItems = filteredItems > 0;
@@ -3879,6 +3908,7 @@ var Pagination = ({
3879
3908
  onClick: () => handlePageChange(i),
3880
3909
  "aria-label": `Page ${i} of ${totalPages}`,
3881
3910
  "aria-current": currentPage === i ? "page" : void 0,
3911
+ className: cn(currentPage !== i && styles43["wide-only"]),
3882
3912
  children: i
3883
3913
  },
3884
3914
  i
@@ -3888,30 +3918,55 @@ var Pagination = ({
3888
3918
  return pageButtons;
3889
3919
  };
3890
3920
  return /* @__PURE__ */ jsxs("div", { className: cn(styles43["pagination"], className), children: [
3891
- /* @__PURE__ */ jsx("div", { className: styles43["info-container"], children: showInfo && hasFilteredItems && /* @__PURE__ */ jsxs(Fragment, { children: [
3892
- /* @__PURE__ */ jsxs("span", { children: [
3893
- "Showing ",
3894
- startItem,
3895
- " 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
+ ] })
3896
3943
  ] }),
3897
- 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
+ ] }),
3898
3956
  /* @__PURE__ */ jsx(
3899
- SelectTrigger,
3957
+ "span",
3900
3958
  {
3901
- className: styles43["items-per-page-trigger"],
3902
- "aria-label": "Items per page",
3903
- 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"
3904
3966
  }
3905
- ),
3906
- /* @__PURE__ */ jsx(SelectContent, { children: itemsPerPageOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.toString(), children: option }, option)) })
3907
- ] }) : /* @__PURE__ */ jsx("span", { children: endItem }),
3908
- /* @__PURE__ */ jsxs("span", { children: [
3909
- "of ",
3910
- filteredItems,
3911
- " ",
3912
- type
3967
+ )
3913
3968
  ] })
3914
- ] }) }),
3969
+ ] }),
3915
3970
  /* @__PURE__ */ jsxs("nav", { className: styles43["page-navigation-container"], "aria-label": "Pagination", children: [
3916
3971
  showFirstLastButtons && /* @__PURE__ */ jsx(
3917
3972
  Button,
@@ -3921,6 +3976,7 @@ var Pagination = ({
3921
3976
  onClick: handleFirstPage,
3922
3977
  disabled: isFirstPage,
3923
3978
  "aria-label": "First page",
3979
+ className: styles43["wide-only"],
3924
3980
  children: /* @__PURE__ */ jsx(ChevronsLeftIcon, {})
3925
3981
  }
3926
3982
  ),
@@ -3955,6 +4011,7 @@ var Pagination = ({
3955
4011
  onClick: handleLastPage,
3956
4012
  disabled: isLastPage,
3957
4013
  "aria-label": `Last page (${totalPages})`,
4014
+ className: styles43["wide-only"],
3958
4015
  children: /* @__PURE__ */ jsx(ChevronsRightIcon, {})
3959
4016
  }
3960
4017
  )