"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SampleDialog2 = void 0;

var _react = require("@storybook/react");

var _react2 = _interopRequireWildcard(require("react"));

var _ = require(".");

var _Button = require("../Button");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var __jsx = _react2["default"].createElement;
var stories = (0, _react.storiesOf)('AlertDialog', module);

var SampleDialog = function SampleDialog() {
  var _useState = (0, _react2.useState)(false),
      isOpen = _useState[0],
      setIsOpen = _useState[1];

  var onOpen = function onOpen() {
    return setIsOpen(true);
  };

  var onClose = function onClose() {
    return setIsOpen(false);
  };

  var cancelRef = (0, _react2.useRef)();
  return __jsx(_react2["default"].Fragment, null, __jsx(_Button.Button, {
    onClick: onOpen
  }, "Delete something"), __jsx(_.AlertDialog, {
    isOpen: isOpen,
    leastDestructiveRef: cancelRef,
    onClose: onClose
  }, __jsx(_.AlertDialogOverlay, null), __jsx(_.AlertDialogContent, null, __jsx(_.AlertDialogHeader, null, "Please Confirm!"), __jsx(_.AlertDialogBody, null, "Are you sure you want to delete something? This action is permanent, and we're totally not just flipping a field called \"deleted\" to \"true\" in our database, we're actually deleting something."), __jsx(_.AlertDialogFooter, null, __jsx(_Button.Button, {
    ref: cancelRef,
    onClick: onClose
  }, "Nevermind"), __jsx(_Button.Button, {
    variantColor: "error",
    ml: 3
  }, "Yes, delete")))));
};

stories.add('default', function () {
  return __jsx(SampleDialog, null);
});

var SampleDialog2 = function SampleDialog2() {
  var _useState2 = (0, _react2.useState)(false),
      isOpen = _useState2[0],
      setIsOpen = _useState2[1];

  var onOpen = function onOpen() {
    return setIsOpen(true);
  };

  var onClose = function onClose() {
    return setIsOpen(false);
  };

  var cancelRef = (0, _react2.useRef)();
  return __jsx(_react2["default"].Fragment, null, __jsx(_Button.Button, {
    onClick: onOpen
  }, "Delete something"), __jsx(_.AlertDialog, {
    addAriaLabels: false,
    isOpen: isOpen,
    leastDestructiveRef: cancelRef,
    onClose: onClose
  }, __jsx(_.AlertDialogOverlay, null), __jsx(_.AlertDialogContent, {
    "aria-labelledby": "sample-header",
    "aria-describedby": "sample-body",
    id: "sample"
  }, __jsx(_.AlertDialogHeader, {
    id: "sample-header"
  }, "Please Confirm!"), __jsx(_.AlertDialogBody, {
    id: "sample-body"
  }, "Are you sure you want to delete something? This action is permanent, and we're totally not just flipping a field called \"deleted\" to \"true\" in our database, we're actually deleting something."), __jsx(_.AlertDialogFooter, null, __jsx(_Button.Button, {
    ref: cancelRef,
    onClick: onClose
  }, "Nevermind"), __jsx(_Button.Button, {
    variantColor: "error",
    ml: 3
  }, "Yes, delete")))));
};

exports.SampleDialog2 = SampleDialog2;
stories.add('custom-aria', function () {
  return __jsx(SampleDialog2, null);
});
//# sourceMappingURL=examples.js.map