@facter/ds-core 1.20.0 → 1.22.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.mjs CHANGED
@@ -632,15 +632,15 @@ var SelectItem = React10.forwardRef(({ className, children, ...props }, ref) =>
632
632
  {
633
633
  ref,
634
634
  className: cn(
635
- "relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
635
+ "relative flex w-full cursor-pointer select-none items-center justify-between rounded-sm py-1.5 px-3 text-sm outline-none",
636
636
  "focus:bg-accent focus:text-accent-foreground",
637
637
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
638
638
  className
639
639
  ),
640
640
  ...props,
641
641
  children: [
642
- /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
643
- /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
642
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children }),
643
+ /* @__PURE__ */ jsx("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center ml-2", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-primary" }) }) })
644
644
  ]
645
645
  }
646
646
  ));
@@ -1418,14 +1418,60 @@ function useAvailableHeight(options = {}) {
1418
1418
  style: height ? { maxHeight: `${height}px` } : void 0
1419
1419
  };
1420
1420
  }
1421
- var Table = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
1421
+ function useAutoPageSize(options = {}) {
1422
+ const {
1423
+ rowHeight = 49,
1424
+ headerHeight = 41,
1425
+ paginationHeight = 52,
1426
+ bottomOffset = 16,
1427
+ minRows = 5,
1428
+ maxRows = 50,
1429
+ enabled = true
1430
+ } = options;
1431
+ const ref = useRef(null);
1432
+ const [autoPerPage, setAutoPerPage] = useState(minRows);
1433
+ const [userOverride, setUserOverride] = useState(null);
1434
+ const hasCalculated = useRef(false);
1435
+ const calculate = useCallback(() => {
1436
+ const el = ref.current;
1437
+ if (!el || !enabled) return;
1438
+ const rect = el.getBoundingClientRect();
1439
+ const availableHeight = window.innerHeight - rect.top - headerHeight - paginationHeight - bottomOffset;
1440
+ const rows = Math.floor(availableHeight / rowHeight);
1441
+ const clamped = Math.max(minRows, Math.min(maxRows, rows));
1442
+ setAutoPerPage(clamped);
1443
+ hasCalculated.current = true;
1444
+ }, [rowHeight, headerHeight, paginationHeight, bottomOffset, minRows, maxRows, enabled]);
1445
+ useEffect(() => {
1446
+ if (!enabled) return;
1447
+ const frame = requestAnimationFrame(calculate);
1448
+ window.addEventListener("resize", calculate);
1449
+ return () => {
1450
+ cancelAnimationFrame(frame);
1451
+ window.removeEventListener("resize", calculate);
1452
+ };
1453
+ }, [calculate, enabled]);
1454
+ const setPerPage = useCallback((size) => {
1455
+ setUserOverride(size);
1456
+ }, []);
1457
+ const perPage = userOverride ?? autoPerPage;
1458
+ return {
1459
+ ref,
1460
+ perPage,
1461
+ setPerPage,
1462
+ autoPerPage,
1463
+ isAutoSized: userOverride === null,
1464
+ isReady: hasCalculated.current
1465
+ };
1466
+ }
1467
+ var Table = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1422
1468
  "table",
1423
1469
  {
1424
1470
  ref,
1425
1471
  className: cn("w-full caption-bottom text-sm", className),
1426
1472
  ...props
1427
1473
  }
1428
- ) }));
1474
+ ));
1429
1475
  Table.displayName = "Table";
1430
1476
  var TableHeader = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
1431
1477
  TableHeader.displayName = "TableHeader";
@@ -1502,7 +1548,7 @@ var DataTableContent = React10.memo(function DataTableContent2({
1502
1548
  highlightOnHover = true,
1503
1549
  onRowClick,
1504
1550
  scrollable = false,
1505
- scrollBottomOffset = 16,
1551
+ scrollBottomOffset = 68,
1506
1552
  className
1507
1553
  }) {
1508
1554
  const table = useDataTable();
@@ -8532,6 +8578,6 @@ var THEME_INFO = {
8532
8578
  }
8533
8579
  };
8534
8580
 
8535
- export { AuthLayout, Avatar, AvatarFallback, AvatarImage, Badge, BigNumberCard, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DENSITY_CONFIG, DashboardLayout, DataTable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogWrapper, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FACTER_THEMES, FloatingBarCompound as FloatingBar, FloatingBarAction, FloatingBarCounter, FloatingBarDivider, FloatingBarIconAction, Form, FormCheckbox, FormDescription, FormError, FormFieldProvider, FormFieldWrapper, FormInput, FormLabel, FormRadioGroup, FormSelect, FormSwitch, FormTextarea, GlobalLoaderController, Input, ItemCard, ItemCardActionButton, ItemCardActions, ItemCardActionsRow, ItemCardBadge, ItemCardContent, ItemCardContentItem, ItemCardEmpty, ItemCardFooter, ItemCardFooterDivider, ItemCardFooterItem, ItemCardHeader, ItemCardIcon, ItemCardRoot, ItemCardSubtitle, ItemCardTitle, ItemCardTitleGroup, Kanban, Loader, LoaderProvider, Logo, MobileNav, MobileNavItem, Navbar, NavbarCompanyProfile, NavbarNotification, NavbarUserMenu, PageHeader, Popover, PopoverContent, PopoverTrigger, RippleBackground, RippleEffect, RippleWrapper, ScrollArea, ScrollBar, SectionHeader, SectionHeaderActions, SectionHeaderBadge, SectionHeaderContent, SectionHeaderIcon, SectionHeaderRoot, SectionHeaderSubtitle, SectionHeaderTitle, Select, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectionLayout, Separator3 as Separator, Sidebar, SimpleTooltip, Skeleton, Sparkline, StatsCard, Switch, THEME_INFO, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Toaster, Tooltip, TooltipAction, TooltipActions, TooltipArrow, TooltipContent, TooltipDescription, TooltipHeader, TooltipIcon, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTitle, TooltipTrigger, Wizard, WizardContent, WizardNavigation, WizardPanel, WizardProgress, WizardProvider, WizardStepConnector, WizardStepIndicator, WizardSteps, cn, itemCardBadgeVariants, itemCardIconVariants, itemCardVariants, loader, toast, useAvailableHeight, useDashboardLayout, useDataTable, useDataTableColumnVisibility, useDataTableDensity, useDataTableEmpty, useDataTableInstance, useDataTableLoading, useDataTableMeta, useDataTablePagination, useDataTableSelection, useDataTableSorting, useDataTableState, useDebounce, useDebouncedCallback, useFormFieldContext, useItemCard, useKanban, useKanbanOptional, useLoader, useMediaQuery2 as useMediaQuery, useSidebar, useSidebarOptional, useTheme, useWizardContext, useWizardContextOptional };
8581
+ export { AuthLayout, Avatar, AvatarFallback, AvatarImage, Badge, BigNumberCard, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DENSITY_CONFIG, DashboardLayout, DataTable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogWrapper, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FACTER_THEMES, FloatingBarCompound as FloatingBar, FloatingBarAction, FloatingBarCounter, FloatingBarDivider, FloatingBarIconAction, Form, FormCheckbox, FormDescription, FormError, FormFieldProvider, FormFieldWrapper, FormInput, FormLabel, FormRadioGroup, FormSelect, FormSwitch, FormTextarea, GlobalLoaderController, Input, ItemCard, ItemCardActionButton, ItemCardActions, ItemCardActionsRow, ItemCardBadge, ItemCardContent, ItemCardContentItem, ItemCardEmpty, ItemCardFooter, ItemCardFooterDivider, ItemCardFooterItem, ItemCardHeader, ItemCardIcon, ItemCardRoot, ItemCardSubtitle, ItemCardTitle, ItemCardTitleGroup, Kanban, Loader, LoaderProvider, Logo, MobileNav, MobileNavItem, Navbar, NavbarCompanyProfile, NavbarNotification, NavbarUserMenu, PageHeader, Popover, PopoverContent, PopoverTrigger, RippleBackground, RippleEffect, RippleWrapper, ScrollArea, ScrollBar, SectionHeader, SectionHeaderActions, SectionHeaderBadge, SectionHeaderContent, SectionHeaderIcon, SectionHeaderRoot, SectionHeaderSubtitle, SectionHeaderTitle, Select, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectionLayout, Separator3 as Separator, Sidebar, SimpleTooltip, Skeleton, Sparkline, StatsCard, Switch, THEME_INFO, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Toaster, Tooltip, TooltipAction, TooltipActions, TooltipArrow, TooltipContent, TooltipDescription, TooltipHeader, TooltipIcon, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTitle, TooltipTrigger, Wizard, WizardContent, WizardNavigation, WizardPanel, WizardProgress, WizardProvider, WizardStepConnector, WizardStepIndicator, WizardSteps, cn, itemCardBadgeVariants, itemCardIconVariants, itemCardVariants, loader, toast, useAutoPageSize, useAvailableHeight, useDashboardLayout, useDataTable, useDataTableColumnVisibility, useDataTableDensity, useDataTableEmpty, useDataTableInstance, useDataTableLoading, useDataTableMeta, useDataTablePagination, useDataTableSelection, useDataTableSorting, useDataTableState, useDebounce, useDebouncedCallback, useFormFieldContext, useItemCard, useKanban, useKanbanOptional, useLoader, useMediaQuery2 as useMediaQuery, useSidebar, useSidebarOptional, useTheme, useWizardContext, useWizardContextOptional };
8536
8582
  //# sourceMappingURL=index.mjs.map
8537
8583
  //# sourceMappingURL=index.mjs.map