Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { DefinitionTooltip, Tooltip } from '@carbon/react';
import { Tooltip } from '@carbon/react';
import warning from 'warning';

import { settings } from '../../../constants/Settings';
import { WrapCellTextPropTypes } from '../../../constants/SharedPropTypes';
import { DefinitionTooltip } from '../../Tooltip';

const { iotPrefix } = settings;

Expand Down Expand Up @@ -91,6 +92,8 @@ const TableCellRenderer = ({
id="table-header-tooltip"
align={tooltipDirection}
openOnHover
tooltipText={tooltip}
as="a"
>
{element}
</DefinitionTooltip>
Expand Down
12 changes: 1 addition & 11 deletions packages/react/src/components/Table/TableHead/ColumnResize.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ const propTypes = {
paddingExtra: PropTypes.number.isRequired,
preserveColumnWidths: PropTypes.bool.isRequired,
showExpanderColumn: PropTypes.bool.isRequired,
resizeColumnText: PropTypes.string,
};

const defaultProps = {
resizeColumnText: 'Resize column',
};

const dragHandleWidth = 4;
Expand Down Expand Up @@ -96,7 +91,6 @@ const ColumnResize = React.forwardRef((props, ref) => {
paddingExtra,
showExpanderColumn,
preserveColumnWidths,
resizeColumnText,
} = props;
const [startX, setStartX] = useState(0);
const [leftPosition, setLeftPosition] = useState(0);
Expand Down Expand Up @@ -175,11 +169,8 @@ const ColumnResize = React.forwardRef((props, ref) => {
}));

return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this clickable? Why all the rules to disable interaction?
Also, why isn't it a button?

<div
role="button"
tabIndex="0"
aria-label={resizeColumnText}
onClick={(e) => e.stopPropagation()}
onMouseDown={(e) => onMouseDown(e)}
style={{
Expand All @@ -194,6 +185,5 @@ const ColumnResize = React.forwardRef((props, ref) => {
});

ColumnResize.propTypes = propTypes;
ColumnResize.defaultProps = defaultProps;

export default ColumnResize;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
&:hover {
background-color: $layer-selected-inverse;
}
&:focus {
background-color: $layer-selected-inverse;
outline: $spacing-01 solid $focus;
outline-offset: -$spacing-01;
}
}

.#{$iot-prefix}--column-resize-handle--dragging {
Expand Down
12 changes: 4 additions & 8 deletions packages/react/src/components/Table/TableHead/_table-head.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
}
}

th[aria-sort] span.#{$prefix}--popover-container {
padding-left: 1rem;
}

th button.#{$prefix}--definition-term {
font-weight: 600;
}
Expand Down Expand Up @@ -255,16 +251,16 @@
}

.#{$prefix}--table-sort {
padding-left: 0;
padding-right: 0;
// padding-left: 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed if not needed

padding-inline-start: 1rem;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
padding-inline-start: 1rem;
padding-inline-start: $spacing-05;


.#{$prefix}--table-header-label,
.#{$prefix}--tooltip--definition {
padding-left: $spacing-05;
padding-left: 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using padding-inline-start instead

padding-right: 0;
text-decoration: none;

[dir='rtl'] & {
padding-left: unset;
padding-right: $spacing-05;
}
}
Expand Down
134 changes: 67 additions & 67 deletions packages/react/src/components/Table/TableToolbar/TableToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,73 +328,6 @@ const TableToolbar = ({
className={classnames(`${iotPrefix}--table-toolbar`, className)}
aria-label={i18n.toolbarLabelAria}
>
{hasBatchActionToolbar ? (
<TableBatchActions
// TODO: remove deprecated 'testID' in v3
data-testid={`${testID || testId}-batch-actions`}
className={`${iotPrefix}--table-batch-actions`}
onCancel={onCancelBatchAction}
shouldShowBatchActions={shouldShowBatchActions}
totalSelected={totalSelected}
translateWithId={(...args) => tableTranslateWithId(i18n, ...args)}
>
{hasVisibleBatchActions &&
visibleBatchActions.map(({ id, labelText, disabled, ...others }) => (
<TableBatchAction
key={id}
onClick={() => onApplyBatchAction(id)}
tabIndex={shouldShowBatchActions ? 0 : -1}
disabled={!shouldShowBatchActions || disabled}
{...others}
>
{labelText}
</TableBatchAction>
))}
{hasVisibleOverflowBatchActions ? (
<OverflowMenu
data-testid={`${testID || testId}-batch-actions-overflow-menu`}
className={`${iotPrefix}--table-overflow-batch-actions`}
flipped={langDir === 'ltr'}
direction="bottom"
onClick={(e) => e.stopPropagation()}
renderIcon={(props) => <OverflowMenuVertical size={16} {...props} />}
tabIndex={shouldShowBatchActions ? 0 : -1}
size="md"
menuOptionsClass={`${iotPrefix}--table-overflow-batch-actions__menu`}
withCarbonTooltip
tooltipPosition="bottom"
buttonLabel={i18n.batchActionsOverflowMenuText}
>
{visibleOverflowBatchActions.map(
({
id,
labelText,
disabled,
hasDivider,
isDelete,
renderIcon,
iconDescription,
}) => (
<OverflowMenuItem
data-testid={`${testID || testId}-batch-actions-overflow-menu-item-${id}`}
itemText={renderTableOverflowItemText({
action: { renderIcon, labelText: labelText || iconDescription },
className: `${iotPrefix}--table-toolbar-aggregations__overflow-menu-content`,
})}
disabled={!shouldShowBatchActions || disabled}
onClick={() => onApplyBatchAction(id)}
key={`table-batch-actions-overflow-menu-${id}`}
requireTitle={!renderIcon}
hasDivider={hasDivider}
isDelete={isDelete}
aria-label={labelText}
/>
)
)}
</OverflowMenu>
) : null}
</TableBatchActions>
) : null}
{secondaryTitle ? (
// eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for
<label className={`${iotPrefix}--table-toolbar-secondary-title`}>{secondaryTitle}</label>
Expand Down Expand Up @@ -613,6 +546,73 @@ const TableToolbar = ({
}
</TableToolbarContent>
)}
{hasBatchActionToolbar ? (
<TableBatchActions
// TODO: remove deprecated 'testID' in v3
data-testid={`${testID || testId}-batch-actions`}
className={`${iotPrefix}--table-batch-actions`}
onCancel={onCancelBatchAction}
shouldShowBatchActions={shouldShowBatchActions}
totalSelected={totalSelected}
translateWithId={(...args) => tableTranslateWithId(i18n, ...args)}
>
{hasVisibleBatchActions &&
visibleBatchActions.map(({ id, labelText, disabled, ...others }) => (
<TableBatchAction
key={id}
onClick={() => onApplyBatchAction(id)}
tabIndex={shouldShowBatchActions ? 0 : -1}
disabled={!shouldShowBatchActions || disabled}
{...others}
>
{labelText}
</TableBatchAction>
))}
{hasVisibleOverflowBatchActions ? (
<OverflowMenu
data-testid={`${testID || testId}-batch-actions-overflow-menu`}
className={`${iotPrefix}--table-overflow-batch-actions`}
flipped={langDir === 'ltr'}
direction="bottom"
onClick={(e) => e.stopPropagation()}
renderIcon={(props) => <OverflowMenuVertical size={16} {...props} />}
tabIndex={shouldShowBatchActions ? 0 : -1}
size="md"
menuOptionsClass={`${iotPrefix}--table-overflow-batch-actions__menu`}
withCarbonTooltip
tooltipPosition="bottom"
buttonLabel={i18n.batchActionsOverflowMenuText}
>
{visibleOverflowBatchActions.map(
({
id,
labelText,
disabled,
hasDivider,
isDelete,
renderIcon,
iconDescription,
}) => (
<OverflowMenuItem
data-testid={`${testID || testId}-batch-actions-overflow-menu-item-${id}`}
itemText={renderTableOverflowItemText({
action: { renderIcon, labelText: labelText || iconDescription },
className: `${iotPrefix}--table-toolbar-aggregations__overflow-menu-content`,
})}
disabled={!shouldShowBatchActions || disabled}
onClick={() => onApplyBatchAction(id)}
key={`table-batch-actions-overflow-menu-${id}`}
requireTitle={!renderIcon}
hasDivider={hasDivider}
isDelete={isDelete}
aria-label={labelText}
/>
)
)}
</OverflowMenu>
) : null}
</TableBatchActions>
) : null}
</CarbonTableToolbar>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ div.#{$prefix}--toolbar-action.#{$prefix}--toolbar-search-container-expandable {
will-change: transform;
}

.#{$prefix}--batch-actions.#{$prefix}--batch-actions--active.iot--table-batch-actions {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.#{$prefix}--batch-actions.#{$prefix}--batch-actions--active.iot--table-batch-actions {
.#{$prefix}--batch-actions.#{$prefix}--batch-actions--active.#{$iot-prefix}--table-batch-actions {

z-index: 2;
}

.#{$iot-prefix}--table-toolbar-content {
flex: 1;
font-size: 0.875rem;
Expand Down Expand Up @@ -166,15 +170,13 @@ html[dir='rtl'] {
}
}

.#{$iot-prefix}--table-overflow-batch-actions {
.#{$prefix}--table-toolbar
.#{$prefix}--tooltip-trigger__wrapper
.#{$iot-prefix}--table-overflow-batch-actions {
&.#{$prefix}--overflow-menu--open,
&.#{$prefix}--overflow-menu--open:hover,
&:hover {
// background-color: $hover-primary;//$$hover-primary;
}

&:focus {
outline: 2px solid $layer-01;
outline: $spacing-01 solid $layer-01;
outline-offset: -($spacing-01);
}

Expand Down
Loading
Loading