import { text, boolean, number, object, select, array } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';

export default {
  labelText: function labelText() {
    return text('labelText', 'Family Leave');
  },
  id: function id() {
    return text('id', 'text-input');
  },
  disabled: function disabled() {
    return boolean('disabled', false);
  },
  required: function required() {
    return boolean('required', true);
  },
  defaultValue: function defaultValue() {
    return text('defaultValue', '0');
  },
  axis: function axis() {
    return select('axis', ['x', 'y'], 'x');
  },
  max: function max() {
    return number('max', 1);
  },
  min: function min() {
    return number('min', 0);
  },
  step: function step() {
    return number('step', 0.01);
  },
  ticks: function ticks() {
    return object('ticks', { 0: '0%', 0.6: 'Minimum requirement', 1: '100%' });
  },
  // Array knob converts numbers to strings - put it back to number.
  domain: function domain() {
    return array('domain', [0, 1]).map(function (num) {
      return Number(num);
    });
  },
  onChange: function onChange() {
    return action('inputSlider.onChange');
  },
  onUpdate: function onUpdate() {
    return action('inputSlider.onUpdate');
  },
  skipped: function skipped() {
    return boolean('skipped', false);
  },
  displayValueFormat: function displayValueFormat() {
    return select('displayValueFormat', ['percentage', 'value', null], 'percentage');
  }
};