Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix markup in Table's column manager #2135

Merged
merged 27 commits into from
Jul 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e0995b7
Change DropdownMenu to Popover
r100-stack Jul 9, 2024
42d8018
Fixed unit tests
r100-stack Jul 9, 2024
3854ef5
Added hard-coded label
r100-stack Jul 9, 2024
c6f8c33
Remove isActive and controlled state
r100-stack Jul 9, 2024
2e8f0f7
Removed onClick
r100-stack Jul 9, 2024
1868a17
Add visually hidden legend
r100-stack Jul 9, 2024
b4eb444
create `FieldsetBase` component
mayank99 Jul 9, 2024
0f6fe3a
jsdocs
mayank99 Jul 9, 2024
e9224b1
major changeset
mayank99 Jul 9, 2024
6e778bc
Merge remote-tracking branch 'origin/mayank/fieldset-base' into r/rem…
r100-stack Jul 9, 2024
e6ba0e9
Added iui-table-column-manager class
r100-stack Jul 9, 2024
effb6c2
Remove Surface
r100-stack Jul 9, 2024
9caf424
nit: add `@ default`
r100-stack Jul 9, 2024
518a4e8
Changesets
r100-stack Jul 9, 2024
9325c8c
Rename onClick to onChange
r100-stack Jul 9, 2024
d85b46a
Approve image
r100-stack Jul 9, 2024
0a4ce4c
Show 8.5 items
r100-stack Jul 9, 2024
98e6955
Try using `Popover`'s props
r100-stack Jul 9, 2024
97c92c8
Add back div props
r100-stack Jul 9, 2024
c70bfbf
Merge branch 'main' into r/remove-aria-hidden-from-action-column-chec…
mayank99 Jul 10, 2024
c6adbb0
Removed accurate css styles
r100-stack Jul 10, 2024
5b8d1b8
Merge remote-tracking branch 'origin/r/remove-aria-hidden-from-action…
r100-stack Jul 10, 2024
cc4f808
Remove matchWidth
r100-stack Jul 10, 2024
6a14dbb
Changeset
r100-stack Jul 10, 2024
eea90e4
Use FieldsetBase component
r100-stack Jul 10, 2024
0f667e1
Changed to patch
r100-stack Jul 10, 2024
44138a4
Make sure fieldset is added
r100-stack Jul 10, 2024
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
62 changes: 33 additions & 29 deletions packages/itwinui-react/src/core/Table/columns/actionColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,32 @@
import * as React from 'react';
import type { HeaderProps } from '../../../react-table/react-table.js';
import { Checkbox } from '../../Checkbox/Checkbox.js';
import { SvgColumnManager } from '../../../utils/index.js';
import { DropdownMenu } from '../../DropdownMenu/DropdownMenu.js';
import { SvgColumnManager, type PortalProps } from '../../../utils/index.js';
import { IconButton } from '../../Buttons/IconButton.js';
import { MenuItem } from '../../Menu/MenuItem.js';
import { tableResizeStartAction } from '../Table.js';
import { SELECTION_CELL_ID } from './selectionColumn.js';
import { EXPANDER_CELL_ID } from './expanderColumn.js';
import { Popover, usePopover } from '../../Popover/Popover.js';
import { Surface } from '../../Surface/Surface.js';
import { Flex } from '../../Flex/Flex.js';

const ACTION_CELL_ID = 'iui-table-action';

type ActionColumnProps = {
columnManager?:
| boolean
| {
dropdownMenuProps: Omit<
React.ComponentPropsWithoutRef<typeof DropdownMenu>,
'menuItems' | 'children'
>;
dropdownMenuProps: React.ComponentPropsWithoutRef<'div'> & {
/**
* ARIA role. Role of menu. For menu use 'menu', for select use 'listbox'.
* @default 'menu'
*/
role?: string;
} & Pick<
Parameters<typeof usePopover>[0],
'visible' | 'onVisibleChange' | 'placement' | 'matchWidth'
> &
Pick<PortalProps, 'portal'>;
mayank99 marked this conversation as resolved.
Show resolved Hide resolved
};
};

Expand Down Expand Up @@ -94,45 +102,41 @@ export const ActionColumn = <T extends Record<string, unknown>>({
});
};
return (
<MenuItem
<Checkbox
key={column.id}
startIcon={
<Checkbox
checked={checked}
disabled={column.disableToggleVisibility}
onClick={(e) => e.stopPropagation()}
onChange={onClick}
aria-labelledby={`iui-column-${column.id}`}
/>
}
onClick={onClick}
checked={checked}
disabled={column.disableToggleVisibility}
>
<div id={`iui-column-${column.id}`}>
{column.render('Header')}
</div>
</MenuItem>
onClick={(e) => e.stopPropagation()}
mayank99 marked this conversation as resolved.
Show resolved Hide resolved
onChange={onClick}
label={column.render('Header')}
/>
);
});

const dropdownMenuProps =
const popoverProps =
typeof columnManager !== 'boolean'
? columnManager.dropdownMenuProps
: {};

return (
<DropdownMenu
{...dropdownMenuProps}
menuItems={headerCheckBoxes}
<Popover
content={
<Surface as={'fieldset'}>
mayank99 marked this conversation as resolved.
Show resolved Hide resolved
<Flex flexDirection='column' alignItems='flex-start'>
{headerCheckBoxes()}
</Flex>
</Surface>
}
{...popoverProps}
onVisibleChange={(open) => {
setIsOpen(open);
dropdownMenuProps?.onVisibleChange?.(open);
popoverProps?.onVisibleChange?.(open);
}}
mayank99 marked this conversation as resolved.
Show resolved Hide resolved
>
<IconButton styleType='borderless' isActive={isOpen} ref={buttonRef}>
mayank99 marked this conversation as resolved.
Show resolved Hide resolved
<SvgColumnManager />
</IconButton>
</DropdownMenu>
</Popover>
);
},
};
Expand Down
Loading