function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

import React from "react";
import { storiesOf } from "@storybook/react";
import { withKnobs, boolean as _boolean, text } from "@storybook/addon-knobs";
import { action } from "@storybook/addon-actions";
import Token from "../Token";
import Container from "./Container";
import Row from "./Row";
import Col from "./Col";
import ColWithNubbin from "./ColWithNubbin";
import NavBar from "../NavBar";
import Attention from "../Attention";
import Spinner from "../Spinner";
var openLogoUrl = "https://app.optimizely.com/dist/static/img/rebrand/logo-f64d2aed989db744b609666199d7d2a2.svg";

var ConfigPanelExample =
/*#__PURE__*/
function (_React$Component) {
  _inherits(ConfigPanelExample, _React$Component);

  function ConfigPanelExample(props) {
    var _this;

    _classCallCheck(this, ConfigPanelExample);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(ConfigPanelExample).call(this, props)); // 1) Create the reference here.

    _this.pointingRef = React.createRef();
    _this.state = {
      nubbinPointingRef: null
    };
    return _this;
  }

  _createClass(ConfigPanelExample, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      // 2) Use the ref to store the node in state
      this.setState({
        nubbinPointingRef: this.pointingRef.current
      });
    }
  }, {
    key: "render",
    value: function render() {
      return React.createElement("div", {
        style: {
          height: "500px",
          width: "100%"
        }
      }, React.createElement(Container, {
        fluid: true,
        isFullHeight: true
      }, React.createElement(Row, null, React.createElement(Col, {
        small: 6
      }, React.createElement("div", {
        className: "height--1-1 soft-double"
      }, React.createElement("h3", null, "Rules"), React.createElement("p", null, "Explanatory content here"), React.createElement("div", {
        style: {
          height: "100px"
        }
      }), React.createElement("div", {
        className: " flex flex--column border--all" // 3) Assign ref to element you want nubbin pointing to
        ,
        ref: this.pointingRef
      }, "The nubbin should point in the middle of this area", React.createElement(Token, {
        isDraggable: true,
        name: "This is option 1 for reordering",
        order: 1,
        showWell: false
      }), React.createElement(Token, {
        isDraggable: true,
        name: "This is option 2 for reordering",
        order: 2,
        showWell: false
      }), React.createElement(Token, {
        isDraggable: true,
        name: "This is option 3 for reordering",
        order: 3,
        showWell: false
      })))), React.createElement(ColWithNubbin, {
        small: 6 // 4) Pass ref to ColWithNubbin
        ,
        nubbinRef: this.state.nubbinPointingRef
      }, React.createElement("h3", null, "Rule Configuration")))));
    }
  }]);

  return ConfigPanelExample;
}(React.Component);

var storiesForTemplates = storiesOf("Templates (deprecated)", module);
storiesForTemplates.addDecorator(withKnobs).addDecorator(function (story) {
  return React.createElement("div", {
    id: "root-preview"
  }, story());
});
storiesForTemplates.add("Config Panel", function () {
  return React.createElement(React.Fragment, null, React.createElement("div", {
    className: "push-double--bottom"
  }, React.createElement(Attention, {
    type: "brand"
  }, "Use a ref passed to ColWithNubbin to place the nubbin properly")), React.createElement(ConfigPanelExample, null));
}).add("Entire App Frame", function () {
  return React.createElement(Container, {
    outlineDebug: _boolean("outlineDebug", true),
    pushRowsTop: _boolean("pushRowsTop", true),
    paddedContent: text("paddedContent", "none"),
    fluid: _boolean("fluid", true)
  }, React.createElement(Row, {
    removeGutters: _boolean("gutters", false),
    shouldWrap: false
  }, React.createElement(Col, {
    small: "fitContent"
  }, React.createElement(NavBar, {
    isOpen: true,
    logoUrl: openLogoUrl,
    title: "Test Project",
    badgeText: "WEB",
    badgeColor: "draft",
    homeUrl: "http://optimizely.com",
    trialContent: React.createElement("div", {
      className: "push-double--bottom push-double--left truncate"
    }, _boolean("isOpen", true) && "5 days left in your trial")
  }, React.createElement(NavBar.PrimaryLink, {
    iconName: "projects",
    type: "pushstate",
    linkLabel: "Projects",
    testSection: "projects"
  }), React.createElement(NavBar.PrimaryLink, {
    iconName: "experiment",
    type: "link",
    linkLabel: "Experiment",
    testSection: "experiment",
    isActive: true
  }), React.createElement(NavBar.PrimaryLink, {
    iconName: "rollouts",
    type: "link",
    linkLabel: "Features",
    testSection: "features"
  }), React.createElement(NavBar.PrimaryLink, {
    iconName: "audiences",
    type: "link",
    linkLabel: "Audiences",
    testSection: "audiences"
  }), React.createElement(NavBar.PrimaryLink, {
    iconName: "events",
    type: "button",
    linkLabel: "Events",
    testSection: "events"
  }), React.createElement(NavBar.PrimaryLink, {
    iconName: "settings",
    type: "link",
    linkLabel: "Settings",
    testSection: "settings"
  }), React.createElement(NavBar.PrimaryLink, {
    iconName: "getting-started",
    type: "pushstate",
    linkLabel: "Getting Started",
    testSection: "getting-started",
    hasSeparator: true
  }), React.createElement(NavBar.SecondaryLink, {
    iconName: "program-management",
    type: "button",
    linkLabel: "Program Management",
    testSection: "program-management"
  }), React.createElement(NavBar.SecondaryLink, {
    iconName: "help",
    type: "link",
    linkLabel: "Help",
    testSection: "help"
  }), React.createElement(NavBar.SecondaryLink, {
    iconName: "feedback",
    type: "link",
    linkLabel: "Feedback",
    testSection: "feedback"
  }), React.createElement(NavBar.CurrentUserMenu, {
    showEmulate: _boolean("showEmulate", true),
    onEmulateClick: action("onEmulateClick"),
    accountSwitcherItems: [{
      text: "Account 1",
      url: "#",
      description: "Account 1 Description",
      isCurrent: false
    }, {
      text: "Account 3",
      url: "#",
      description: "Account 3 Description",
      isCurrent: false
    }, {
      text: "Account 2",
      url: "#",
      description: "Account 2 Description",
      isCurrent: true
    }],
    accountSwitcherHandler: action("accountSwitcherHandler"),
    userName: "Hassan Khalid",
    accountSettingsUrl: "#",
    profileUrl: "#",
    logoutUrl: "#",
    profileAvatarUrl: text("profileAvatarUrl", "https://optimizely-profile-images-devel.s3.amazonaws.com/img/user/hassan.khalid%40optimizely.com/c57517e7ee4941d0a5e71f3d89df0c0d.jpg")
  }))), React.createElement(Col, {
    small: "fitContent"
  }, React.createElement("div", {
    style: {
      width: "285px"
    }
  }, "Tabs/Header")), React.createElement(Col, {
    small: "fillSpace",
    isReadingColumn: true
  }, React.createElement("div", null, "Stage (using isReadingColumn on the Col)"))));
}).add("Spinner", function () {
  return React.createElement("div", {
    style: {
      height: "550px"
    }
  }, React.createElement(Container, {
    isFullHeight: true,
    outlineDebug: _boolean("outlineDebug", true)
  }, React.createElement(Row, {
    verticalAlignment: "center"
  }, React.createElement(Col, null, React.createElement(Spinner, {
    hasOverlay: true
  })))));
});