'use strict';

var jsxRuntime = require('../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
var reactIcons_esm = require('../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs');
var button = require('../button/button.cjs');
var checkbox = require('../checkbox/checkbox.cjs');
var dropdownMenu = require('../dropdown-menu/dropdown-menu.cjs');
var flex = require('../flex/flex.cjs');
var useTable = require('./hooks/useTable.cjs');

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

exports.DataTableViewOptions = DataTableViewOptions;
//# sourceMappingURL=DataTableViewOptions.cjs.map
