@laerdal/life-react-components 6.0.9-dev.1.full → 6.1.1-dev.1.full
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/List/ListRow.cjs
CHANGED
|
@@ -231,13 +231,16 @@ const ListRow = _ref => {
|
|
|
231
231
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
232
232
|
const [inAction, setInAction] = React.useState(false);
|
|
233
233
|
const handleKeyDown = e => {
|
|
234
|
-
if (e.key === 'Enter') {
|
|
234
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
235
|
+
e.preventDefault();
|
|
235
236
|
action && action();
|
|
236
237
|
}
|
|
237
238
|
};
|
|
238
239
|
const rowClassName = (inAction ? 'in-action ' : '').concat(disabled ? 'disabled ' : '').concat(!!action ? 'interactive ' : '').concat('list-item-row ').concat(`${variant} `).concat(`${size}`).concat(className ? ` ${className}` : '');
|
|
239
240
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Row, _objectSpread(_objectSpread({
|
|
240
241
|
tabIndex: !action || disabled ? -1 : 0,
|
|
242
|
+
role: action ? 'button' : 'listitem',
|
|
243
|
+
"aria-disabled": disabled || undefined,
|
|
241
244
|
className: rowClassName,
|
|
242
245
|
onMouseDown: _common.defaultOnMouseDownHandler,
|
|
243
246
|
onKeyDown: e => !disabled && handleKeyDown(e),
|
|
@@ -248,6 +251,7 @@ const ListRow = _ref => {
|
|
|
248
251
|
}, rest), {}, {
|
|
249
252
|
children: [!!icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
250
253
|
className: 'list-item-icon',
|
|
254
|
+
"aria-hidden": "true",
|
|
251
255
|
children: icon
|
|
252
256
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
253
257
|
className: 'list-item-content',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListRow.cjs","names":["React","_interopRequireWildcard","require","_styledComponents","_interopRequireDefault","_styles","_Tooltips","_Dropdown","_icons","_types","_common","_Button","_jsxRuntime","_excluded","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","Row","styled","div","props","COLORS","generateToken","componentType","defaultVariant","theme","state","Z_INDEXES","hover","active","focusStyles","ComponentSStyling","ComponentTextStyle","Regular","ComponentMStyling","ComponentLStyling","ComponentXXSStyling","ComponentXSStyling","RightIcon","ListRow","_ref","size","Size","Medium","variant","icon","mainText","secondaryText","dropdown","note","noteTooltip","disabled","action","rightSideIcon","rightSideAction","rightSideIconDisabled","className","rest","_objectWithoutProperties2","inAction","setInAction","useState","handleKeyDown","key","rowClassName","concat","jsxs","tabIndex","onMouseDown","defaultOnMouseDownHandler","onKeyDown","onClick","children","jsx","Fragment","TooltipWrapper","label","Large","Small","XSmall","position","withArrow","onMouseEnter","onMouseLeave","DropdownButton","type","SystemIcons","ArrowDropDown","MoreVertical","IconButton","shape","propTypes","_propTypes","oneOf","node","string","isRequired","oneOfType","bool","func","_default","exports"],"sources":["../../src/List/ListRow.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport {COLORS, ComponentTextStyle, focusStyles} from '../styles';\r\n\r\nimport {\r\n ComponentLStyling,\r\n ComponentMStyling,\r\n ComponentSStyling,\r\n ComponentXSStyling,\r\n ComponentXXSStyling\r\n} from '../styles';\r\nimport {DropdownButtonProps} from '../Dropdown/DropdownButtonTypes';\r\nimport {TooltipWrapper} from '../Tooltips';\r\nimport {DropdownButton} from '../Dropdown';\r\nimport {SystemIcons} from '../icons';\r\nimport {Size} from '../types';\r\nimport {Z_INDEXES} from '../styles';\r\nimport {defaultOnMouseDownHandler} from '../common';\r\nimport {IconButton} from '../Button';\r\n\r\nconst Row = styled.div`\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n border-bottom: 1px solid ${props => COLORS.generateToken({ componentType:'border', defaultVariant:'subtle' }, props.theme)};\r\n box-sizing: border-box;\r\n\r\n color: ${props => COLORS.generateToken({componentType:'text',defaultVariant:'subtle'}, props.theme)};\r\n background-color: ${props => COLORS.generateToken({componentType:'bg-surface', defaultVariant:'default'}, props.theme)};\r\n\r\n\r\n cursor: default;\r\n\r\n &.interactive {\r\n cursor: pointer;\r\n }\r\n\r\n &.interactive.disabled {\r\n cursor: not-allowed;\r\n }\r\n\r\n &.interactive:hover:not(.in-action):not(.disabled) {\r\n background-color: ${props => COLORS.generateToken({ componentType:'bg-surface', state:'hover' }, props.theme)};\r\n color: ${props => COLORS.generateToken({ componentType: 'text', state:'hover' }, props.theme)};\r\n z-index: ${Z_INDEXES.hover};\r\n }\r\n\r\n &.interactive:active:not(.in-action):not(.disabled) {\r\n background-color: ${props => COLORS.generateToken({ componentType:'bg-surface', state:'active' }, props.theme)};\r\n color: ${props => COLORS.generateToken({ componentType:'text', state:'active' }, props.theme)};\r\n z-index: ${Z_INDEXES.active};\r\n }\r\n\r\n &.interactive:focus {\r\n ${focusStyles}\r\n }\r\n\r\n &.disabled {\r\n .list-item-icon, .list-item-content, .list-item-note, .list-item-actions {\r\n color: ${props => COLORS.generateToken({ componentType: 'text', state: 'disabled' }, props.theme)};\r\n }\r\n }\r\n\r\n\r\n &.small {\r\n min-height: 48px;\r\n padding: 0 8px;\r\n\r\n .list-item-icon {\r\n margin-right: 8px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -8px;\r\n }\r\n }\r\n\r\n &.medium {\r\n min-height: 56px;\r\n padding: 0 12px;\r\n\r\n .list-item-icon {\r\n margin-right: 12px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentMStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -12px;\r\n }\r\n }\r\n\r\n &.large {\r\n min-height: 64px;\r\n padding: 0 16px;\r\n\r\n .list-item-icon {\r\n margin-right: 16px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentLStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -16px;\r\n }\r\n }\r\n\r\n &.overlay {\r\n padding: 0 4px;\r\n\r\n .list-item-actions {\r\n margin-right: -4px;\r\n }\r\n }\r\n\r\n .list-item-icon {\r\n width: 24px;\r\n height: 24px;\r\n\r\n svg {\r\n width: 24px;\r\n height: 24px;\r\n }\r\n }\r\n\r\n .list-item-content {\r\n flex-grow: 1;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n .list-item-main-text {\r\n }\r\n\r\n .list-item-secondary-text {\r\n ${ComponentXXSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-note {\r\n color: ${props => COLORS.generateToken({componentType:'text',defaultVariant:'subtle'}, props.theme)};\r\n word-break: initial;\r\n ${ComponentXSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-note.with-tooltip {\r\n cursor: pointer;\r\n\r\n > div {\r\n text-decoration-line: underline;\r\n text-decoration-style: dashed;\r\n text-underline-offset: 1px;\r\n text-decoration-thickness: 1px;\r\n }\r\n }\r\n\r\n .list-item-actions {\r\n display: flex;\r\n align-items: center;\r\n\r\n button div {\r\n background-color: transparent;\r\n }\r\n }\r\n`;\r\n\r\nconst RightIcon = styled.div`\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n min-height: 48px;\r\n min-width: 48px;\r\n`;\r\n\r\n\r\nexport interface ListRowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex' | 'onMouseDown' | 'onKeyDown'> {\r\n /** Size of the ListRow. Defaults to 'medium'. */\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n /** Variant of the ListRow. Defaults to 'normal'. */\r\n variant?: 'normal' | 'overlay';\r\n /** Optional. Icon to be shown on the left side of the ListRow. */\r\n icon?: React.ReactNode;\r\n /** Required. Main text of the ListRow */\r\n mainText: string;\r\n /** Optional. Secondary row shown under MainText */\r\n secondaryText?: string;\r\n /** Optional. Details of the DropdownButton shown on the right side of the ListRow. */\r\n dropdown?: Pick<DropdownButtonProps, 'items' | 'onClick' | 'disabled' | 'width'>;\r\n /** Optional. Note to be shown on the right side of the component. */\r\n note?: string | React.ReactNode;\r\n /** Optional. Tooltip of the Note shown on the right side of the component. */\r\n noteTooltip?: string;\r\n /** Optional. If disabled then styles are greyed out and user can not interact with dropdown or click on the ListRow. */\r\n disabled?: boolean;\r\n /** Optional. Action to be executed when user clicks the row. */\r\n action?: () => void;\r\n /** Optional. Icon of the IconButton to show on the right side of the component */\r\n rightSideIcon?: React.ReactNode;\r\n /** Optional. Action to be executed when user clicks on the IconButton on the right */\r\n rightSideAction?: () => void;\r\n /** Optional. If disabled user will not be able to interact with IconButton shown on the right side */\r\n rightSideIconDisabled?: boolean;\r\n};\r\n\r\nconst ListRow: React.FunctionComponent<ListRowProps> = ({\r\n size = Size.Medium,\r\n variant = 'normal',\r\n icon,\r\n mainText,\r\n secondaryText,\r\n dropdown,\r\n note,\r\n noteTooltip,\r\n disabled = false,\r\n action,\r\n rightSideIcon,\r\n rightSideAction,\r\n rightSideIconDisabled,\r\n className,\r\n ...rest\r\n }: ListRowProps) => {\r\n\r\n const [inAction, setInAction] = React.useState<Boolean>(false);\r\n\r\n const handleKeyDown = (e: any) => {\r\n if (e.key === 'Enter') {\r\n action && action()\r\n }\r\n }\r\n\r\n const rowClassName = (inAction ? 'in-action ' : '')\r\n .concat(disabled ? 'disabled ' : '')\r\n .concat(!!action ? 'interactive ' : '')\r\n .concat('list-item-row ')\r\n .concat(`${variant} `)\r\n .concat(`${size}`)\r\n .concat(className ? ` ${className}` : '');\r\n\r\n return (\r\n <Row tabIndex={!action || disabled ? -1 : 0}\r\n className={rowClassName}\r\n onMouseDown={defaultOnMouseDownHandler}\r\n onKeyDown={(e) => !disabled && handleKeyDown(e)}\r\n onClick={e => {\r\n !disabled && action && action();\r\n }}\r\n data-hj-suppress\r\n {...rest}>\r\n {\r\n !!icon &&\r\n <div className={'list-item-icon'}>{icon}</div>\r\n }\r\n <div className={'list-item-content'}>\r\n <div className={'list-item-main-text'}>{mainText}</div>\r\n {!!secondaryText && <div className={'list-item-secondary-text'}>{secondaryText}</div>}\r\n </div>\r\n {\r\n !!note &&\r\n <>\r\n {\r\n !!noteTooltip &&\r\n <div className={'list-item-note with-tooltip'}>\r\n <TooltipWrapper label={noteTooltip}\r\n size={size === Size.Large ? Size.Medium : size === Size.Small ? Size.XSmall : Size.Small}\r\n position={'top'}\r\n tabIndex={disabled ? -1 : 0}\r\n withArrow={true}>\r\n {note}\r\n </TooltipWrapper>\r\n </div>\r\n }\r\n {\r\n !noteTooltip &&\r\n <div className={'list-item-note'}>\r\n {note}\r\n </div>\r\n }\r\n </>\r\n }\r\n {\r\n !!dropdown &&\r\n <div className={'list-item-actions'}\r\n onMouseEnter={() => setInAction(!dropdown?.disabled)}\r\n onMouseLeave={() => setInAction(false)}>\r\n <DropdownButton {...dropdown}\r\n type={'icon'}\r\n disabled={disabled || dropdown.disabled}\r\n icon={variant === 'overlay'\r\n ? <SystemIcons.ArrowDropDown/>\r\n : <SystemIcons.MoreVertical/>}\r\n />\r\n </div>\r\n }\r\n {\r\n !!rightSideIcon &&\r\n <RightIcon className={'list-item-actions'}\r\n onMouseEnter={() => rightSideAction && setInAction(!dropdown?.disabled)}\r\n onMouseLeave={() => rightSideAction && setInAction(false)}>\r\n {\r\n rightSideAction &&\r\n <IconButton action={rightSideAction} variant='secondary' shape='circular'\r\n disabled={disabled || rightSideIconDisabled}>\r\n {rightSideIcon}\r\n </IconButton>\r\n }\r\n {\r\n !rightSideAction && rightSideIcon\r\n }\r\n </RightIcon>\r\n }\r\n </Row>\r\n );\r\n};\r\n\r\n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ACjG,eAAeE,iBAAS,CAACE,MAAM;AAC/B;AACA;AACA;AACA,MAAMC,mBAAW;AACjB;AACA;AACA;AACA;AACA,eAAeV,KAAK,IAAIC,cAAM,CAACC,aAAa,CAAC;EAAEC,aAAa,EAAE,MAAM;EAAEG,KAAK,EAAE;AAAW,CAAC,EAAEN,KAAK,CAACK,KAAK,CAAC;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,IAAAM,yBAAiB,EAACC,0BAAkB,CAACC,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,IAAAC,yBAAiB,EAACF,0BAAkB,CAACC,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,IAAAE,yBAAiB,EAACH,0BAAkB,CAACC,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAAAG,2BAAmB,EAACJ,0BAAkB,CAACC,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA,aAAab,KAAK,IAAIC,cAAM,CAACC,aAAa,CAAC;EAACC,aAAa,EAAC,MAAM;EAACC,cAAc,EAAC;AAAQ,CAAC,EAAEJ,KAAK,CAACK,KAAK,CAAC;AACvG;AACA,MAAM,IAAAY,0BAAkB,EAACL,0BAAkB,CAACC,OAAO,EAAE,IAAI,CAAC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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|
|
1
|
+
{"version":3,"file":"ListRow.cjs","names":["React","_interopRequireWildcard","require","_styledComponents","_interopRequireDefault","_styles","_Tooltips","_Dropdown","_icons","_types","_common","_Button","_jsxRuntime","_excluded","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","Row","styled","div","props","COLORS","generateToken","componentType","defaultVariant","theme","state","Z_INDEXES","hover","active","focusStyles","ComponentSStyling","ComponentTextStyle","Regular","ComponentMStyling","ComponentLStyling","ComponentXXSStyling","ComponentXSStyling","RightIcon","ListRow","_ref","size","Size","Medium","variant","icon","mainText","secondaryText","dropdown","note","noteTooltip","disabled","action","rightSideIcon","rightSideAction","rightSideIconDisabled","className","rest","_objectWithoutProperties2","inAction","setInAction","useState","handleKeyDown","key","preventDefault","rowClassName","concat","jsxs","tabIndex","role","undefined","onMouseDown","defaultOnMouseDownHandler","onKeyDown","onClick","children","jsx","Fragment","TooltipWrapper","label","Large","Small","XSmall","position","withArrow","onMouseEnter","onMouseLeave","DropdownButton","type","SystemIcons","ArrowDropDown","MoreVertical","IconButton","shape","propTypes","_propTypes","oneOf","node","string","isRequired","oneOfType","bool","func","_default","exports"],"sources":["../../src/List/ListRow.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport {COLORS, ComponentTextStyle, focusStyles} from '../styles';\r\n\r\nimport {\r\n ComponentLStyling,\r\n ComponentMStyling,\r\n ComponentSStyling,\r\n ComponentXSStyling,\r\n ComponentXXSStyling\r\n} from '../styles';\r\nimport {DropdownButtonProps} from '../Dropdown/DropdownButtonTypes';\r\nimport {TooltipWrapper} from '../Tooltips';\r\nimport {DropdownButton} from '../Dropdown';\r\nimport {SystemIcons} from '../icons';\r\nimport {Size} from '../types';\r\nimport {Z_INDEXES} from '../styles';\r\nimport {defaultOnMouseDownHandler} from '../common';\r\nimport {IconButton} from '../Button';\r\n\r\nconst Row = styled.div`\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n border-bottom: 1px solid ${props => COLORS.generateToken({ componentType:'border', defaultVariant:'subtle' }, props.theme)};\r\n box-sizing: border-box;\r\n\r\n color: ${props => COLORS.generateToken({componentType:'text',defaultVariant:'subtle'}, props.theme)};\r\n background-color: ${props => COLORS.generateToken({componentType:'bg-surface', defaultVariant:'default'}, props.theme)};\r\n\r\n\r\n cursor: default;\r\n\r\n &.interactive {\r\n cursor: pointer;\r\n }\r\n\r\n &.interactive.disabled {\r\n cursor: not-allowed;\r\n }\r\n\r\n &.interactive:hover:not(.in-action):not(.disabled) {\r\n background-color: ${props => COLORS.generateToken({ componentType:'bg-surface', state:'hover' }, props.theme)};\r\n color: ${props => COLORS.generateToken({ componentType: 'text', state:'hover' }, props.theme)};\r\n z-index: ${Z_INDEXES.hover};\r\n }\r\n\r\n &.interactive:active:not(.in-action):not(.disabled) {\r\n background-color: ${props => COLORS.generateToken({ componentType:'bg-surface', state:'active' }, props.theme)};\r\n color: ${props => COLORS.generateToken({ componentType:'text', state:'active' }, props.theme)};\r\n z-index: ${Z_INDEXES.active};\r\n }\r\n\r\n &.interactive:focus {\r\n ${focusStyles}\r\n }\r\n\r\n &.disabled {\r\n .list-item-icon, .list-item-content, .list-item-note, .list-item-actions {\r\n color: ${props => COLORS.generateToken({ componentType: 'text', state: 'disabled' }, props.theme)};\r\n }\r\n }\r\n\r\n\r\n &.small {\r\n min-height: 48px;\r\n padding: 0 8px;\r\n\r\n .list-item-icon {\r\n margin-right: 8px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -8px;\r\n }\r\n }\r\n\r\n &.medium {\r\n min-height: 56px;\r\n padding: 0 12px;\r\n\r\n .list-item-icon {\r\n margin-right: 12px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentMStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -12px;\r\n }\r\n }\r\n\r\n &.large {\r\n min-height: 64px;\r\n padding: 0 16px;\r\n\r\n .list-item-icon {\r\n margin-right: 16px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentLStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -16px;\r\n }\r\n }\r\n\r\n &.overlay {\r\n padding: 0 4px;\r\n\r\n .list-item-actions {\r\n margin-right: -4px;\r\n }\r\n }\r\n\r\n .list-item-icon {\r\n width: 24px;\r\n height: 24px;\r\n\r\n svg {\r\n width: 24px;\r\n height: 24px;\r\n }\r\n }\r\n\r\n .list-item-content {\r\n flex-grow: 1;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n .list-item-main-text {\r\n }\r\n\r\n .list-item-secondary-text {\r\n ${ComponentXXSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-note {\r\n color: ${props => COLORS.generateToken({componentType:'text',defaultVariant:'subtle'}, props.theme)};\r\n word-break: initial;\r\n ${ComponentXSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-note.with-tooltip {\r\n cursor: pointer;\r\n\r\n > div {\r\n text-decoration-line: underline;\r\n text-decoration-style: dashed;\r\n text-underline-offset: 1px;\r\n text-decoration-thickness: 1px;\r\n }\r\n }\r\n\r\n .list-item-actions {\r\n display: flex;\r\n align-items: center;\r\n\r\n button div {\r\n background-color: transparent;\r\n }\r\n }\r\n`;\r\n\r\nconst RightIcon = styled.div`\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n min-height: 48px;\r\n min-width: 48px;\r\n`;\r\n\r\n\r\nexport interface ListRowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex' | 'onMouseDown' | 'onKeyDown'> {\r\n /** Size of the ListRow. Defaults to 'medium'. */\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n /** Variant of the ListRow. Defaults to 'normal'. */\r\n variant?: 'normal' | 'overlay';\r\n /** Optional. Icon to be shown on the left side of the ListRow. */\r\n icon?: React.ReactNode;\r\n /** Required. Main text of the ListRow */\r\n mainText: string;\r\n /** Optional. Secondary row shown under MainText */\r\n secondaryText?: string;\r\n /** Optional. Details of the DropdownButton shown on the right side of the ListRow. */\r\n dropdown?: Pick<DropdownButtonProps, 'items' | 'onClick' | 'disabled' | 'width'>;\r\n /** Optional. Note to be shown on the right side of the component. */\r\n note?: string | React.ReactNode;\r\n /** Optional. Tooltip of the Note shown on the right side of the component. */\r\n noteTooltip?: string;\r\n /** Optional. If disabled then styles are greyed out and user can not interact with dropdown or click on the ListRow. */\r\n disabled?: boolean;\r\n /** Optional. Action to be executed when user clicks the row. */\r\n action?: () => void;\r\n /** Optional. Icon of the IconButton to show on the right side of the component */\r\n rightSideIcon?: React.ReactNode;\r\n /** Optional. Action to be executed when user clicks on the IconButton on the right */\r\n rightSideAction?: () => void;\r\n /** Optional. If disabled user will not be able to interact with IconButton shown on the right side */\r\n rightSideIconDisabled?: boolean;\r\n};\r\n\r\nconst ListRow: React.FunctionComponent<ListRowProps> = ({\r\n size = Size.Medium,\r\n variant = 'normal',\r\n icon,\r\n mainText,\r\n secondaryText,\r\n dropdown,\r\n note,\r\n noteTooltip,\r\n disabled = false,\r\n action,\r\n rightSideIcon,\r\n rightSideAction,\r\n rightSideIconDisabled,\r\n className,\r\n ...rest\r\n }: ListRowProps) => {\r\n\r\n const [inAction, setInAction] = React.useState<Boolean>(false);\r\n\r\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\r\n if (e.key === 'Enter' || e.key === ' ') {\r\n e.preventDefault();\r\n action && action();\r\n }\r\n }\r\n\r\n const rowClassName = (inAction ? 'in-action ' : '')\r\n .concat(disabled ? 'disabled ' : '')\r\n .concat(!!action ? 'interactive ' : '')\r\n .concat('list-item-row ')\r\n .concat(`${variant} `)\r\n .concat(`${size}`)\r\n .concat(className ? ` ${className}` : '');\r\n\r\n return (\r\n <Row tabIndex={!action || disabled ? -1 : 0}\r\n role={action ? 'button' : 'listitem'}\r\n aria-disabled={disabled || undefined}\r\n className={rowClassName}\r\n onMouseDown={defaultOnMouseDownHandler}\r\n onKeyDown={(e) => !disabled && handleKeyDown(e)}\r\n onClick={e => {\r\n !disabled && action && action();\r\n }}\r\n data-hj-suppress\r\n {...rest}>\r\n {\r\n !!icon &&\r\n <div className={'list-item-icon'} aria-hidden=\"true\">{icon}</div>\r\n }\r\n <div className={'list-item-content'}>\r\n <div className={'list-item-main-text'}>{mainText}</div>\r\n {!!secondaryText && <div className={'list-item-secondary-text'}>{secondaryText}</div>}\r\n </div>\r\n {\r\n !!note &&\r\n <>\r\n {\r\n !!noteTooltip &&\r\n <div className={'list-item-note with-tooltip'}>\r\n <TooltipWrapper label={noteTooltip}\r\n size={size === Size.Large ? Size.Medium : size === Size.Small ? Size.XSmall : Size.Small}\r\n position={'top'}\r\n tabIndex={disabled ? -1 : 0}\r\n withArrow={true}>\r\n {note}\r\n </TooltipWrapper>\r\n </div>\r\n }\r\n {\r\n !noteTooltip &&\r\n <div className={'list-item-note'}>\r\n {note}\r\n </div>\r\n }\r\n </>\r\n }\r\n {\r\n !!dropdown &&\r\n <div className={'list-item-actions'}\r\n onMouseEnter={() => setInAction(!dropdown?.disabled)}\r\n onMouseLeave={() => setInAction(false)}>\r\n <DropdownButton {...dropdown}\r\n type={'icon'}\r\n disabled={disabled || dropdown.disabled}\r\n icon={variant === 'overlay'\r\n ? <SystemIcons.ArrowDropDown/>\r\n : <SystemIcons.MoreVertical/>}\r\n />\r\n </div>\r\n }\r\n {\r\n !!rightSideIcon &&\r\n <RightIcon className={'list-item-actions'}\r\n onMouseEnter={() => rightSideAction && setInAction(!dropdown?.disabled)}\r\n onMouseLeave={() => rightSideAction && setInAction(false)}>\r\n {\r\n rightSideAction &&\r\n <IconButton action={rightSideAction} variant='secondary' shape='circular'\r\n disabled={disabled || rightSideIconDisabled}>\r\n {rightSideIcon}\r\n </IconButton>\r\n }\r\n {\r\n !rightSideAction && rightSideIcon\r\n }\r\n </RightIcon>\r\n }\r\n </Row>\r\n );\r\n};\r\n\r\nexport default ListRow;\r\n\r\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAUA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAEA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAAqC,IAAAU,WAAA,GAAAV,OAAA;AAAA,MAAAW,SAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAd,wBAAAc,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc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G,KAAK,EAAC;AAAS,CAAC,EAAEN,KAAK,CAACK,KAAK,CAAC;AAClH,aAAaL,KAAK,IAAIC,cAAM,CAACC,aAAa,CAAC;EAAEC,aAAa,EAAC,MAAM;EAAEG,KAAK,EAAC;AAAS,CAAC,EAAEN,KAAK,CAACK,KAAK,CAAC;AACjG,eAAeE,iBAAS,CAACE,MAAM;AAC/B;AACA;AACA;AACA,MAAMC,mBAAW;AACjB;AACA;AACA;AACA;AACA,eAAeV,KAAK,IAAIC,cAAM,CAACC,aAAa,CAAC;EAAEC,aAAa,EAAE,MAAM;EAAEG,KAAK,EAAE;AAAW,CAAC,EAAEN,KAAK,CAACK,KAAK,CAAC;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,IAAAM,yBAAiB,EAACC,0BAAkB,CAACC,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,IAAAC,yBAAiB,EAACF,0BAAkB,CAACC,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,IAAAE,yBAAiB,EAACH,0BAAkB,CAACC,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAAAG,2BAAmB,EAACJ,0BAAkB,CAACC,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA,aAAab,KAAK,IAAIC,cAAM,CAACC,aAAa,CAAC;EAACC,aAAa,EAAC,MAAM;EAACC,cAAc,EAAC;AAAQ,CAAC,EAAEJ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OAAA,CAAA8G,MAAA;EAEX/C,QAAQ,EAAA4C,UAAA,CAAA3G,OAAA,CAAAiH,IAAA;EAERjD,MAAM,EAAA2C,UAAA,CAAA3G,OAAA,CAAAkH,IAAA;EAENjD,aAAa,EAAA0C,UAAA,CAAA3G,OAAA,CAAA6G,IAAA;EAEb3C,eAAe,EAAAyC,UAAA,CAAA3G,OAAA,CAAAkH,IAAA;EAEf/C,qBAAqB,EAAAwC,UAAA,CAAA3G,OAAA,CAAAiH;AAAA;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAApH,OAAA,GAoHRmD,OAAO","ignoreList":[]}
|
package/dist/List/ListRow.js
CHANGED
|
@@ -224,13 +224,16 @@ const ListRow = _ref => {
|
|
|
224
224
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
225
225
|
const [inAction, setInAction] = React.useState(false);
|
|
226
226
|
const handleKeyDown = e => {
|
|
227
|
-
if (e.key === 'Enter') {
|
|
227
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
228
|
+
e.preventDefault();
|
|
228
229
|
action && action();
|
|
229
230
|
}
|
|
230
231
|
};
|
|
231
232
|
const rowClassName = (inAction ? 'in-action ' : '').concat(disabled ? 'disabled ' : '').concat(!!action ? 'interactive ' : '').concat('list-item-row ').concat(`${variant} `).concat(`${size}`).concat(className ? ` ${className}` : '');
|
|
232
233
|
return /*#__PURE__*/_jsxs(Row, _objectSpread(_objectSpread({
|
|
233
234
|
tabIndex: !action || disabled ? -1 : 0,
|
|
235
|
+
role: action ? 'button' : 'listitem',
|
|
236
|
+
"aria-disabled": disabled || undefined,
|
|
234
237
|
className: rowClassName,
|
|
235
238
|
onMouseDown: defaultOnMouseDownHandler,
|
|
236
239
|
onKeyDown: e => !disabled && handleKeyDown(e),
|
|
@@ -241,6 +244,7 @@ const ListRow = _ref => {
|
|
|
241
244
|
}, rest), {}, {
|
|
242
245
|
children: [!!icon && /*#__PURE__*/_jsx("div", {
|
|
243
246
|
className: 'list-item-icon',
|
|
247
|
+
"aria-hidden": "true",
|
|
244
248
|
children: icon
|
|
245
249
|
}), /*#__PURE__*/_jsxs("div", {
|
|
246
250
|
className: 'list-item-content',
|
package/dist/List/ListRow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListRow.js","names":["React","styled","COLORS","ComponentTextStyle","focusStyles","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentXSStyling","ComponentXXSStyling","TooltipWrapper","DropdownButton","SystemIcons","Size","Z_INDEXES","defaultOnMouseDownHandler","IconButton","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Row","div","props","generateToken","componentType","defaultVariant","theme","state","hover","active","Regular","RightIcon","ListRow","_ref","size","Medium","variant","icon","mainText","secondaryText","dropdown","note","noteTooltip","disabled","action","rightSideIcon","rightSideAction","rightSideIconDisabled","className","rest","_objectWithoutProperties","_excluded","inAction","setInAction","useState","handleKeyDown","e","key","rowClassName","concat","_objectSpread","tabIndex","onMouseDown","onKeyDown","onClick","children","label","Large","Small","XSmall","position","withArrow","onMouseEnter","onMouseLeave","type","ArrowDropDown","MoreVertical","shape","propTypes","_pt","oneOf","node","string","isRequired","oneOfType","bool","func"],"sources":["../../src/List/ListRow.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport {COLORS, ComponentTextStyle, focusStyles} from '../styles';\r\n\r\nimport {\r\n ComponentLStyling,\r\n ComponentMStyling,\r\n ComponentSStyling,\r\n ComponentXSStyling,\r\n ComponentXXSStyling\r\n} from '../styles';\r\nimport {DropdownButtonProps} from '../Dropdown/DropdownButtonTypes';\r\nimport {TooltipWrapper} from '../Tooltips';\r\nimport {DropdownButton} from '../Dropdown';\r\nimport {SystemIcons} from '../icons';\r\nimport {Size} from '../types';\r\nimport {Z_INDEXES} from '../styles';\r\nimport {defaultOnMouseDownHandler} from '../common';\r\nimport {IconButton} from '../Button';\r\n\r\nconst Row = styled.div`\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n border-bottom: 1px solid ${props => COLORS.generateToken({ componentType:'border', defaultVariant:'subtle' }, props.theme)};\r\n box-sizing: border-box;\r\n\r\n color: ${props => COLORS.generateToken({componentType:'text',defaultVariant:'subtle'}, props.theme)};\r\n background-color: ${props => COLORS.generateToken({componentType:'bg-surface', defaultVariant:'default'}, props.theme)};\r\n\r\n\r\n cursor: default;\r\n\r\n &.interactive {\r\n cursor: pointer;\r\n }\r\n\r\n &.interactive.disabled {\r\n cursor: not-allowed;\r\n }\r\n\r\n &.interactive:hover:not(.in-action):not(.disabled) {\r\n background-color: ${props => COLORS.generateToken({ componentType:'bg-surface', state:'hover' }, props.theme)};\r\n color: ${props => COLORS.generateToken({ componentType: 'text', state:'hover' }, props.theme)};\r\n z-index: ${Z_INDEXES.hover};\r\n }\r\n\r\n &.interactive:active:not(.in-action):not(.disabled) {\r\n background-color: ${props => COLORS.generateToken({ componentType:'bg-surface', state:'active' }, props.theme)};\r\n color: ${props => COLORS.generateToken({ componentType:'text', state:'active' }, props.theme)};\r\n z-index: ${Z_INDEXES.active};\r\n }\r\n\r\n &.interactive:focus {\r\n ${focusStyles}\r\n }\r\n\r\n &.disabled {\r\n .list-item-icon, .list-item-content, .list-item-note, .list-item-actions {\r\n color: ${props => COLORS.generateToken({ componentType: 'text', state: 'disabled' }, props.theme)};\r\n }\r\n }\r\n\r\n\r\n &.small {\r\n min-height: 48px;\r\n padding: 0 8px;\r\n\r\n .list-item-icon {\r\n margin-right: 8px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -8px;\r\n }\r\n }\r\n\r\n &.medium {\r\n min-height: 56px;\r\n padding: 0 12px;\r\n\r\n .list-item-icon {\r\n margin-right: 12px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentMStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -12px;\r\n }\r\n }\r\n\r\n &.large {\r\n min-height: 64px;\r\n padding: 0 16px;\r\n\r\n .list-item-icon {\r\n margin-right: 16px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentLStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -16px;\r\n }\r\n }\r\n\r\n &.overlay {\r\n padding: 0 4px;\r\n\r\n .list-item-actions {\r\n margin-right: -4px;\r\n }\r\n }\r\n\r\n .list-item-icon {\r\n width: 24px;\r\n height: 24px;\r\n\r\n svg {\r\n width: 24px;\r\n height: 24px;\r\n }\r\n }\r\n\r\n .list-item-content {\r\n flex-grow: 1;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n .list-item-main-text {\r\n }\r\n\r\n .list-item-secondary-text {\r\n ${ComponentXXSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-note {\r\n color: ${props => COLORS.generateToken({componentType:'text',defaultVariant:'subtle'}, props.theme)};\r\n word-break: initial;\r\n ${ComponentXSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-note.with-tooltip {\r\n cursor: pointer;\r\n\r\n > div {\r\n text-decoration-line: underline;\r\n text-decoration-style: dashed;\r\n text-underline-offset: 1px;\r\n text-decoration-thickness: 1px;\r\n }\r\n }\r\n\r\n .list-item-actions {\r\n display: flex;\r\n align-items: center;\r\n\r\n button div {\r\n background-color: transparent;\r\n }\r\n }\r\n`;\r\n\r\nconst RightIcon = styled.div`\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n min-height: 48px;\r\n min-width: 48px;\r\n`;\r\n\r\n\r\nexport interface ListRowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex' | 'onMouseDown' | 'onKeyDown'> {\r\n /** Size of the ListRow. Defaults to 'medium'. */\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n /** Variant of the ListRow. Defaults to 'normal'. */\r\n variant?: 'normal' | 'overlay';\r\n /** Optional. Icon to be shown on the left side of the ListRow. */\r\n icon?: React.ReactNode;\r\n /** Required. Main text of the ListRow */\r\n mainText: string;\r\n /** Optional. Secondary row shown under MainText */\r\n secondaryText?: string;\r\n /** Optional. Details of the DropdownButton shown on the right side of the ListRow. */\r\n dropdown?: Pick<DropdownButtonProps, 'items' | 'onClick' | 'disabled' | 'width'>;\r\n /** Optional. Note to be shown on the right side of the component. */\r\n note?: string | React.ReactNode;\r\n /** Optional. Tooltip of the Note shown on the right side of the component. */\r\n noteTooltip?: string;\r\n /** Optional. If disabled then styles are greyed out and user can not interact with dropdown or click on the ListRow. */\r\n disabled?: boolean;\r\n /** Optional. Action to be executed when user clicks the row. */\r\n action?: () => void;\r\n /** Optional. Icon of the IconButton to show on the right side of the component */\r\n rightSideIcon?: React.ReactNode;\r\n /** Optional. Action to be executed when user clicks on the IconButton on the right */\r\n rightSideAction?: () => void;\r\n /** Optional. If disabled user will not be able to interact with IconButton shown on the right side */\r\n rightSideIconDisabled?: boolean;\r\n};\r\n\r\nconst ListRow: React.FunctionComponent<ListRowProps> = ({\r\n size = Size.Medium,\r\n variant = 'normal',\r\n icon,\r\n mainText,\r\n secondaryText,\r\n dropdown,\r\n note,\r\n noteTooltip,\r\n disabled = false,\r\n action,\r\n rightSideIcon,\r\n rightSideAction,\r\n rightSideIconDisabled,\r\n className,\r\n ...rest\r\n }: ListRowProps) => {\r\n\r\n const [inAction, setInAction] = React.useState<Boolean>(false);\r\n\r\n const handleKeyDown = (e: any) => {\r\n if (e.key === 'Enter') {\r\n action && action()\r\n }\r\n }\r\n\r\n const rowClassName = (inAction ? 'in-action ' : '')\r\n .concat(disabled ? 'disabled ' : '')\r\n .concat(!!action ? 'interactive ' : '')\r\n .concat('list-item-row ')\r\n .concat(`${variant} `)\r\n .concat(`${size}`)\r\n .concat(className ? ` ${className}` : '');\r\n\r\n return (\r\n <Row tabIndex={!action || disabled ? -1 : 0}\r\n className={rowClassName}\r\n onMouseDown={defaultOnMouseDownHandler}\r\n onKeyDown={(e) => !disabled && handleKeyDown(e)}\r\n onClick={e => {\r\n !disabled && action && action();\r\n }}\r\n data-hj-suppress\r\n {...rest}>\r\n {\r\n !!icon &&\r\n <div className={'list-item-icon'}>{icon}</div>\r\n }\r\n <div className={'list-item-content'}>\r\n <div className={'list-item-main-text'}>{mainText}</div>\r\n {!!secondaryText && <div className={'list-item-secondary-text'}>{secondaryText}</div>}\r\n </div>\r\n {\r\n !!note &&\r\n <>\r\n {\r\n !!noteTooltip &&\r\n <div className={'list-item-note with-tooltip'}>\r\n <TooltipWrapper label={noteTooltip}\r\n size={size === Size.Large ? Size.Medium : size === Size.Small ? Size.XSmall : Size.Small}\r\n position={'top'}\r\n tabIndex={disabled ? -1 : 0}\r\n withArrow={true}>\r\n {note}\r\n </TooltipWrapper>\r\n </div>\r\n }\r\n {\r\n !noteTooltip &&\r\n <div className={'list-item-note'}>\r\n {note}\r\n </div>\r\n }\r\n </>\r\n }\r\n {\r\n !!dropdown &&\r\n <div className={'list-item-actions'}\r\n onMouseEnter={() => setInAction(!dropdown?.disabled)}\r\n onMouseLeave={() => setInAction(false)}>\r\n <DropdownButton {...dropdown}\r\n type={'icon'}\r\n disabled={disabled || dropdown.disabled}\r\n icon={variant === 'overlay'\r\n ? <SystemIcons.ArrowDropDown/>\r\n : <SystemIcons.MoreVertical/>}\r\n />\r\n </div>\r\n }\r\n {\r\n !!rightSideIcon &&\r\n <RightIcon className={'list-item-actions'}\r\n onMouseEnter={() => rightSideAction && setInAction(!dropdown?.disabled)}\r\n onMouseLeave={() => rightSideAction && setInAction(false)}>\r\n {\r\n rightSideAction &&\r\n <IconButton action={rightSideAction} variant='secondary' shape='circular'\r\n disabled={disabled || rightSideIconDisabled}>\r\n {rightSideIcon}\r\n </IconButton>\r\n }\r\n {\r\n !rightSideAction && rightSideIcon\r\n }\r\n </RightIcon>\r\n }\r\n </Row>\r\n );\r\n};\r\n\r\nexport default ListRow;\r\n\r\n"],"mappings":";;;;;;AAAA,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1B,eAAe,IAAIO,WAAW,CAAC,CAACb,QAAQ,EAAEG,QAAQ,CAAE;MACxE8B,YAAY,EAAEA,CAAA,KAAM3B,eAAe,IAAIO,WAAW,CAAC,KAAK,CAAE;MAAAY,QAAA,GAEjEnB,eAAe,iBACf/B,IAAA,CAACF,UAAU;QAAC+B,MAAM,EAAEE,eAAgB;QAACV,OAAO,EAAC,WAAW;QAACyC,KAAK,EAAC,UAAU;QAC7DlC,QAAQ,EAAEA,QAAQ,IAAII,qBAAsB;QAAAkB,QAAA,EACrDpB;MAAa,CACJ,CAAC,EAGb,CAACC,eAAe,IAAID,aAAa;IAAA,CAE1B,CAAC;EAAA,EAEX,CAAC;AAEV,CAAC;AAACb,OAAA,CAAA8C,SAAA;EArIA1C,OAAO,EAAA2C,GAAA,CAAAC,KAAA,EAAG,QAAQ,EAAG,SAAS;EAE9B3C,IAAI,EAAA0C,GAAA,CAAAE,IAAA;EAEJ3C,QAAQ,EAAAyC,GAAA,CAAAG,MAAA,CAAAC,UAAA;EAER5C,aAAa,EAAAwC,GAAA,CAAAG,MAAA;EAIbzC,IAAI,EAAAsC,GAAA,CAAAK,SAAA,EAAAL,GAAA,CAAAG,MAAA,EAAAH,GAAA,CAAAE,IAAA;EAEJvC,WAAW,EAAAqC,GAAA,CAAAG,MAAA;EAEXvC,QAAQ,EAAAoC,GAAA,CAAAM,IAAA;EAERzC,MAAM,EAAAmC,GAAA,CAAAO,IAAA;EAENzC,aAAa,EAAAkC,GAAA,CAAAE,IAAA;EAEbnC,eAAe,EAAAiC,GAAA,CAAAO,IAAA;EAEfvC,qBAAqB,EAAAgC,GAAA,CAAAM;AAAA;AAiHvB,eAAerD,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ListRow.js","names":["React","styled","COLORS","ComponentTextStyle","focusStyles","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentXSStyling","ComponentXXSStyling","TooltipWrapper","DropdownButton","SystemIcons","Size","Z_INDEXES","defaultOnMouseDownHandler","IconButton","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Row","div","props","generateToken","componentType","defaultVariant","theme","state","hover","active","Regular","RightIcon","ListRow","_ref","size","Medium","variant","icon","mainText","secondaryText","dropdown","note","noteTooltip","disabled","action","rightSideIcon","rightSideAction","rightSideIconDisabled","className","rest","_objectWithoutProperties","_excluded","inAction","setInAction","useState","handleKeyDown","e","key","preventDefault","rowClassName","concat","_objectSpread","tabIndex","role","undefined","onMouseDown","onKeyDown","onClick","children","label","Large","Small","XSmall","position","withArrow","onMouseEnter","onMouseLeave","type","ArrowDropDown","MoreVertical","shape","propTypes","_pt","oneOf","node","string","isRequired","oneOfType","bool","func"],"sources":["../../src/List/ListRow.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport {COLORS, ComponentTextStyle, focusStyles} from '../styles';\r\n\r\nimport {\r\n ComponentLStyling,\r\n ComponentMStyling,\r\n ComponentSStyling,\r\n ComponentXSStyling,\r\n ComponentXXSStyling\r\n} from '../styles';\r\nimport {DropdownButtonProps} from '../Dropdown/DropdownButtonTypes';\r\nimport {TooltipWrapper} from '../Tooltips';\r\nimport {DropdownButton} from '../Dropdown';\r\nimport {SystemIcons} from '../icons';\r\nimport {Size} from '../types';\r\nimport {Z_INDEXES} from '../styles';\r\nimport {defaultOnMouseDownHandler} from '../common';\r\nimport {IconButton} from '../Button';\r\n\r\nconst Row = styled.div`\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n border-bottom: 1px solid ${props => COLORS.generateToken({ componentType:'border', defaultVariant:'subtle' }, props.theme)};\r\n box-sizing: border-box;\r\n\r\n color: ${props => COLORS.generateToken({componentType:'text',defaultVariant:'subtle'}, props.theme)};\r\n background-color: ${props => COLORS.generateToken({componentType:'bg-surface', defaultVariant:'default'}, props.theme)};\r\n\r\n\r\n cursor: default;\r\n\r\n &.interactive {\r\n cursor: pointer;\r\n }\r\n\r\n &.interactive.disabled {\r\n cursor: not-allowed;\r\n }\r\n\r\n &.interactive:hover:not(.in-action):not(.disabled) {\r\n background-color: ${props => COLORS.generateToken({ componentType:'bg-surface', state:'hover' }, props.theme)};\r\n color: ${props => COLORS.generateToken({ componentType: 'text', state:'hover' }, props.theme)};\r\n z-index: ${Z_INDEXES.hover};\r\n }\r\n\r\n &.interactive:active:not(.in-action):not(.disabled) {\r\n background-color: ${props => COLORS.generateToken({ componentType:'bg-surface', state:'active' }, props.theme)};\r\n color: ${props => COLORS.generateToken({ componentType:'text', state:'active' }, props.theme)};\r\n z-index: ${Z_INDEXES.active};\r\n }\r\n\r\n &.interactive:focus {\r\n ${focusStyles}\r\n }\r\n\r\n &.disabled {\r\n .list-item-icon, .list-item-content, .list-item-note, .list-item-actions {\r\n color: ${props => COLORS.generateToken({ componentType: 'text', state: 'disabled' }, props.theme)};\r\n }\r\n }\r\n\r\n\r\n &.small {\r\n min-height: 48px;\r\n padding: 0 8px;\r\n\r\n .list-item-icon {\r\n margin-right: 8px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -8px;\r\n }\r\n }\r\n\r\n &.medium {\r\n min-height: 56px;\r\n padding: 0 12px;\r\n\r\n .list-item-icon {\r\n margin-right: 12px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentMStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -12px;\r\n }\r\n }\r\n\r\n &.large {\r\n min-height: 64px;\r\n padding: 0 16px;\r\n\r\n .list-item-icon {\r\n margin-right: 16px;\r\n }\r\n\r\n .list-item-main-text {\r\n ${ComponentLStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-actions {\r\n margin-right: -16px;\r\n }\r\n }\r\n\r\n &.overlay {\r\n padding: 0 4px;\r\n\r\n .list-item-actions {\r\n margin-right: -4px;\r\n }\r\n }\r\n\r\n .list-item-icon {\r\n width: 24px;\r\n height: 24px;\r\n\r\n svg {\r\n width: 24px;\r\n height: 24px;\r\n }\r\n }\r\n\r\n .list-item-content {\r\n flex-grow: 1;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n .list-item-main-text {\r\n }\r\n\r\n .list-item-secondary-text {\r\n ${ComponentXXSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-note {\r\n color: ${props => COLORS.generateToken({componentType:'text',defaultVariant:'subtle'}, props.theme)};\r\n word-break: initial;\r\n ${ComponentXSStyling(ComponentTextStyle.Regular, null)}\r\n }\r\n\r\n .list-item-note.with-tooltip {\r\n cursor: pointer;\r\n\r\n > div {\r\n text-decoration-line: underline;\r\n text-decoration-style: dashed;\r\n text-underline-offset: 1px;\r\n text-decoration-thickness: 1px;\r\n }\r\n }\r\n\r\n .list-item-actions {\r\n display: flex;\r\n align-items: center;\r\n\r\n button div {\r\n background-color: transparent;\r\n }\r\n }\r\n`;\r\n\r\nconst RightIcon = styled.div`\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n min-height: 48px;\r\n min-width: 48px;\r\n`;\r\n\r\n\r\nexport interface ListRowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex' | 'onMouseDown' | 'onKeyDown'> {\r\n /** Size of the ListRow. Defaults to 'medium'. */\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n /** Variant of the ListRow. Defaults to 'normal'. */\r\n variant?: 'normal' | 'overlay';\r\n /** Optional. Icon to be shown on the left side of the ListRow. */\r\n icon?: React.ReactNode;\r\n /** Required. Main text of the ListRow */\r\n mainText: string;\r\n /** Optional. Secondary row shown under MainText */\r\n secondaryText?: string;\r\n /** Optional. Details of the DropdownButton shown on the right side of the ListRow. */\r\n dropdown?: Pick<DropdownButtonProps, 'items' | 'onClick' | 'disabled' | 'width'>;\r\n /** Optional. Note to be shown on the right side of the component. */\r\n note?: string | React.ReactNode;\r\n /** Optional. Tooltip of the Note shown on the right side of the component. */\r\n noteTooltip?: string;\r\n /** Optional. If disabled then styles are greyed out and user can not interact with dropdown or click on the ListRow. */\r\n disabled?: boolean;\r\n /** Optional. Action to be executed when user clicks the row. */\r\n action?: () => void;\r\n /** Optional. Icon of the IconButton to show on the right side of the component */\r\n rightSideIcon?: React.ReactNode;\r\n /** Optional. Action to be executed when user clicks on the IconButton on the right */\r\n rightSideAction?: () => void;\r\n /** Optional. If disabled user will not be able to interact with IconButton shown on the right side */\r\n rightSideIconDisabled?: boolean;\r\n};\r\n\r\nconst ListRow: React.FunctionComponent<ListRowProps> = ({\r\n size = Size.Medium,\r\n variant = 'normal',\r\n icon,\r\n mainText,\r\n secondaryText,\r\n dropdown,\r\n note,\r\n noteTooltip,\r\n disabled = false,\r\n action,\r\n rightSideIcon,\r\n rightSideAction,\r\n rightSideIconDisabled,\r\n className,\r\n ...rest\r\n }: ListRowProps) => {\r\n\r\n const [inAction, setInAction] = React.useState<Boolean>(false);\r\n\r\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\r\n if (e.key === 'Enter' || e.key === ' ') {\r\n e.preventDefault();\r\n action && action();\r\n }\r\n }\r\n\r\n const rowClassName = (inAction ? 'in-action ' : '')\r\n .concat(disabled ? 'disabled ' : '')\r\n .concat(!!action ? 'interactive ' : '')\r\n .concat('list-item-row ')\r\n .concat(`${variant} `)\r\n .concat(`${size}`)\r\n .concat(className ? ` ${className}` : '');\r\n\r\n return (\r\n <Row tabIndex={!action || disabled ? -1 : 0}\r\n role={action ? 'button' : 'listitem'}\r\n aria-disabled={disabled || undefined}\r\n className={rowClassName}\r\n onMouseDown={defaultOnMouseDownHandler}\r\n onKeyDown={(e) => !disabled && handleKeyDown(e)}\r\n onClick={e => {\r\n !disabled && action && action();\r\n }}\r\n data-hj-suppress\r\n {...rest}>\r\n {\r\n !!icon &&\r\n <div className={'list-item-icon'} aria-hidden=\"true\">{icon}</div>\r\n }\r\n <div className={'list-item-content'}>\r\n <div className={'list-item-main-text'}>{mainText}</div>\r\n {!!secondaryText && <div className={'list-item-secondary-text'}>{secondaryText}</div>}\r\n </div>\r\n {\r\n !!note &&\r\n <>\r\n {\r\n !!noteTooltip &&\r\n <div className={'list-item-note with-tooltip'}>\r\n <TooltipWrapper label={noteTooltip}\r\n size={size === Size.Large ? Size.Medium : size === Size.Small ? Size.XSmall : Size.Small}\r\n position={'top'}\r\n tabIndex={disabled ? -1 : 0}\r\n withArrow={true}>\r\n {note}\r\n </TooltipWrapper>\r\n </div>\r\n }\r\n {\r\n !noteTooltip &&\r\n <div className={'list-item-note'}>\r\n {note}\r\n </div>\r\n }\r\n </>\r\n }\r\n {\r\n !!dropdown &&\r\n <div className={'list-item-actions'}\r\n onMouseEnter={() => setInAction(!dropdown?.disabled)}\r\n onMouseLeave={() => setInAction(false)}>\r\n <DropdownButton {...dropdown}\r\n type={'icon'}\r\n disabled={disabled || dropdown.disabled}\r\n icon={variant === 'overlay'\r\n ? <SystemIcons.ArrowDropDown/>\r\n : <SystemIcons.MoreVertical/>}\r\n />\r\n </div>\r\n }\r\n {\r\n !!rightSideIcon &&\r\n <RightIcon className={'list-item-actions'}\r\n onMouseEnter={() => rightSideAction && setInAction(!dropdown?.disabled)}\r\n onMouseLeave={() => rightSideAction && setInAction(false)}>\r\n {\r\n rightSideAction &&\r\n <IconButton action={rightSideAction} variant='secondary' shape='circular'\r\n disabled={disabled || rightSideIconDisabled}>\r\n {rightSideIcon}\r\n </IconButton>\r\n }\r\n {\r\n !rightSideAction && rightSideIcon\r\n }\r\n </RightIcon>\r\n }\r\n </Row>\r\n );\r\n};\r\n\r\nexport default ListRow;\r\n\r\n"],"mappings":";;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAAQC,MAAM,EAAEC,kBAAkB,EAAEC,WAAW,QAAO,WAAW;AAEjE,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,iBAAiB,EACjBC,kBAAkB,EAClBC,mBA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ACA,wBAAwBN,KAAK,IAAIvB,MAAM,CAACwB,aAAa,CAAC;EAAEC,aAAa,EAAC,YAAY;EAAEG,KAAK,EAAC;AAAS,CAAC,EAAEL,KAAK,CAACI,KAAK,CAAC;AAClH,aAAaJ,KAAK,IAAIvB,MAAM,CAACwB,aAAa,CAAC;EAAEC,aAAa,EAAC,MAAM;EAAEG,KAAK,EAAC;AAAS,CAAC,EAAEL,KAAK,CAACI,KAAK,CAAC;AACjG,eAAef,SAAS,CAACkB,MAAM;AAC/B;AACA;AACA;AACA,MAAM5B,WAAW;AACjB;AACA;AACA;AACA;AACA,eAAeqB,KAAK,IAAIvB,MAAM,CAACwB,aAAa,CAAC;EAAEC,aAAa,EAAE,MAAM;EAAEG,KAAK,EAAE;AAAW,CAAC,EAAEL,KAAK,CAACI,KAAK,CAAC;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQtB,iBAAiB,CAACJ,kBAAkB,CAAC8B,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ3B,iBAAiB,CAACH,kBAAkB,CAAC8B,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ5B,iBAAiB,CAACF,kBAAkB,CAAC8B,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMxB,mBAAmB,CAACN,kBAAkB,CAAC8B,OAAO,EAAE,IAAI,CAAC;AAC3D;AACA;AACA;AACA,aAAaR,KAAK,IAAIvB,MAAM,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