"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyEditorLinkSizeSelection = exports.PropertyEditorLinkTypeSelection = exports.PropertyEditorLinkStyleSelection = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const core_1 = require("@material-ui/core");
const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
const FormDesignConstants_1 = require("../../Form/Utilities/FormDesignConstants");
const Radio_1 = tslib_1.__importDefault(require("@material-ui/core/Radio"));
const RadioGroup_1 = tslib_1.__importDefault(require("@material-ui/core/RadioGroup"));
const FormControlLabel_1 = tslib_1.__importDefault(require("@material-ui/core/FormControlLabel"));
const FormControl_1 = tslib_1.__importDefault(require("@material-ui/core/FormControl"));
const FormLabel_1 = tslib_1.__importDefault(require("@material-ui/core/FormLabel"));
const TextSizeButton = (0, styled_components_1.default)(core_1.Button) `
    && {
        width: 120px;
        height: 46px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        color: #01244E;
        border: 1px solid #E6E9ED

        &:hover {
            background: #F2FAFE;
        }

        &.Mui-disabled {
			background: #F2FAFE;
			color: black;
		}
    }

`;
const PropertyEditorLinkStyleSelection = (props) => {
    const handleChangeStyle = (event) => {
        if (props.parentDefaultValue && props.parentDefaultValue === event.target.value) {
            Reflect.set(props.editObject, props.propertyName, null);
        }
        else {
            Reflect.set(props.editObject, props.propertyName, event.target.value);
        }
        props.updateCallback();
    };
    const value = Reflect.get(props.editObject, props.propertyName) ?? props.parentDefaultValue;
    return ((0, jsx_runtime_1.jsxs)(FormControl_1.default, { component: "fieldset", children: [(0, jsx_runtime_1.jsx)(FormLabel_1.default, { component: "legend", children: "Underline" }), (0, jsx_runtime_1.jsxs)(RadioGroup_1.default, { "aria-label": "underline", name: "underline", value: value, onChange: handleChangeStyle, children: [(0, jsx_runtime_1.jsx)(FormControlLabel_1.default, { value: "none", control: (0, jsx_runtime_1.jsx)(Radio_1.default, {}), label: "None" }), (0, jsx_runtime_1.jsx)(FormControlLabel_1.default, { value: "hover", control: (0, jsx_runtime_1.jsx)(Radio_1.default, {}), label: "Hover" }), (0, jsx_runtime_1.jsx)(FormControlLabel_1.default, { value: "always", control: (0, jsx_runtime_1.jsx)(Radio_1.default, {}), label: "Always" })] })] }));
};
exports.PropertyEditorLinkStyleSelection = PropertyEditorLinkStyleSelection;
const PropertyEditorLinkTypeSelection = (props) => {
    const handleChangeType = (event) => {
        if (props.parentDefaultValue && props.parentDefaultValue === event.target.value) {
            Reflect.set(props.editObject, props.propertyName, null);
        }
        else {
            Reflect.set(props.editObject, props.propertyName, event.target.value);
        }
        props.updateCallback();
    };
    const value = Reflect.get(props.editObject, props.propertyName) ?? props.parentDefaultValue;
    return ((0, jsx_runtime_1.jsxs)(FormControl_1.default, { component: "fieldset", children: [(0, jsx_runtime_1.jsx)(FormLabel_1.default, { component: "legend", children: "Link Type" }), (0, jsx_runtime_1.jsxs)(RadioGroup_1.default, { "aria-label": "linkType", name: "linkType", value: value, onChange: handleChangeType, children: [(0, jsx_runtime_1.jsx)(FormControlLabel_1.default, { value: "action", control: (0, jsx_runtime_1.jsx)(Radio_1.default, {}), label: "Action" }), (0, jsx_runtime_1.jsx)(FormControlLabel_1.default, { value: "url", control: (0, jsx_runtime_1.jsx)(Radio_1.default, {}), label: "Url" })] })] }));
};
exports.PropertyEditorLinkTypeSelection = PropertyEditorLinkTypeSelection;
const PropertyEditorLinkSizeSelection = (props) => {
    function handleChangeSize(newSize) {
        if (props.parentDefaultValue && newSize === props.parentDefaultValue) {
            Reflect.set(props.editObject, props.propertyName, null);
        }
        else {
            Reflect.set(props.editObject, props.propertyName, newSize);
        }
        props.updateCallback();
    }
    const value = Reflect.get(props.editObject, props.propertyName) ?? props.parentDefaultValue;
    return ((0, jsx_runtime_1.jsxs)(FormControl_1.default, { component: "fieldset", children: [(0, jsx_runtime_1.jsx)(FormLabel_1.default, { component: "legend", children: "Size" }), (0, jsx_runtime_1.jsxs)(core_1.ButtonGroup, { size: "large", "aria-label": "large outlined primary button group", style: { height: "49px", width: "240px", marginTop: "10px" }, children: [(0, jsx_runtime_1.jsx)(TextSizeButton, { onClick: () => {
                            handleChangeSize(FormDesignConstants_1.ButtonControlSize.STANDARD);
                        }, style: { textTransform: "lowercase" }, disabled: value === FormDesignConstants_1.ButtonControlSize.STANDARD, children: "Standard" }), (0, jsx_runtime_1.jsx)(TextSizeButton, { onClick: () => {
                            handleChangeSize(FormDesignConstants_1.ButtonControlSize.SMALL);
                        }, style: { textTransform: "lowercase" }, disabled: value === FormDesignConstants_1.ButtonControlSize.SMALL, children: "Small" }), (0, jsx_runtime_1.jsx)(TextSizeButton, { onClick: () => {
                            handleChangeSize(FormDesignConstants_1.ButtonControlSize.LARGE);
                        }, style: { textTransform: "lowercase" }, disabled: value === FormDesignConstants_1.ButtonControlSize.LARGE, children: "Large" })] })] }));
};
exports.PropertyEditorLinkSizeSelection = PropertyEditorLinkSizeSelection;
//# sourceMappingURL=PropertyEditorLinkControl.js.map