import { j as jsxRuntimeExports } from '../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
import { ColumnsIcon } from '../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js';
import { Button } from '../button/button.js';
import { Checkbox } from '../checkbox/checkbox.js';
import { DropdownMenu } from '../dropdown-menu/dropdown-menu.js';
import { Flex } from '../flex/flex.js';
import { useTable } from './hooks/useTable.js';

function DataTableViewOptions({ children, ...props }) {
    const { table } = useTable();
    return (jsxRuntimeExports.jsxs(DropdownMenu, { children: [jsxRuntimeExports.jsx(DropdownMenu.Trigger, { asChild: true, children: jsxRuntimeExports.jsx(Button, { variant: "ghost", ...props, children: children || (jsxRuntimeExports.jsxs(Flex, { gap: "small", align: "center", justify: "center", children: [jsxRuntimeExports.jsx(ColumnsIcon, { width: 12, height: "12" }), " View"] })) }) }), jsxRuntimeExports.jsxs(DropdownMenu.Content, { align: "end", className: "w-[150px]", children: [jsxRuntimeExports.jsx(DropdownMenu.Label, { children: "Toggle columns" }), jsxRuntimeExports.jsx(DropdownMenu.Separator, {}), jsxRuntimeExports.jsx(DropdownMenu.Item, { children: jsxRuntimeExports.jsx(Checkbox, { checked: table.getIsAllColumnsVisible(), onCheckedChange: table.getToggleAllColumnsVisibilityHandler(), children: "Toggle All" }) }), table
                        .getAllColumns()
                        .filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide())
                        .map((column) => {
                        return (jsxRuntimeExports.jsx(DropdownMenu.Item, { children: jsxRuntimeExports.jsx(Checkbox, { checked: column.getIsVisible(), onCheckedChange: (value) => column.toggleVisibility(!!value), children: column.id }, column.id) }, column.id));
                    })] })] }));
}

export { DataTableViewOptions };
//# sourceMappingURL=DataTableViewOptions.js.map
