@blb-ventures/react-flat-list
Advanced tools
Comparing version 0.6.4 to 0.7.0
@@ -1,2 +0,2 @@ | ||
import { FC, ReactNode } from 'react'; | ||
import { FC, FunctionComponent, ReactNode } from 'react'; | ||
import { LinkWrapperProps } from './link-wrapper'; | ||
@@ -30,3 +30,8 @@ export interface SectionOptions { | ||
LinkComponent?: LinkWrapperProps['LinkComponent']; | ||
component?: FunctionComponent<{ | ||
children?: ReactNode; | ||
className?: string; | ||
onClick?: (e: any) => void; | ||
}> | string; | ||
} | ||
export declare const FlatListItem: FC<FlatListItemProps>; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const link_wrapper_1 = require("./link-wrapper"); | ||
const FlatListItem = ({ title, className, contentClassName = 'flat-list-item-content', actionIcon, imageLeft, imageLeftOptions, imageRight, imageRightOptions, onClick, left, leftOptions, right, rightOptions, center, subtitleLeft, subtitleRight, url, urlIsExternal, height = '56px', LinkComponent, }) => { | ||
const FlatListItem = ({ title, className, contentClassName = 'flat-list-item-content', actionIcon, imageLeft, imageLeftOptions, imageRight, imageRightOptions, onClick, left, leftOptions, right, rightOptions, center, subtitleLeft, subtitleRight, url, urlIsExternal, height = '56px', LinkComponent, component, }) => { | ||
var _a, _b, _c, _d; | ||
@@ -12,5 +12,6 @@ const hasAction = onClick != null || url != null; | ||
const hasRight = imageRight != null || subtitleRight != null || right != null || hasActionIcon; | ||
const Component = component !== null && component !== void 0 ? component : 'li'; | ||
const el = ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: contentClassName, style: { height } }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `flat-list-item-content-left ${(_a = leftOptions === null || leftOptions === void 0 ? void 0 : leftOptions.className) !== null && _a !== void 0 ? _a : ''}`, style: leftOptions === null || leftOptions === void 0 ? void 0 : leftOptions.style }, { children: [left, typeof imageLeft === 'string' ? ((0, jsx_runtime_1.jsx)("img", Object.assign({}, imageLeftOptions, { alt: (_b = imageLeftOptions === null || imageLeftOptions === void 0 ? void 0 : imageLeftOptions.alt) !== null && _b !== void 0 ? _b : '', src: imageLeft }))) : (imageLeft), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flat-list-item-content-left-text-container" }, { children: [typeof title === 'string' ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flat-list-item-content-left-title" }, { children: title }))) : (title), typeof subtitleLeft === 'string' ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flat-list-item-content-left-subtitle" }, { children: subtitleLeft }))) : (subtitleLeft)] }))] })), center, hasRight && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `flat-list-item-content-right ${(_c = rightOptions === null || rightOptions === void 0 ? void 0 : rightOptions.className) !== null && _c !== void 0 ? _c : ''}`, style: rightOptions === null || rightOptions === void 0 ? void 0 : rightOptions.style }, { children: [typeof imageRight === 'string' ? ((0, jsx_runtime_1.jsx)("img", Object.assign({}, imageRightOptions, { alt: (_d = imageLeftOptions === null || imageLeftOptions === void 0 ? void 0 : imageLeftOptions.alt) !== null && _d !== void 0 ? _d : '', src: imageRight }))) : (imageRight), typeof subtitleRight === 'string' ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flat-list-item-content-right-subtitle" }, { children: subtitleRight }))) : (subtitleRight), right, hasActionIcon && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flat-list-item-content-right-action-icon" }, { children: actionIcon })))] })))] }))); | ||
return ((0, jsx_runtime_1.jsx)("li", Object.assign({ className: `flat-list-item ${hasAction ? ' flat-list-item-with-action' : ''} ${className !== null && className !== void 0 ? className : ''}`, onClick: onClick }, { children: (0, jsx_runtime_1.jsx)(link_wrapper_1.LinkWrapper, Object.assign({ isExternal: urlIsExternal, LinkComponent: LinkComponent, url: url }, { children: el })) }))); | ||
return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ className: `flat-list-item ${hasAction ? ' flat-list-item-with-action' : ''} ${className !== null && className !== void 0 ? className : ''}`, onClick: onClick }, { children: (0, jsx_runtime_1.jsx)(link_wrapper_1.LinkWrapper, Object.assign({ isExternal: urlIsExternal, LinkComponent: LinkComponent, url: url }, { children: el })) }))); | ||
}; | ||
exports.FlatListItem = FlatListItem; |
{ | ||
"name": "@blb-ventures/react-flat-list", | ||
"version": "0.6.4", | ||
"version": "0.7.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
29633
498