UNPKG

preact-material-components

Version:
129 lines 4.21 kB
import { h } from 'preact'; import MaterialComponent from '../Base/MaterialComponent'; import Icon from '../Icon'; export class ListItem extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'list-item'; this.mdcProps = []; } materialDom(props) { return (h("li", Object.assign({ role: "option" }, props, { ref: this.setControlRef }), props.children)); } } export class ListLinkItem extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'list-item'; this.mdcProps = []; } materialDom(props) { return (h("a", Object.assign({ role: "option" }, props, { ref: this.setControlRef }), props.children)); } } export class ListItemGraphic extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'list-item__graphic'; this.mdcProps = []; } materialDom(props) { return (h("span", Object.assign({}, props, { ref: this.setControlRef, role: "presentation" }), h(Icon, { "aria-hidden": "true" }, props.children))); } } export class ListItemMeta extends ListItemGraphic { constructor() { super(...arguments); this.componentName = 'list-item__meta'; } } export class ListItemMetaText extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'list-item__meta'; this.mdcProps = []; } materialDom(props) { return (h("span", Object.assign({}, props, { ref: this.setControlRef, role: "presentation" }), props.children)); } } export class ListDivider extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'list-divider'; this.mdcProps = ['inset']; } materialDom(props) { return h("li", Object.assign({ role: "separator" }, props, { ref: this.setControlRef })); } } export class ListTextContainer extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'list-item__text'; this.mdcProps = []; } materialDom(props) { return (h("span", Object.assign({}, props, { ref: this.setControlRef }), props.children)); } } export class ListPrimaryText extends ListTextContainer { constructor() { super(...arguments); this.componentName = 'list-item__primary-text'; } } export class ListSecondaryText extends ListTextContainer { constructor() { super(...arguments); this.componentName = 'list-item__secondary-text'; } } export class ListGroup extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'list-group'; this.mdcProps = []; } materialDom(props) { return h("div", Object.assign({}, props), this.props.children); } } export class ListGroupHeader extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'list-group__subheader'; this.mdcProps = []; } materialDom(props) { return (h("h3", Object.assign({}, props, { ref: this.setControlRef }), props.children)); } } export class List extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'list'; this.mdcProps = ['dense', 'two-line', 'avatar-list']; } materialDom(props) { if (props.interactive) { return (h("nav", Object.assign({ ref: this.setControlRef }, props), props.children)); } return (h("ul", Object.assign({}, props, { ref: this.setControlRef }), props.children)); } } export default class default_1 extends List { } default_1.Item = ListItem; default_1.LinkItem = ListLinkItem; default_1.ItemGraphic = ListItemGraphic; default_1.ItemMeta = ListItemMeta; default_1.ItemMetaText = ListItemMetaText; default_1.Divider = ListDivider; default_1.TextContainer = ListTextContainer; default_1.PrimaryText = ListPrimaryText; default_1.SecondaryText = ListSecondaryText; default_1.Group = ListGroup; default_1.GroupHeader = ListGroupHeader; //# sourceMappingURL=index.js.map