diff --git a/components/SLDSMenuPicklist/List.jsx b/components/SLDSMenuList/List.jsx similarity index 100% rename from components/SLDSMenuPicklist/List.jsx rename to components/SLDSMenuList/List.jsx diff --git a/components/SLDSMenuPicklist/ListItem.jsx b/components/SLDSMenuList/ListItem.jsx similarity index 100% rename from components/SLDSMenuPicklist/ListItem.jsx rename to components/SLDSMenuList/ListItem.jsx diff --git a/components/SLDSMenuPicklist/ListItemLabel.jsx b/components/SLDSMenuList/ListItemLabel.jsx similarity index 98% rename from components/SLDSMenuPicklist/ListItemLabel.jsx rename to components/SLDSMenuList/ListItemLabel.jsx index 7341857efe..00df703f41 100644 --- a/components/SLDSMenuPicklist/ListItemLabel.jsx +++ b/components/SLDSMenuList/ListItemLabel.jsx @@ -18,7 +18,7 @@ const propTypes = { isHighlighted: React.PropTypes.bool, isSelected: React.PropTypes.bool, label: React.PropTypes.string, - value: React.PropTypes.string, + value: React.PropTypes.any, }; const defaultProps = { data: {}, diff --git a/components/SLDSMenuList/index.jsx b/components/SLDSMenuList/index.jsx new file mode 100644 index 0000000000..6551da9246 --- /dev/null +++ b/components/SLDSMenuList/index.jsx @@ -0,0 +1,155 @@ +/* +Copyright (c) 2015, salesforce.com, inc. All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +import React from "react"; +import ReactDOM from "react-dom"; +import isEqual from "lodash.isequal"; + +import {KEYS, EventUtil} from "../utils"; +import SLDSIcon from "../SLDSIcon"; +import List from "./List"; +import ListItemLabel from "./ListItemLabel"; + +const displayName = "SLDSMenuList"; +const propTypes = { + className: React.PropTypes.string, + /** + * If true, renders checkmark icon on the selected Menu Item. + */ + checkmark: React.PropTypes.bool, + label: React.PropTypes.string, + /** + * Custom element that overrides the default Menu Item component. + */ + listItemRenderer: React.PropTypes.node, + /** + * If true, component renders specifically to work inside Modal. + */ + onClick: React.PropTypes.func, + onSelect: React.PropTypes.func, + /** + * Menu item data. + */ + options: React.PropTypes.array.isRequired, +}; +const defaultProps = { + checkmark: true +}; + +/** + * The SLDSMenuPicklist component is a variant of the Ligtning Design System Menu component. + */ +class SLDSMenuPicklist extends React.Component { + constructor(props) { + super(props); + this.state = { + highlightedIndex: 0, + isOpen: false, + lastBlurredIndex: -1, + lastBlurredTimeStamp: -1, + selectedIndex: this.props.selectedIndex, + /* triggerId is the id of the element that triggers the Menu to open. + * Need this for aria-labelledby on diff --git a/scripts/component-docs.js b/scripts/component-docs.js index fae7bd46ba..dea34a3624 100644 --- a/scripts/component-docs.js +++ b/scripts/component-docs.js @@ -14,6 +14,7 @@ var componentNames = [ 'SLDSNotification', 'SLDSPopoverTooltip', 'SLDSDatepickerSingleSelect', + 'SLDSTimepicker', //'SLDSGrid', //'SLDSUtilityIcon', ];