| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | 1× 1× 1× 1× 8× 8× 8× 7× 8× 2× 8× 1× 1× 1× 1× 1× 1× | /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var React = require('react'); var react_1 = require("react"); /** * This module contains generic UI Elements reuse in the app */ exports.DropdownItem = function (props) { var icon; var iconRight; if (props.icon) { icon = React.createElement("svg", {"aria-hidden": "true", className: "slds-icon slds-icon--x-small slds-icon-text-default slds-m-right--x-small" + (props.isCheckbox ? " slds-icon--selected" : "")}, React.createElement("use", {xlinkHref: "assets/icons/utility-sprite/svg/symbols.svg#" + props.icon}) ); } if (props.iconRight) { iconRight = React.createElement("svg", {"aria-hidden": "true", className: "slds-icon slds-icon--x-small slds-icon-text-default slds-m-left--small slds-shrink-none", onClick: function (e) { if (props.iconRightClick) { e.stopPropagation(); e.preventDefault(); props.iconRightClick(e); } }}, React.createElement("use", {xlinkHref: "assets/icons/utility-sprite/svg/symbols.svg#" + props.iconRight}) ); } return React.createElement("li", {className: "slds-dropdown__item" + (props.selected ? " slds-is-selected" : ""), role: "presentation"}, React.createElement("a", {href: "javascript:void(0);", role: props.isCheckbox ? "menuitemcheckbox" : "menuitem", "aria-checked": props.selected ? "true" : "false", onClick: function (e) { e.stopPropagation(); e.preventDefault(); props.onClick(e); }, tabIndex: "-1"}, React.createElement("span", {className: "slds-truncate"}, icon, " ", props.text), iconRight) ); }; exports.DropdownItem.propTypes = { onClick: react_1.PropTypes.func.isRequired, iconRightClick: react_1.PropTypes.func, text: react_1.PropTypes.string, icon: react_1.PropTypes.string, iconRight: react_1.PropTypes.string, isCheckbox: react_1.PropTypes.string, children: react_1.PropTypes.any, selected: react_1.PropTypes.bool }; exports.LinkItem = function (props) { var icon; if (props.icon) { icon = React.createElement("i", {className: props.icon + " icon"}); } return React.createElement("a", {className: "item" + (props.disabled ? " disabled" : ""), href: "#", onClick: function (e) { e.stopPropagation(); e.preventDefault(); props.onClick(props); }}, icon, " ", props.children, " ", props.text); }; exports.LinkItem.propTypes = { onClick: react_1.PropTypes.func.isRequired, text: react_1.PropTypes.string, icon: react_1.PropTypes.string, disabled: react_1.PropTypes.bool, children: react_1.PropTypes.any }; exports.Icon = function (props) { var classes = []; classes.push(props.type); if (props.align === 'right') { classes.push('right floated'); } if (props.size !== "normal") { classes.push(props.size); } classes.push('icon'); return React.createElement("i", __assign({}, props, {className: classes.join(" ")})); }; exports.Icon.propTypes = { type: react_1.PropTypes.string.isRequired, onClick: react_1.PropTypes.func, align: react_1.PropTypes.oneOf(["left", "right"]), size: react_1.PropTypes.oneOf(["mini", "tiny", "small", "normal", "large", "huge", "massive"]) }; exports.Divider = function (props) { return React.createElement("div", {className: "ui divider"}); }; |