"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Story6 = exports.Story5 = exports.Story4 = exports.Story3 = exports.Story2 = exports.Story1 = void 0;
const react_1 = __importStar(require("react"));
const MiniButton_1 = require("../MiniButton");
const Input_1 = require("../Input");
const SelectBox_1 = require("../SelectBox");
const index_util_1 = require("./PostfixInput/index.util");
const defaultArgs = {
    label: '레이블',
    placeholder: '플레이스홀더',
    disabled: false,
};
const WidthLimitComp = ({ width = '400px', height, children, }) => {
    return react_1.default.createElement("div", { style: { width, height } }, children);
};
const BaseInputComp = (props) => {
    const [value, setValue] = (0, react_1.useState)('');
    const onChange = (e) => {
        setValue(e.target.value);
    };
    return react_1.default.createElement(Input_1.BaseInput, Object.assign({}, props, { value: value, onChange: onChange }));
};
/**
 * updated 230523
 *
 * <a href="https://www.notion.so/Textfield-fdde7ce93e65439cb8188cfb4a8609aa?pvs=4" target="_blank">노션페이지</a>
 * <br/>
 * 사용자가 입력할 수 있는 영역입니다. 직접 입력하거나 정보 값을 선택하여 입력합니다.<br/>다양한 옵션이 있으며 숫자를 포함한 여러 텍스트 형식을 지원합니다.
 */
const meta = {
    title: 'Component/TextField',
    component: Input_1.BaseInput,
    tags: ['autodocs'],
};
exports.default = meta;
exports.Story1 = {
    render: (props) => (react_1.default.createElement(WidthLimitComp, null,
        react_1.default.createElement(BaseInputComp, Object.assign({}, props)))),
    args: Object.assign(Object.assign({}, defaultArgs), { errorValidation: [
            {
                condition: (value) => {
                    return value[0] === '1';
                },
                errorText: '1로 시작해주세요',
            },
        ] }),
};
exports.Story1.storyName = 'Basic';
exports.Story2 = {
    render: (props) => (react_1.default.createElement(WidthLimitComp, null,
        react_1.default.createElement(BaseInputComp, Object.assign({}, props)))),
    args: {
        label: '레이블',
        placeholder: '플레이스홀더',
        decoration: react_1.default.createElement(MiniButton_1.BoxMiniButton, { colorType: "pink" }, "\uC778\uC99D \uC694\uCCAD"),
        errorValidation: [
            {
                condition: (value) => {
                    return value[0] === '1';
                },
                errorText: '1로 시작해주세요',
            },
        ],
    },
};
exports.Story2.storyName = '+ Button (Decoration)';
const SelectBoxComp = (props) => {
    const [value, setValue] = (0, react_1.useState)('');
    const onChange = (val) => {
        setValue(val);
    };
    return (react_1.default.createElement(react_1.default.Fragment, null,
        "selected: ",
        value,
        react_1.default.createElement("br", null),
        react_1.default.createElement("br", null),
        react_1.default.createElement(SelectBox_1.SelectBox, Object.assign({}, props, { value: value, onChange: onChange }))));
};
exports.Story3 = {
    render: (props) => (react_1.default.createElement(WidthLimitComp, { height: 400 },
        react_1.default.createElement(SelectBoxComp, Object.assign({}, props)))),
    args: Object.assign(Object.assign({}, defaultArgs), { bottomSheetTitle: '모바일 타이틀', itemList: [
            { label: '선택 1', value: 'VALUE_1' },
            { label: '선택 2', value: 'VALUE_2' },
            { label: '선택 3', value: 'VALUE_3' },
            { label: '선택 4', value: 'VALUE_4' },
            { label: '선택 5', value: 'VALUE_5' },
            { label: '선택 6', value: 'VALUE_6' },
            { label: '선택 7', value: 'VALUE_7' },
            { label: '선택 8', value: 'VALUE_8' },
            { label: '선택 9', value: 'VALUE_9' },
            { label: '선택 10', value: 'VALUE_10' },
            { label: '선택 11', value: 'VALUE_11' },
        ] }),
    argTypes: {
        onChange: { action: 'onChange' },
    },
    parameters: {
        docs: {
            description: {
                story: 'PC) 셀렉트 필드를 클릭하면 드랍다운 메뉴가 나타납니다.<br/> MOBILE) 셀렉트 필드를 탭 하면 바텀 시트를 제공합니다.',
            },
        },
    },
};
exports.Story3.storyName = '+ Select';
const ResidentNumberInputComp = (props) => {
    const [value, setValue] = (0, react_1.useState)('');
    const onChange = (val) => {
        setValue(val);
    };
    return react_1.default.createElement(Input_1.ResidentNumberInput, Object.assign({}, props, { value: value, setValue: onChange }));
};
exports.Story4 = {
    render: (props) => (react_1.default.createElement(WidthLimitComp, null,
        react_1.default.createElement(ResidentNumberInputComp, Object.assign({}, props)))),
    args: Object.assign({}, defaultArgs),
    argTypes: {
        onChange: { action: 'onChange' },
    },
};
exports.Story4.storyName = '+ Blind (rrnInputType=13)';
exports.Story5 = {
    render: (props) => (react_1.default.createElement(WidthLimitComp, null,
        react_1.default.createElement(ResidentNumberInputComp, Object.assign({}, props)))),
    args: Object.assign(Object.assign({}, defaultArgs), { rrnInputType: 7 }),
    argTypes: {
        onChange: { action: 'onChange' },
    },
};
exports.Story5.storyName = '+ Blind (rrnInputType=7)';
const PostfixInputComp = (props) => {
    const [value, setValue] = (0, react_1.useState)('');
    const submitValue = Number(value);
    return (react_1.default.createElement(react_1.default.Fragment, null,
        "submitValue : ",
        submitValue,
        react_1.default.createElement(Input_1.PostfixInput, Object.assign({}, props, { realValue: value, updateRealValue: setValue, formatRealValue: index_util_1.formatRealValueWithManWon, formatDisplayValue: index_util_1.formatDisplayValueWithManWon }))));
};
exports.Story6 = {
    render: (props) => (react_1.default.createElement(WidthLimitComp, null,
        react_1.default.createElement(PostfixInputComp, Object.assign({}, props)))),
    args: Object.assign(Object.assign({}, defaultArgs), { postfix: '만원', max: 100000000000 }),
    argTypes: {
        onChange: { action: 'onChange' },
    },
};
exports.Story6.storyName = '+ Unit';
