@nukleus-sports/ui-web 0.2.1 → 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 +41 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +39 -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';
|
|
@@ -1168,4 +1168,13 @@ declare function useInfiniteList<T>(items: T[], options?: UseInfiniteListOptions
|
|
|
1168
1168
|
|
|
1169
1169
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1170
1170
|
|
|
1171
|
-
|
|
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';
|
|
@@ -1168,4 +1168,13 @@ declare function useInfiniteList<T>(items: T[], options?: UseInfiniteListOptions
|
|
|
1168
1168
|
|
|
1169
1169
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1170
1170
|
|
|
1171
|
-
|
|
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
|
@@ -6285,6 +6285,43 @@ function useInfiniteList(items, options = {}) {
|
|
|
6285
6285
|
const visibleItems = useMemo2(() => items.slice(0, effectiveCount), [items, effectiveCount]);
|
|
6286
6286
|
return { visibleItems, sentinelRef, hasMore, displayCount: effectiveCount };
|
|
6287
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
|
+
}
|
|
6288
6325
|
export {
|
|
6289
6326
|
Accordion,
|
|
6290
6327
|
AccordionContent,
|
|
@@ -6491,11 +6528,13 @@ export {
|
|
|
6491
6528
|
columnSize,
|
|
6492
6529
|
createClickableSortableHeader,
|
|
6493
6530
|
createSortableHeader,
|
|
6531
|
+
fitContain,
|
|
6494
6532
|
showUndoToast,
|
|
6495
6533
|
taskColumnSize,
|
|
6496
6534
|
textareaVariants,
|
|
6497
6535
|
toast2 as toast,
|
|
6498
6536
|
toggleVariants,
|
|
6537
|
+
useElementSize,
|
|
6499
6538
|
useFormField,
|
|
6500
6539
|
useInfiniteList,
|
|
6501
6540
|
useSidebar
|