@salesforce/design-system-react
Version:
Salesforce Lightning Design System for React
130 lines (102 loc) • 6.24 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
var _iconSettings = require("../../../../components/icon-settings");
var _iconSettings2 = _interopRequireDefault(_iconSettings);
var _notification = require("../../../../components/notification");
var _notification2 = _interopRequireDefault(_notification);
var _modal = require("../../../../components/modal");
var _modal2 = _interopRequireDefault(_modal);
var _button = require("../../../../components/button");
var _button2 = _interopRequireDefault(_button);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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 _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, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var Example =
/*#__PURE__*/
function (_React$Component) {
_inherits(Example, _React$Component);
function Example() {
var _ref;
var _temp, _this;
_classCallCheck(this, Example);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _possibleConstructorReturn(_this, (_temp = _this = _possibleConstructorReturn(this, (_ref = Example.__proto__ || Object.getPrototypeOf(Example)).call.apply(_ref, [this].concat(args))), Object.defineProperty(_assertThisInitialized(_this), "state", {
configurable: true,
enumerable: true,
writable: true,
value: {
isOpen: false,
modalOpen: false,
toastOpen: true
}
}), Object.defineProperty(_assertThisInitialized(_this), "toggleModal", {
configurable: true,
enumerable: true,
writable: true,
value: function value() {
_this.setState({
modalOpen: !_this.state.modalOpen
});
}
}), Object.defineProperty(_assertThisInitialized(_this), "toggleToast", {
configurable: true,
enumerable: true,
writable: true,
value: function value() {
_this.setState({
toastOpen: !_this.state.toastOpen
});
}
}), _temp));
}
_createClass(Example, [{
key: "render",
value: function render() {
return _react2.default.createElement(_iconSettings2.default, {
iconPath: "/assets/icons"
}, _react2.default.createElement("div", null, _react2.default.createElement(_button2.default, {
label: "Open Modal with notification",
onClick: this.toggleModal
}), _react2.default.createElement(_modal2.default, {
footer: [_react2.default.createElement(_button2.default, {
key: "toggleToast",
label: "Toggle Toast",
onClick: this.toggleToast,
variant: "brand"
})],
isOpen: this.state.modalOpen,
onRequestClose: this.toggleModal,
title: "Lightning Design System: Style with Ease",
toast: _react2.default.createElement(_notification2.default, {
content: "Oops, you've missed some required form inputs.",
iconName: "warning",
isOpen: this.state.toastOpen,
onDismiss: this.toggleToast,
theme: "warning",
variant: "toast"
})
}, _react2.default.createElement("section", {
className: "slds-p-around_medium"
}, _react2.default.createElement("p", null, "Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis. Cillum sunt ad dolore quis aute consequat ipsum magna exercitation reprehenderit magna. Tempor cupidatat consequat elit dolor adipisicing."), _react2.default.createElement("p", null, "Dolor eiusmod sunt ex incididunt cillum quis nostrud velit duis sit officia. Lorem aliqua enim laboris do dolor eiusmod officia. Mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident. Eiusmod et adipisicing culpa deserunt nostrud ad veniam nulla aute est. Labore esse esse cupidatat amet velit id elit consequat minim ullamco mollit enim excepteur ea.")))));
}
}]);
return Example;
}(_react2.default.Component);
Object.defineProperty(Example, "displayName", {
configurable: true,
enumerable: true,
writable: true,
value: 'NotificationExample'
});
exports.default = Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime