"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 */ RadioGroup_stories_rslib_entry_,
    ControlledRadioGroup: ()=>/* binding */ ControlledRadioGroup,
    CustomTemplateGroup: ()=>/* binding */ CustomTemplateGroup,
    DirectionColumn: ()=>/* binding */ DirectionColumn,
    AttachedGroup: ()=>/* binding */ AttachedGroup,
    Default: ()=>/* binding */ Default
});
const react_namespaceObject = require("@chakra-ui/react");
const test_namespaceObject = require("@storybook/test");
const external_RadioGroup_js_namespaceObject = require("./RadioGroup.js");
var external_RadioGroup_js_default = /*#__PURE__*/ __webpack_require__.n(external_RadioGroup_js_namespaceObject);
const external_react_namespaceObject = require("react");
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
const meta = {
    title: 'Components/Inputs/RadioGroup',
    component: external_RadioGroup_js_default(),
    parameters: {
        design: {
            type: 'figma',
            url: 'https://www.figma.com/file/Ah1H7iNSgKNAgtes0av2tM/Cloud-v2-mocks?type=design&node-id=10419-22858&mode=design&t=5nLpKzxeJBMdpXNt-4'
        }
    }
};
/* ESM default export */ const RadioGroup_stories_rslib_entry_ = meta;
const Default = {
    args: {
        name: 'field-name',
        defaultValue: '1',
        options: [
            {
                value: '1',
                label: 'Option 1'
            },
            {
                value: '2',
                label: 'Option 2'
            },
            {
                value: '3',
                label: 'Option 3'
            },
            {
                value: '4',
                label: 'Option 4',
                disabled: true
            },
            {
                value: '5',
                label: 'Option 5',
                invalid: true
            },
            {
                value: '6',
                label: 'Option 6',
                disabled: true,
                invalid: true
            }
        ],
        onChange: (0, test_namespaceObject.fn)()
    },
    play: async ({ canvasElement, step })=>{
        const canvas = (0, test_namespaceObject.within)(canvasElement);
        await step('Check defaults', async ()=>{
            (0, test_namespaceObject.expect)(canvas.getByText('Option 1')).toBeVisible();
            (0, test_namespaceObject.expect)(canvas.getByText('Option 2')).toBeVisible();
            (0, test_namespaceObject.expect)(canvas.getByText('Option 3')).toBeVisible();
            (0, test_namespaceObject.expect)(canvas.getByText('Option 4')).toBeVisible();
            (0, test_namespaceObject.expect)(canvas.getByText('Option 4')).toHaveAttribute('data-disabled');
            (0, test_namespaceObject.expect)(canvas.getByText('Option 5')).toBeVisible();
            (0, test_namespaceObject.expect)(canvas.getByText('Option 5')).toBeValid();
            (0, test_namespaceObject.expect)(canvas.getByText('Option 6')).toBeVisible();
            (0, test_namespaceObject.expect)(canvas.getByText('Option 6')).toHaveAttribute('data-disabled');
            (0, test_namespaceObject.expect)(canvas.getByText('Option 6')).toHaveAttribute('data-invalid'); // Can only be invalid if we also have disabled attribute
        });
        await step('Change option', async ()=>{
            // Default
            (0, test_namespaceObject.expect)(canvas.getByText('Option 1')).toHaveAttribute('data-checked');
            test_namespaceObject.fireEvent.click(canvas.getByText('Option 3'));
            (0, test_namespaceObject.expect)(canvas.getByText('Option 1')).not.toHaveAttribute('data-checked');
            (0, test_namespaceObject.expect)(canvas.getByText('Option 3')).toHaveAttribute('data-checked');
        });
    }
};
const AttachedGroup = {
    args: {
        name: 'field-name',
        isAttached: true,
        options: [
            {
                value: '1',
                label: 'Option 1'
            },
            {
                value: '2',
                label: 'Option 2'
            },
            {
                value: '3',
                label: 'Option 3'
            },
            {
                value: '4',
                label: 'Option 4',
                disabled: true
            },
            {
                value: '5',
                label: 'Option 5',
                invalid: true
            },
            {
                value: '6',
                label: 'Option 6',
                disabled: true,
                invalid: true
            }
        ],
        onChange: (0, test_namespaceObject.fn)()
    }
};
function CustomCardTemplate(props) {
    return /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Box, {
        my: 4
    }, /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.Heading, {
        size: "md"
    }, props.heading), /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.UnorderedList, null, /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.ListItem, null, "Lorem, ipsum dolor sit amet"), /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.ListItem, null, "Lorem, ipsum dolor sit amet"), /*#__PURE__*/ external_react_default().createElement(react_namespaceObject.ListItem, null, "Lorem, ipsum dolor sit amet")));
}
const CustomTemplateGroup = {
    args: {
        name: 'field-name',
        options: [
            {
                value: '1',
                label: /*#__PURE__*/ external_react_default().createElement(CustomCardTemplate, {
                    heading: "Option 1"
                })
            },
            {
                value: '2',
                label: /*#__PURE__*/ external_react_default().createElement(CustomCardTemplate, {
                    heading: "Option 2"
                })
            },
            {
                value: '3',
                label: /*#__PURE__*/ external_react_default().createElement(CustomCardTemplate, {
                    heading: "Option 3"
                })
            },
            {
                value: '4',
                label: /*#__PURE__*/ external_react_default().createElement(CustomCardTemplate, {
                    heading: "Option 4"
                }),
                disabled: true
            },
            {
                value: '5',
                label: /*#__PURE__*/ external_react_default().createElement(CustomCardTemplate, {
                    heading: "Option 5"
                }),
                invalid: true
            },
            {
                value: '6',
                label: /*#__PURE__*/ external_react_default().createElement(CustomCardTemplate, {
                    heading: "Option 6"
                }),
                disabled: true,
                invalid: true
            }
        ]
    }
};
const ControlledRadioGroup = {
    render: ()=>{
        // initial value
        const [value, setValue] = external_react_default().useState('1');
        return /*#__PURE__*/ external_react_default().createElement(external_RadioGroup_js_default(), {
            name: 'field-name',
            onChange: (e)=>{
                console.log('onChange called: ', e);
                if (confirm('Are you sure?')) setValue(e);
            },
            value: value,
            options: [
                {
                    value: '1',
                    label: 'Option 1'
                },
                {
                    value: '2',
                    label: 'Option 2'
                },
                {
                    value: '3',
                    label: 'Option 3'
                },
                {
                    value: '4',
                    label: 'Option 4',
                    disabled: true
                },
                {
                    value: '5',
                    label: 'Option 5',
                    invalid: true
                },
                {
                    value: '6',
                    label: 'Option 6',
                    disabled: true,
                    invalid: true
                }
            ]
        });
    }
};
const DirectionColumn = {
    args: {
        name: 'field-name',
        isAttached: true,
        direction: 'column',
        options: [
            {
                value: '1',
                label: 'Option 1'
            },
            {
                value: '2',
                label: 'Option 2'
            },
            {
                value: '3',
                label: 'Option 3'
            },
            {
                value: '4',
                label: 'Option 4',
                disabled: true
            },
            {
                value: '5',
                label: 'Option 5',
                invalid: true
            },
            {
                value: '6',
                label: 'Option 6',
                disabled: true,
                invalid: true
            }
        ]
    }
};
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
});
