@facter/ds-core 1.19.0 → 1.21.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.mts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +59 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
|
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(
|
|
643
|
-
/* @__PURE__ */ jsx(SelectPrimitive.
|
|
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,6 +1418,52 @@ function useAvailableHeight(options = {}) {
|
|
|
1418
1418
|
style: height ? { maxHeight: `${height}px` } : void 0
|
|
1419
1419
|
};
|
|
1420
1420
|
}
|
|
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
|
+
}
|
|
1421
1467
|
var Table = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
|
|
1422
1468
|
"table",
|
|
1423
1469
|
{
|
|
@@ -1502,7 +1548,7 @@ var DataTableContent = React10.memo(function DataTableContent2({
|
|
|
1502
1548
|
highlightOnHover = true,
|
|
1503
1549
|
onRowClick,
|
|
1504
1550
|
scrollable = false,
|
|
1505
|
-
scrollBottomOffset =
|
|
1551
|
+
scrollBottomOffset = 68,
|
|
1506
1552
|
className
|
|
1507
1553
|
}) {
|
|
1508
1554
|
const table = useDataTable();
|
|
@@ -1681,14 +1727,14 @@ var DataTableFilter = React10.memo(function DataTableFilter2({
|
|
|
1681
1727
|
const filterValue = column?.getFilterValue() ?? [];
|
|
1682
1728
|
const [localValue, setLocalValue] = React10.useState("all");
|
|
1683
1729
|
const currentValue = column ? filterValue.length > 0 ? filterValue[0] : "all" : localValue;
|
|
1730
|
+
const isServerSide = !!onServerValueChange;
|
|
1684
1731
|
const handleValueChange = React10.useCallback(
|
|
1685
1732
|
(value) => {
|
|
1686
1733
|
const resolvedValue = value === "all" ? void 0 : value;
|
|
1687
|
-
if (
|
|
1688
|
-
column.setFilterValue(resolvedValue ? [resolvedValue] : void 0);
|
|
1689
|
-
}
|
|
1690
|
-
if (onServerValueChange) {
|
|
1734
|
+
if (isServerSide) {
|
|
1691
1735
|
onServerValueChange(resolvedValue);
|
|
1736
|
+
} else if (column) {
|
|
1737
|
+
column.setFilterValue(resolvedValue ? [resolvedValue] : void 0);
|
|
1692
1738
|
}
|
|
1693
1739
|
setLocalValue(value);
|
|
1694
1740
|
},
|
|
@@ -1704,7 +1750,10 @@ var DataTableFilter = React10.memo(function DataTableFilter2({
|
|
|
1704
1750
|
className,
|
|
1705
1751
|
children: [
|
|
1706
1752
|
/* @__PURE__ */ jsx(SelectItem, { value: "all", children: "Todos" }),
|
|
1707
|
-
options.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children:
|
|
1753
|
+
options.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
1754
|
+
option.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-muted-foreground", children: option.icon }),
|
|
1755
|
+
option.label
|
|
1756
|
+
] }) }, option.value))
|
|
1708
1757
|
]
|
|
1709
1758
|
}
|
|
1710
1759
|
);
|
|
@@ -8529,6 +8578,6 @@ var THEME_INFO = {
|
|
|
8529
8578
|
}
|
|
8530
8579
|
};
|
|
8531
8580
|
|
|
8532
|
-
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 };
|
|
8533
8582
|
//# sourceMappingURL=index.mjs.map
|
|
8534
8583
|
//# sourceMappingURL=index.mjs.map
|