"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__, {
    AsAccordion: ()=>/* binding */ AsAccordion,
    default: ()=>/* binding */ ResourceList_stories_rslib_entry_,
    NoColumns: ()=>/* binding */ NoColumns,
    SelfAligned: ()=>/* binding */ SelfAligned,
    AsAccordionWithColumns: ()=>/* binding */ AsAccordionWithColumns,
    Empty: ()=>/* binding */ Empty,
    Default: ()=>/* binding */ Default
});
const test_namespaceObject = require("@storybook/test");
const external_ResourceList_js_namespaceObject = require("./ResourceList.js");
var external_ResourceList_js_default = /*#__PURE__*/ __webpack_require__.n(external_ResourceList_js_namespaceObject);
const react_namespaceObject = require("@chakra-ui/react");
const lorem = `
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
  labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
  laboris nisi ut aliquip ex ea commodo consequat.
`;
const LoremIpsum = ({ iterations = 1, ...rest })=>{
    const texts = [];
    for(let i = 0; i < iterations; i++)texts.push(/*#__PURE__*/ React.createElement(react_namespaceObject.Text, rest, lorem));
    return /*#__PURE__*/ React.createElement(React.Fragment, null, texts);
};
/* ESM default export */ const content_helper = LoremIpsum;
const meta = {
    title: 'Components/ResourceList',
    component: external_ResourceList_js_default(),
    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 ResourceList_stories_rslib_entry_ = meta;
const columns = [
    {
        key: 'title',
        content: 'Title',
        width: '2fr'
    },
    {
        key: 'subtitle',
        content: 'Subtitle'
    }
];
const rows = [
    {
        key: 'row1',
        id: 'r1',
        title: 'title-1',
        subtitle: 'subtitle-1',
        link: '/row1-link'
    },
    {
        key: 'row2',
        id: 'r2',
        title: 'title-2',
        subtitle: 'subtitle-2'
    },
    {
        key: 'row3',
        id: 'r3',
        title: 'title-3',
        subtitle: 'subtitle-3'
    },
    {
        key: 'row4',
        id: 'r4',
        title: 'title-4',
        subtitle: 'subtitle-4',
        onClick: ()=>{
            alert('clicked the row');
        }
    },
    {
        key: '',
        id: 'r5',
        title: 'title-5 (empty key)',
        subtitle: 'subtitle-5'
    }
];
const Default = {
    args: {
        columns,
        rows
    },
    play: async ({ canvasElement, step })=>{
        const canvas = (0, test_namespaceObject.within)(canvasElement);
        await step('Check resource list headings', async ()=>{
            (0, test_namespaceObject.expect)(canvas.getByTestId('resource-list-column-Title')).toBeVisible();
            (0, test_namespaceObject.expect)(canvas.getByTestId('resource-list-column-Subtitle')).toBeVisible();
        });
        await step('Check elements', async ()=>{
            (0, test_namespaceObject.expect)(canvas.getByTestId('row1-link')).toBeVisible();
        });
    }
};
const SelfAligned = {
    args: {
        columns,
        rows,
        alignSelf: 'center'
    }
};
const Empty = {
    args: {
        columns,
        rows: []
    },
    play: async ({ canvasElement, step })=>{
        const canvas = (0, test_namespaceObject.within)(canvasElement);
        await step('Check empty state appears', async ()=>{
            (0, test_namespaceObject.expect)(canvas.getByTestId('no-data-heading')).toBeVisible();
            (0, test_namespaceObject.expect)(canvas.getByTestId('no-data-heading')).toHaveTextContent('No data found');
            (0, test_namespaceObject.expect)(canvas.getByTestId('no-data-image')).toBeVisible();
        });
    }
};
const NoColumns = {
    args: {
        columns,
        rows,
        showColumns: false
    },
    play: async ({ canvasElement, step })=>{
        const canvas = (0, test_namespaceObject.within)(canvasElement);
        await step('Check no columns appear', async ()=>{
            (0, test_namespaceObject.expect)(canvas.queryByTestId('resource-list-column-Title')).not.toBeInTheDocument();
            (0, test_namespaceObject.expect)(canvas.queryByTestId('resource-list-column-Subtitle')).not.toBeInTheDocument();
        });
    }
};
const AsAccordionWithColumns = {
    args: {
        columns,
        rows: [
            {
                key: 'row1',
                id: 'r1',
                title: 'title-1',
                subtitle: 'subtitle-1',
                content: /*#__PURE__*/ React.createElement(content_helper, null)
            }
        ],
        showColumns: true,
        isExpandable: true
    },
    play: async ({ canvasElement, step })=>{
        const canvas = (0, test_namespaceObject.within)(canvasElement);
        await step('Check content chevron icon', async ()=>{
            (0, test_namespaceObject.expect)(canvas.getByTestId('content-chevron-icon')).toBeVisible();
        });
        test_namespaceObject.fireEvent.click(canvas.getByTestId('content-chevron-icon'));
        await step('Check content appears', async ()=>{
            await (0, test_namespaceObject.waitFor)(()=>(0, test_namespaceObject.expect)(canvas.getByTestId('content-wrapper')).toBeVisible());
        });
        test_namespaceObject.fireEvent.click(canvas.getByTestId('content-chevron-icon'));
        await step('Check content hides', async ()=>{
            await (0, test_namespaceObject.waitFor)(()=>(0, test_namespaceObject.expect)(canvas.queryByTestId('content-wrapper')).not.toBeVisible());
        });
    }
};
const AsAccordion = {
    args: {
        columns,
        rows: [
            {
                key: 'row1',
                id: 'r1',
                title: 'title-1',
                subtitle: 'subtitle-1',
                content: /*#__PURE__*/ React.createElement(content_helper, null)
            },
            {
                key: 'row2',
                id: 'r2',
                title: 'title-2',
                subtitle: 'subtitle-2',
                content: /*#__PURE__*/ React.createElement(content_helper, null)
            }
        ],
        showColumns: false,
        isExpandable: true
    },
    parameters: {
        design: {
            type: 'figma',
            url: 'https://www.figma.com/file/gVsqDS0XOFARD6d1513YXy/GCP-Marketplace-integration---Self-serve?type=design&node-id=742-1313&mode=design&t=lJys5w00P9NKNsRs-4'
        }
    }
};
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
});
