@nukleus-sports/ui-web 0.1.1 → 0.2.0

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
@@ -1145,6 +1145,26 @@ declare function UndoToast({ toastId, title, description, itemCount, destination
1145
1145
  */
1146
1146
  declare function showUndoToast(options: ShowUndoToastOptions): string | number;
1147
1147
 
1148
+ interface UseInfiniteListOptions {
1149
+ /** Rows rendered on first paint and added per batch. */
1150
+ batchSize?: number;
1151
+ /** Distance from the sentinel at which the next batch is pulled in. */
1152
+ prefetchPx?: number;
1153
+ /** Dataset shape identity -- the window resets only when this changes, not on every refetch. */
1154
+ resetKey?: string | number;
1155
+ /** Scroll container ref, when the list scrolls inside a bounded element instead of the page. */
1156
+ scrollRootRef?: {
1157
+ current: HTMLElement | null;
1158
+ };
1159
+ }
1160
+ /** Client-side windowing over an in-memory array, pairing with `BaseTable` -- see RECONCILIATION.md. */
1161
+ declare function useInfiniteList<T>(items: T[], options?: UseInfiniteListOptions): {
1162
+ visibleItems: T[];
1163
+ sentinelRef: (node: HTMLDivElement | null) => void;
1164
+ hasMore: boolean;
1165
+ displayCount: number;
1166
+ };
1167
+
1148
1168
  declare function cn(...inputs: ClassValue[]): string;
1149
1169
 
1150
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, AvatarTableCell, Badge, type BadgeProps, BaseTable, BaseTasksTable, Button, type ButtonProps, Calendar, CalendarDayButton, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type ColumnSize, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FixedHeaderTable, FixedHeaderTableHeader, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, IconLoader, type IconLoaderProps, InfoCard, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, Loader, type LoaderProps, MobileModalLayout, MobileMultiSelect, MobileSkeleton, MultiSelect, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Pre, Progress, RadioGroup, RadioGroupItem, SafeTableCell, ScrollArea, ScrollBar, ScrollableTableContainer, ScrollableTableLeft, ScrollableTableRight, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, type ShowUndoToastOptions, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, SortableRowWrapper, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableEmpty, type TableEmptyProps, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TaskColumnSize, Textarea, type TextareaProps, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UndoToast, badgeVariants, buttonVariants, cn, columnSize, createClickableSortableHeader, createSortableHeader, showUndoToast, taskColumnSize, textareaVariants, toggleVariants, useFormField, useSidebar };
1170
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, AvatarTableCell, Badge, type BadgeProps, BaseTable, BaseTasksTable, Button, type ButtonProps, Calendar, CalendarDayButton, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type ColumnSize, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FixedHeaderTable, FixedHeaderTableHeader, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, IconLoader, type IconLoaderProps, InfoCard, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, Loader, type LoaderProps, MobileModalLayout, MobileMultiSelect, MobileSkeleton, MultiSelect, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Pre, Progress, RadioGroup, RadioGroupItem, SafeTableCell, ScrollArea, ScrollBar, ScrollableTableContainer, ScrollableTableLeft, ScrollableTableRight, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, type ShowUndoToastOptions, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, SortableRowWrapper, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableEmpty, type TableEmptyProps, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TaskColumnSize, Textarea, type TextareaProps, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UndoToast, badgeVariants, buttonVariants, cn, columnSize, createClickableSortableHeader, createSortableHeader, showUndoToast, taskColumnSize, textareaVariants, toggleVariants, useFormField, useInfiniteList, useSidebar };
package/dist/index.d.ts CHANGED
@@ -1145,6 +1145,26 @@ declare function UndoToast({ toastId, title, description, itemCount, destination
1145
1145
  */
1146
1146
  declare function showUndoToast(options: ShowUndoToastOptions): string | number;
1147
1147
 
1148
+ interface UseInfiniteListOptions {
1149
+ /** Rows rendered on first paint and added per batch. */
1150
+ batchSize?: number;
1151
+ /** Distance from the sentinel at which the next batch is pulled in. */
1152
+ prefetchPx?: number;
1153
+ /** Dataset shape identity -- the window resets only when this changes, not on every refetch. */
1154
+ resetKey?: string | number;
1155
+ /** Scroll container ref, when the list scrolls inside a bounded element instead of the page. */
1156
+ scrollRootRef?: {
1157
+ current: HTMLElement | null;
1158
+ };
1159
+ }
1160
+ /** Client-side windowing over an in-memory array, pairing with `BaseTable` -- see RECONCILIATION.md. */
1161
+ declare function useInfiniteList<T>(items: T[], options?: UseInfiniteListOptions): {
1162
+ visibleItems: T[];
1163
+ sentinelRef: (node: HTMLDivElement | null) => void;
1164
+ hasMore: boolean;
1165
+ displayCount: number;
1166
+ };
1167
+
1148
1168
  declare function cn(...inputs: ClassValue[]): string;
1149
1169
 
1150
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, AvatarTableCell, Badge, type BadgeProps, BaseTable, BaseTasksTable, Button, type ButtonProps, Calendar, CalendarDayButton, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type ColumnSize, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FixedHeaderTable, FixedHeaderTableHeader, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, IconLoader, type IconLoaderProps, InfoCard, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, Loader, type LoaderProps, MobileModalLayout, MobileMultiSelect, MobileSkeleton, MultiSelect, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Pre, Progress, RadioGroup, RadioGroupItem, SafeTableCell, ScrollArea, ScrollBar, ScrollableTableContainer, ScrollableTableLeft, ScrollableTableRight, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, type ShowUndoToastOptions, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, SortableRowWrapper, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableEmpty, type TableEmptyProps, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TaskColumnSize, Textarea, type TextareaProps, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UndoToast, badgeVariants, buttonVariants, cn, columnSize, createClickableSortableHeader, createSortableHeader, showUndoToast, taskColumnSize, textareaVariants, toggleVariants, useFormField, useSidebar };
1170
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, AvatarTableCell, Badge, type BadgeProps, BaseTable, BaseTasksTable, Button, type ButtonProps, Calendar, CalendarDayButton, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type ColumnSize, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FixedHeaderTable, FixedHeaderTableHeader, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, IconLoader, type IconLoaderProps, InfoCard, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, Loader, type LoaderProps, MobileModalLayout, MobileMultiSelect, MobileSkeleton, MultiSelect, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Pre, Progress, RadioGroup, RadioGroupItem, SafeTableCell, ScrollArea, ScrollBar, ScrollableTableContainer, ScrollableTableLeft, ScrollableTableRight, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, type ShowUndoToastOptions, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, SortableRowWrapper, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableEmpty, type TableEmptyProps, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TaskColumnSize, Textarea, type TextareaProps, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UndoToast, badgeVariants, buttonVariants, cn, columnSize, createClickableSortableHeader, createSortableHeader, showUndoToast, taskColumnSize, textareaVariants, toggleVariants, useFormField, useInfiniteList, useSidebar };
package/dist/index.js CHANGED
@@ -3913,7 +3913,13 @@ function Loader({
3913
3913
  }
3914
3914
 
3915
3915
  // src/components/mobile-modal-layout.tsx
3916
- import { Dialog as Dialog2, DialogContent as DialogContent2, DialogOverlay as DialogOverlay2, DialogPortal as DialogPortal2 } from "@radix-ui/react-dialog";
3916
+ import {
3917
+ Dialog as Dialog2,
3918
+ DialogContent as DialogContent2,
3919
+ DialogOverlay as DialogOverlay2,
3920
+ DialogPortal as DialogPortal2,
3921
+ DialogTitle as DialogTitle2
3922
+ } from "@radix-ui/react-dialog";
3917
3923
  import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
3918
3924
  function ArrowLeftIcon2({ width = 20, height = 20, className }) {
3919
3925
  return /* @__PURE__ */ jsx27(
@@ -4033,7 +4039,7 @@ var MobileModalLayout = ({
4033
4039
  !showBackButton && isDialog ? "px-9" : "px-2"
4034
4040
  ),
4035
4041
  children: [
4036
- /* @__PURE__ */ jsx27(
4042
+ /* @__PURE__ */ jsx27(DialogTitle2, { asChild: true, children: /* @__PURE__ */ jsx27(
4037
4043
  "div",
4038
4044
  {
4039
4045
  className: cn(
@@ -4043,7 +4049,7 @@ var MobileModalLayout = ({
4043
4049
  ),
4044
4050
  children: title
4045
4051
  }
4046
- ),
4052
+ ) }),
4047
4053
  actionContext && actionContext,
4048
4054
  cancelButtonName && /* @__PURE__ */ jsx27(
4049
4055
  Button,
@@ -6244,6 +6250,40 @@ function showUndoToast(options) {
6244
6250
  { duration }
6245
6251
  );
6246
6252
  }
6253
+
6254
+ // src/hooks/use-infinite-list.ts
6255
+ import { useCallback as useCallback3, useEffect as useEffect9, useMemo as useMemo2, useState as useState9 } from "react";
6256
+ function useInfiniteList(items, options = {}) {
6257
+ const { batchSize = 100, prefetchPx = 300, resetKey, scrollRootRef } = options;
6258
+ const [displayCount, setDisplayCount] = useState9(batchSize);
6259
+ const [sentinelNode, setSentinelNode] = useState9(null);
6260
+ const sentinelRef = useCallback3((node) => setSentinelNode(node), []);
6261
+ useEffect9(() => {
6262
+ setDisplayCount(batchSize);
6263
+ }, [resetKey, batchSize]);
6264
+ const effectiveCount = Math.min(
6265
+ Math.max(displayCount, batchSize),
6266
+ Math.max(items.length, batchSize)
6267
+ );
6268
+ const hasMore = effectiveCount < items.length;
6269
+ useEffect9(() => {
6270
+ if (!hasMore || !sentinelNode) return;
6271
+ const observer = new IntersectionObserver(
6272
+ (entries) => {
6273
+ if (entries[0].isIntersecting) setDisplayCount((prev) => prev + batchSize);
6274
+ },
6275
+ {
6276
+ threshold: 0,
6277
+ root: scrollRootRef?.current ?? null,
6278
+ rootMargin: `${prefetchPx}px 0px ${prefetchPx}px 0px`
6279
+ }
6280
+ );
6281
+ observer.observe(sentinelNode);
6282
+ return () => observer.disconnect();
6283
+ }, [hasMore, batchSize, prefetchPx, scrollRootRef, displayCount, sentinelNode]);
6284
+ const visibleItems = useMemo2(() => items.slice(0, effectiveCount), [items, effectiveCount]);
6285
+ return { visibleItems, sentinelRef, hasMore, displayCount: effectiveCount };
6286
+ }
6247
6287
  export {
6248
6288
  Accordion,
6249
6289
  AccordionContent,
@@ -6456,6 +6496,7 @@ export {
6456
6496
  toast2 as toast,
6457
6497
  toggleVariants,
6458
6498
  useFormField,
6499
+ useInfiniteList,
6459
6500
  useSidebar
6460
6501
  };
6461
6502
  //# sourceMappingURL=index.js.map