function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React, { useState } from 'react';
import { action } from '@storybook/addon-actions';
import styled from 'styled-components';
import { Tabs, Typography } from '../..';
import docs from './Tabs.mdx';
var SpacingInside = styled.div.withConfig({
  displayName: "Tabsstories__SpacingInside",
  componentId: "sc-1496d70-0"
})(["padding-left:", "px;padding-right:", "px;padding-top:", "px;"], function (p) {
  return p.theme.spacing.unit(5);
}, function (p) {
  return p.theme.spacing.unit(5);
}, function (p) {
  return p.theme.spacing.unit(4);
});
var StyledTabs = styled(Tabs).withConfig({
  displayName: "Tabsstories__StyledTabs",
  componentId: "sc-1496d70-1"
})(["padding:0 ", "px;"], function (p) {
  return p.theme.spacing.unit(5);
});
export default {
  title: 'Molecules / Tabs',
  parameters: {
    docs: {
      page: docs
    }
  }
};
export var Default = {
  render: function render() {
    return React.createElement(Typography, {
      type: "secondary"
    }, React.createElement(Tabs, null, React.createElement(Tabs.Tab, {
      title: "One",
      onTitleClick: action('Clicked title1')
    }, "Ones children"), React.createElement(Tabs.Tab, {
      title: React.createElement("div", null, "Node as well", React.createElement("span", {
        role: "img",
        "aria-label": "goodjob"
      }, "\uD83D\uDC4D")),
      onTitleClick: action('Clicked title2')
    }, "Moving focus from a tab will put it on the next ", React.createElement("a", {
      href: "#link"
    }, "focusable"), " Tab in the tab panel.")));
  }
};
export var LargeVariant = {
  render: function render() {
    return React.createElement(Typography, {
      type: "secondary"
    }, React.createElement(Tabs, {
      variant: "large",
      height: 8
    }, React.createElement(Tabs.Tab, {
      title: "One",
      onTitleClick: action('Clicked title1')
    }, "Ones children"), React.createElement(Tabs.Tab, {
      title: React.createElement("div", null, "Node as well", React.createElement("span", {
        role: "img",
        "aria-label": "goodjob"
      }, "\uD83D\uDC4D")),
      onTitleClick: action('Clicked title2')
    }, "Moving focus from a tab will put it on the next ", React.createElement("a", {
      href: "#link"
    }, "focusable"), " Tab in the tab panel.")));
  }
};
var StyledTabsContent = styled(Tabs).withConfig({
  displayName: "Tabsstories__StyledTabsContent",
  componentId: "sc-1496d70-2"
})(["& ~ ", "{height:inherit;background:", ";}"], Tabs.components.TabContent, function (_ref) {
  var theme = _ref.theme;
  return theme.color.sliderBackgroundColor;
});
export var WithStyledTabContent = {
  render: function render() {
    return React.createElement(Typography, {
      type: "secondary"
    }, React.createElement(StyledTabsContent, null, React.createElement(Tabs.Tab, {
      title: "One",
      onTitleClick: action('Clicked title1')
    }, "Tab 1. Content have gray background"), React.createElement(Tabs.Tab, {
      title: "Two",
      onTitleClick: action('Clicked title2')
    }, "Tab 2. Content have gray background")));
  }
};
export var WithCustomStylingLikeSpacing = {
  render: function render() {
    return React.createElement(Typography, {
      type: "secondary"
    }, React.createElement(StyledTabs, null, React.createElement(Tabs.Tab, {
      title: "One",
      onTitleClick: action('Clicked title1')
    }, React.createElement(SpacingInside, null, "Ones children")), React.createElement(Tabs.Tab, {
      title: "two",
      onTitleClick: action('Clicked title2')
    }, React.createElement(SpacingInside, null, "Twos children"))));
  },
  name: 'With custom styling (like spacing)'
};
export var WithHeightModified = {
  render: function render() {
    return React.createElement(Typography, {
      type: "secondary"
    }, React.createElement(Tabs, {
      height: 11
    }, React.createElement(Tabs.Tab, {
      title: "One",
      onTitleClick: action('Clicked title1')
    }, "Ones children"), React.createElement(Tabs.Tab, {
      title: "two",
      onTitleClick: action('Clicked title2')
    }, "Twos children")));
  }
};
export var ControlledBehaviour = {
  render: function render() {
    var ControlledExample = function ControlledExample() {
      var _useState = useState(0),
        _useState2 = _slicedToArray(_useState, 2),
        active = _useState2[0],
        setActive = _useState2[1];
      return React.createElement(Typography, {
        type: "secondary"
      }, React.createElement("button", {
        type: "button",
        onClick: function onClick() {
          return setActive(active === 0 ? 1 : 0);
        }
      }, "Change state outside"), React.createElement(Tabs, {
        activeTabIndex: active
      }, React.createElement(Tabs.Tab, {
        title: "One",
        onTitleClick: function onTitleClick() {
          return setActive(0);
        }
      }, "Ones children"), React.createElement(Tabs.Tab, {
        title: "Two",
        onTitleClick: function onTitleClick() {
          return setActive(1);
        }
      }, "Twos children")));
    };
    return React.createElement(ControlledExample, null);
  }
};
export var WithConditionallyHiddenTab = {
  render: function render() {
    var showFirstTab = false;
    return React.createElement(Typography, {
      type: "secondary"
    }, React.createElement(StyledTabs, null, showFirstTab && React.createElement(Tabs.Tab, {
      title: "One",
      onTitleClick: action('Clicked title1')
    }, React.createElement(SpacingInside, null, "Ones children")), React.createElement(Tabs.Tab, {
      title: "two",
      onTitleClick: action('Clicked title2')
    }, React.createElement(SpacingInside, null, "Twos children"))));
  }
};
export var WithHorizontalScroll = {
  render: function render() {
    return React.createElement(Typography, {
      type: "secondary"
    }, React.createElement(Tabs, {
      scrollOptions: {
        active: true,
        scrollBarHidden: true
      }
    }, React.createElement(Tabs.Tab, {
      title: "Tab One",
      onTitleClick: action('Clicked title1')
    }, React.createElement(SpacingInside, null, "Ones children")), React.createElement(Tabs.Tab, {
      title: "Tab Two",
      onTitleClick: action('Clicked title2')
    }, React.createElement(SpacingInside, null, "Twos children")), React.createElement(Tabs.Tab, {
      title: "Tab Three",
      onTitleClick: action('Clicked title3')
    }, React.createElement(SpacingInside, null, "Threes children")), React.createElement(Tabs.Tab, {
      title: "Tab Four",
      onTitleClick: action('Clicked title4')
    }, React.createElement(SpacingInside, null, "Fours children")), React.createElement(Tabs.Tab, {
      title: "Tab Five",
      onTitleClick: action('Clicked title5')
    }, React.createElement(SpacingInside, null, "Fives children")), React.createElement(Tabs.Tab, {
      title: "Tab Six",
      onTitleClick: action('Clicked title6')
    }, React.createElement(SpacingInside, null, "Sixs children"))));
  }
};