import { __assign, __read, __spreadArray } from "tslib";
import React from 'react';
import { action } from '@storybook/addon-actions';
import { select } from '@storybook/addon-knobs';
export var createStory = function (Component, params) {
    if (params === void 0) { params = {}; }
    var wrapper = function () { return React.createElement(Component, null); };
    wrapper.story = __assign({}, params);
    return wrapper;
};
export var createMetadata = function (params) { return params; };
export var getStoryIds = function (obj) { return Object.keys(obj); };
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export var callbackWithSelector = function (_a, fn) {
    var name = _a.name, _b = _a.isActive, isActive = _b === void 0 ? false : _b;
    var defaultOptions = ['undefined', '() => void'];
    var options = isActive ? defaultOptions.reverse() : defaultOptions;
    if (select(name, options, options[0]) === 'undefined') {
        return undefined;
    }
    return function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        action(name).apply(void 0, __spreadArray([], __read(args), false));
        if (fn) {
            return fn.apply(void 0, __spreadArray([], __read(args), false));
        }
    };
};
