@nukleus-sports/ui-web 0.2.0 → 0.3.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.cjs +42 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import React__default, { ReactNode } from 'react';
|
|
2
|
+
import React__default, { ReactNode, RefObject } from 'react';
|
|
3
3
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
4
4
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
5
5
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
@@ -168,9 +168,10 @@ interface BaseTableProps$1<TData, TValue> {
|
|
|
168
168
|
getRowClassName?: (row: TData, isRightPane?: boolean) => string;
|
|
169
169
|
getRowProps?: (row: TData) => React$1.HTMLAttributes<HTMLTableRowElement>;
|
|
170
170
|
/**
|
|
171
|
-
* Optional content rendered after the last row
|
|
172
|
-
*
|
|
173
|
-
*
|
|
171
|
+
* Optional content rendered after the last row — e.g. an infinite-scroll sentinel. In the
|
|
172
|
+
* standard and fixed-header layouts it sits INSIDE the scroll container, so it's measured
|
|
173
|
+
* against the internal scroller; in split layout there is no internal vertical scroller (the
|
|
174
|
+
* page scrolls), so it renders just after the split grid and is measured against the viewport.
|
|
174
175
|
*/
|
|
175
176
|
bottomContent?: React$1.ReactNode;
|
|
176
177
|
}
|
|
@@ -1167,4 +1168,13 @@ declare function useInfiniteList<T>(items: T[], options?: UseInfiniteListOptions
|
|
|
1167
1168
|
|
|
1168
1169
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1169
1170
|
|
|
1170
|
-
|
|
1171
|
+
interface ElementSize {
|
|
1172
|
+
width: number;
|
|
1173
|
+
height: number;
|
|
1174
|
+
}
|
|
1175
|
+
/** Size of an element's bounding box, kept current with a ResizeObserver. */
|
|
1176
|
+
declare function useElementSize(ref: RefObject<HTMLElement | null>): ElementSize;
|
|
1177
|
+
/** Largest width × height with the media's aspect ratio that fits the box. */
|
|
1178
|
+
declare function fitContain(box: ElementSize, natural: ElementSize): ElementSize;
|
|
1179
|
+
|
|
1180
|
+
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, type ElementSize, 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, fitContain, showUndoToast, taskColumnSize, textareaVariants, toggleVariants, useElementSize, useFormField, useInfiniteList, useSidebar };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import React__default, { ReactNode } from 'react';
|
|
2
|
+
import React__default, { ReactNode, RefObject } from 'react';
|
|
3
3
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
4
4
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
5
5
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
@@ -168,9 +168,10 @@ interface BaseTableProps$1<TData, TValue> {
|
|
|
168
168
|
getRowClassName?: (row: TData, isRightPane?: boolean) => string;
|
|
169
169
|
getRowProps?: (row: TData) => React$1.HTMLAttributes<HTMLTableRowElement>;
|
|
170
170
|
/**
|
|
171
|
-
* Optional content rendered after the last row
|
|
172
|
-
*
|
|
173
|
-
*
|
|
171
|
+
* Optional content rendered after the last row — e.g. an infinite-scroll sentinel. In the
|
|
172
|
+
* standard and fixed-header layouts it sits INSIDE the scroll container, so it's measured
|
|
173
|
+
* against the internal scroller; in split layout there is no internal vertical scroller (the
|
|
174
|
+
* page scrolls), so it renders just after the split grid and is measured against the viewport.
|
|
174
175
|
*/
|
|
175
176
|
bottomContent?: React$1.ReactNode;
|
|
176
177
|
}
|
|
@@ -1167,4 +1168,13 @@ declare function useInfiniteList<T>(items: T[], options?: UseInfiniteListOptions
|
|
|
1167
1168
|
|
|
1168
1169
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1169
1170
|
|
|
1170
|
-
|
|
1171
|
+
interface ElementSize {
|
|
1172
|
+
width: number;
|
|
1173
|
+
height: number;
|
|
1174
|
+
}
|
|
1175
|
+
/** Size of an element's bounding box, kept current with a ResizeObserver. */
|
|
1176
|
+
declare function useElementSize(ref: RefObject<HTMLElement | null>): ElementSize;
|
|
1177
|
+
/** Largest width × height with the media's aspect ratio that fits the box. */
|
|
1178
|
+
declare function fitContain(box: ElementSize, natural: ElementSize): ElementSize;
|
|
1179
|
+
|
|
1180
|
+
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, type ElementSize, 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, fitContain, showUndoToast, taskColumnSize, textareaVariants, toggleVariants, useElementSize, useFormField, useInfiniteList, useSidebar };
|
package/dist/index.js
CHANGED
|
@@ -1116,6 +1116,7 @@ function BaseTable({
|
|
|
1116
1116
|
]
|
|
1117
1117
|
}
|
|
1118
1118
|
),
|
|
1119
|
+
bottomContent,
|
|
1119
1120
|
!loading && !table.getRowModel().rows?.length && /* @__PURE__ */ jsx12(
|
|
1120
1121
|
TableEmpty,
|
|
1121
1122
|
{
|
|
@@ -6284,6 +6285,43 @@ function useInfiniteList(items, options = {}) {
|
|
|
6284
6285
|
const visibleItems = useMemo2(() => items.slice(0, effectiveCount), [items, effectiveCount]);
|
|
6285
6286
|
return { visibleItems, sentinelRef, hasMore, displayCount: effectiveCount };
|
|
6286
6287
|
}
|
|
6288
|
+
|
|
6289
|
+
// src/hooks/use-element-size.ts
|
|
6290
|
+
import { useEffect as useEffect10, useState as useState10 } from "react";
|
|
6291
|
+
function useElementSize(ref) {
|
|
6292
|
+
const [size, setSize] = useState10({ width: 0, height: 0 });
|
|
6293
|
+
useEffect10(() => {
|
|
6294
|
+
const el = ref.current;
|
|
6295
|
+
if (!el) return;
|
|
6296
|
+
const update = () => {
|
|
6297
|
+
const { width, height } = el.getBoundingClientRect();
|
|
6298
|
+
setSize(
|
|
6299
|
+
(prev) => prev.width === width && prev.height === height ? prev : { width, height }
|
|
6300
|
+
);
|
|
6301
|
+
};
|
|
6302
|
+
update();
|
|
6303
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
6304
|
+
const observer = new ResizeObserver(update);
|
|
6305
|
+
observer.observe(el);
|
|
6306
|
+
return () => observer.disconnect();
|
|
6307
|
+
}, [ref]);
|
|
6308
|
+
return size;
|
|
6309
|
+
}
|
|
6310
|
+
function fitContain(box, natural) {
|
|
6311
|
+
if (box.width <= 0 || box.height <= 0 || natural.width <= 0 || natural.height <= 0) {
|
|
6312
|
+
return { width: 0, height: 0 };
|
|
6313
|
+
}
|
|
6314
|
+
if (box.width * natural.height <= box.height * natural.width) {
|
|
6315
|
+
return {
|
|
6316
|
+
width: Math.floor(box.width),
|
|
6317
|
+
height: Math.floor(box.width * natural.height / natural.width)
|
|
6318
|
+
};
|
|
6319
|
+
}
|
|
6320
|
+
return {
|
|
6321
|
+
width: Math.floor(box.height * natural.width / natural.height),
|
|
6322
|
+
height: Math.floor(box.height)
|
|
6323
|
+
};
|
|
6324
|
+
}
|
|
6287
6325
|
export {
|
|
6288
6326
|
Accordion,
|
|
6289
6327
|
AccordionContent,
|
|
@@ -6490,11 +6528,13 @@ export {
|
|
|
6490
6528
|
columnSize,
|
|
6491
6529
|
createClickableSortableHeader,
|
|
6492
6530
|
createSortableHeader,
|
|
6531
|
+
fitContain,
|
|
6493
6532
|
showUndoToast,
|
|
6494
6533
|
taskColumnSize,
|
|
6495
6534
|
textareaVariants,
|
|
6496
6535
|
toast2 as toast,
|
|
6497
6536
|
toggleVariants,
|
|
6537
|
+
useElementSize,
|
|
6498
6538
|
useFormField,
|
|
6499
6539
|
useInfiniteList,
|
|
6500
6540
|
useSidebar
|