@salesforce/design-system-react
Version:
Salesforce Lightning Design System for React
103 lines (96 loc) • 2.87 kB
JavaScript
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
/* eslint-disable no-console, react/prop-types */
import React from 'react';
import createReactClass from 'create-react-class';
import IconSettings from "../../../../components/icon-settings";
import VerticalNavigation from "../../../../components/vertical-navigation";
var sampleSearchCategories = [{
id: 'search_results',
label: 'Search Results',
items: [{
id: 'top',
label: 'Top Results'
}, {
id: 'accounts',
label: 'Accounts'
}, {
id: 'contacts',
label: 'Contacts'
}, {
id: 'opportunities',
label: 'Opportunities'
}, {
id: 'leads',
label: 'Leads'
}, {
id: 'groups',
label: 'Groups'
}, {
id: 'files',
label: 'Files'
}, {
id: 'dashboards',
label: 'Dashboards'
}, {
id: 'reports',
label: 'Reports'
}, {
id: 'feeds',
label: 'Feeds'
}]
}, {
id: 'external_results',
label: 'External Results',
items: [{
id: 'app_one',
label: 'App One'
}, {
id: 'app_two',
label: 'App Two'
}, {
id: 'app_three',
label: 'App Three'
}]
}];
var Example = createReactClass({
displayName: 'NavigationExample',
getInitialState: function getInitialState() {
return {
selectedId: 'top'
};
},
render: function render() {
var _this = this;
return React.createElement(IconSettings, {
iconPath: "/assets/icons"
}, React.createElement("div", {
style: {
width: '320px',
backgroundColor: '#FAFAFB'
}
}, React.createElement(VerticalNavigation, {
id: "sample-navigation",
variant: "shade",
categories: sampleSearchCategories,
selectedId: this.state.selectedId,
onSelect: function onSelect(event, data) {
_this.setState({
selectedId: data.item.id
});
if (_this.props.action) {
var dataAsArray = Object.keys(data).map(function (key) {
return data[key];
});
_this.props.action('onSelect').apply(void 0, [event, data].concat(_toConsumableArray(dataAsArray)));
} else if (console) {
console.log('[onSelect] (event, data)', event, data);
}
}
})));
}
});
export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
//# sourceMappingURL=shade.js.map