"use strict";
// The require scope
var __webpack_require__ = {};
/************************************************************************/ // webpack/runtime/compat_get_default_export
(()=>{
    // getDefaultExport function for compatibility with non-ESM modules
    __webpack_require__.n = function(module) {
        var getter = module && module.__esModule ? function() {
            return module['default'];
        } : function() {
            return module;
        };
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
// webpack/runtime/define_property_getters
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
// webpack/runtime/has_own_property
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
// webpack/runtime/make_namespace_object
(()=>{
    // define __esModule on exports
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
/************************************************************************/ var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
    Default: ()=>/* binding */ Default,
    ColumnFilters: ()=>/* binding */ ColumnFilters,
    NestedObjectAsData: ()=>/* binding */ NestedObjectAsData,
    default: ()=>/* binding */ DataTable_stories_rslib_entry_,
    Expanded: ()=>/* binding */ Expanded,
    EmptyTableWithButtonAction: ()=>/* binding */ EmptyTableWithButtonAction,
    LoadingTable: ()=>/* binding */ LoadingTable,
    Pagination: ()=>/* binding */ Pagination,
    ColumnResizing: ()=>/* binding */ ColumnResizing,
    EmptyTableWithLinkAction: ()=>/* binding */ EmptyTableWithLinkAction,
    JsxHeaders: ()=>/* binding */ JsxHeaders
});
const external_DataTable_js_namespaceObject = require("./DataTable.js");
var external_DataTable_js_default = /*#__PURE__*/ __webpack_require__.n(external_DataTable_js_namespaceObject);
const md_namespaceObject = require("react-icons/md");
const react_namespaceObject = require("@chakra-ui/react");
const external_react_namespaceObject = require("react");
const Button_js_namespaceObject = require("../Button/Button.js");
var Button_js_default = /*#__PURE__*/ __webpack_require__.n(Button_js_namespaceObject);
const addon_actions_namespaceObject = require("@storybook/addon-actions");
const meta = {
    title: 'Components/DataTable',
    component: external_DataTable_js_default(),
    argTypes: {
        showColumnSelector: {
            control: 'boolean'
        },
        size: {
            control: 'radio',
            options: [
                'sm',
                'md'
            ]
        }
    },
    parameters: {
        design: {
            type: 'figma',
            url: 'https://www.figma.com/file/bJcVrZNilxa06jYuVCGWYd/Redpanda-Design-System-2023?type=design&node-id=36-1193&mode=design'
        }
    }
};
/* ESM default export */ const DataTable_stories_rslib_entry_ = meta;
const mockColumns = [
    {
        header: 'Name',
        accessorKey: 'name'
    },
    {
        header: 'Number',
        accessorKey: 'number'
    },
    {
        header: 'Multiply',
        accessorKey: 'factor',
        size: 1 / 0
    }
];
const mockNestedColumns = [
    {
        header: 'Name',
        accessorKey: 'name'
    },
    {
        header: 'Nested',
        accessorKey: 'someOtherProperty'
    }
];
const mockData = Array(100).fill(0).map((_, i)=>({
        name: `Row ${i}`,
        number: `${10 * i}`,
        factor: 25.4 * i
    }));
const nestedMockData = Array(10).fill(0).map((_, i)=>({
        name: `Row ${i}`,
        nestedProperty: {
            someOtherProperty: `${20 * i}`
        }
    }));
const Default = {
    args: {
        columns: mockColumns,
        data: mockData
    }
};
const LoadingTable = {
    args: {
        columns: mockColumns,
        isLoading: true
    }
};
const EmptyTableWithButtonAction = {
    args: {
        columns: mockColumns,
        data: [],
        emptyAction: /*#__PURE__*/ React.createElement(Button_js_default(), {
            onClick: (0, addon_actions_namespaceObject.action)('onEmptyActionClick')
        }, "Create Item")
    }
};
const EmptyTableWithLinkAction = {
    args: {
        columns: mockColumns,
        data: [],
        emptyAction: /*#__PURE__*/ React.createElement(Button_js_default(), {
            as: "a",
            href: "#"
        }, "Navigate Away")
    }
};
const JsxHeaders = {
    args: {
        columns: [
            {
                header: ()=>/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(react_namespaceObject.Icon, {
                        as: md_namespaceObject.MdPersonOutline
                    }), " Name"),
                accessorKey: 'name'
            },
            {
                header: ()=>/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(react_namespaceObject.Icon, {
                        as: md_namespaceObject.MdFavoriteBorder
                    }), " Number"),
                accessorKey: 'number'
            },
            {
                header: ()=>/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(react_namespaceObject.Icon, {
                        as: md_namespaceObject.MdPayment
                    }), " Multiply"),
                accessorKey: 'factor'
            }
        ],
        data: mockData.slice(0, 3)
    }
};
const Pagination = {
    render: function() {
        const [pagination, onPaginationChange] = (0, external_react_namespaceObject.useState)({
            pageIndex: 0,
            pageSize: 10
        });
        return /*#__PURE__*/ React.createElement(external_DataTable_js_default(), {
            columns: mockColumns,
            data: mockData,
            sorting: true,
            pagination: pagination,
            onPaginationChange: onPaginationChange
        });
    }
};
const ColumnFilters = {
    args: {
        // Enable filters
        enableColumnFilters: true,
        columns: [
            ...mockColumns,
            {
                header: 'Number',
                accessorKey: 'number',
                // Disable filter for a column
                enableColumnFilter: false
            }
        ],
        data: mockData.slice(0, 3)
    }
};
const ColumnResizing = {
    args: {
        enableColumnResizing: true,
        columns: mockColumns,
        data: mockData.slice(0, 3)
    }
};
const NestedObjectAsData = {
    args: {
        enableColumnResizing: true,
        columns: mockNestedColumns,
        data: nestedMockData
    }
};
const Expanded = {
    args: {
        columns: mockColumns,
        data: mockData.slice(0, 10),
        subComponent: (data)=>/*#__PURE__*/ React.createElement(react_namespaceObject.Box, {
                as: "pre",
                bg: "gray.50"
            }, /*#__PURE__*/ React.createElement("code", null, JSON.stringify(data, null, ' ')))
    }
};
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
