Skip to content

Commit

Permalink
Merge pull request #1190 from securityscorecard/next
Browse files Browse the repository at this point in the history
🚀 Next release
  • Loading branch information
ajkl2533 authored Nov 11, 2024
2 parents ce6c5e3 + 0bb3e5b commit cb2f137
Show file tree
Hide file tree
Showing 42 changed files with 1,180 additions and 205 deletions.
Binary file modified .storybook/image-snapshots/expected/components_Card_Dark Mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/components/ButtonV2/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const ButtonRoot = styled.button`
white-space: nowrap;
transition: var(--sscds-action-transition),
transform 50ms var(--sscds-transition-fn);
backdrop-filter: blur(2px);
/* Size dependent */
font-size: var(--sscds-button-font-size);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chip/Chip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Default as DefaultChipIcon } from './ChipIcon.stories';
* <Chip>
* <ChipIcon name="eye" />
* <ChipLabel isStrong>325</ChipLabel>
* <ChipLable>companies</ChipLable>
* <ChipLabel>companies</ChipLabel>
* </Chip>
* ```
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chip/InteractiveChip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Stack } from '../layout';
* <InteractiveChip as={Link} to="/scorecard" onClick={() => { trackEvent('navigate'); }}>
* <ChipIcon name="eye" />
* <ChipLabel isStrong>325</ChipLabel>
* <ChipLable>companies</ChipLable>
* <ChipLabel>companies</ChipLabel>
* </InteractiveChip>
* ```
* ## Using as links and with external routers
Expand Down
20 changes: 2 additions & 18 deletions src/components/DatatableV2/Datatable.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@tanstack/react-table';
import { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react';

import { IconNames, RegularIconTypes } from '../Icon';
import { RowAction } from '../_internal/buttons/RowActionsButton';

export type DatatableColumnDef<D, V = unknown> = Omit<
ColumnDef<D, V>,
Expand Down Expand Up @@ -179,22 +179,6 @@ export type DatatableHeaderGroup<D> = Omit<HeaderGroup<D>, 'headers'> & {
headers: DatatableHeader<D>[];
};

type RowActionCallbackUnion<D, Type> =
| Type
| ((props: { row: DatatableRow<D>; table: DatatableInstance<D> }) => Type);

export type DatatableRowAction<D> = null | {
label: RowActionCallbackUnion<D, string>;
iconName: RowActionCallbackUnion<D, IconNames>;
iconType?: RowActionCallbackUnion<D, RegularIconTypes>;
onClick(props: {
row: DatatableRow<D>;
table: DatatableInstance<D>;
}): (event: Event) => void;
isDisabled?: RowActionCallbackUnion<D, boolean>;
isDestructive?: boolean;
};

interface CustomState {
/** Opens column settings panel in table */
showColumnSettings: boolean;
Expand Down Expand Up @@ -553,7 +537,7 @@ export interface DatatableOptions<D>
* If only one action is provided it will be rendered directly in the column. If multiple actions
* are provided actions will be rendered in dropdown menu.
*/
rowActions?: DatatableRowAction<D>[];
rowActions?: RowAction<D>[];
/**
* Expected number of rows in the dataset which is used for displaying pagination correctly when
* pagination is not managed internally. This property is REQUIRED for the manual (managed,
Expand Down
72 changes: 0 additions & 72 deletions src/components/DatatableV2/buttons/RowActionsButton.tsx

This file was deleted.

8 changes: 6 additions & 2 deletions src/components/DatatableV2/hooks/useDisplayColumns.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useMemo } from 'react';
import { Row } from '@tanstack/react-table';

import ExpandAllButton from '../buttons/ExpandAllButton';
import ExpandButton from '../buttons/ExpandButton';
import RowActionsButton from '../buttons/RowActionsButton';
import SelectButton from '../buttons/SelectButton';
import { DatatableColumnDef, ParsedDatatableOptions } from '../Datatable.types';
import RowActionsButton from '../../_internal/buttons/RowActionsButton';

export const displayColumnIds = {
expand: 'ssc_dt_expand',
Expand Down Expand Up @@ -48,7 +49,10 @@ export const useDisplayColumns = <D,>(
id: displayColumnIds.actions,
header: '',
cell: ({ table, row }) => (
<RowActionsButton row={row} table={table} />
<RowActionsButton
instance={table}
row={row as unknown as Row<D>}
/>
),
size: 56,
...tableOptions.defaultDisplayColumn,
Expand Down
2 changes: 1 addition & 1 deletion src/components/DatatableV2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export type {
DatatableOptions,
DatatableInstance,
DatatableRow,
DatatableRowAction,
DatatableState,
} from './Datatable.types';
export type { RowAction as DatatableRowAction } from '../_internal/buttons/RowActionsButton';
81 changes: 0 additions & 81 deletions src/components/DatatableV2/menus/RowActionsMenu.tsx

This file was deleted.

12 changes: 8 additions & 4 deletions src/components/DatatableV2/table/TableSurface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import styled, { css } from 'styled-components';

import { Surface } from '../../layout';
import { DatatableInstance } from '../Datatable.types';
import Pagination from '../toolbar/Pagination';
import Selection from '../toolbar/Selection';
import Table from './Table';
import TopToolbar from '../toolbar/TopToolbar';
import SelectionToolbar from '../../_internal/toolbars/SelectionToolbar';
import PaginationToolbar from '../../_internal/toolbars/PaginationToolbar';

const DatatableRoot = styled.div<{ $isFullscreen }>`
${({ $isFullscreen }) =>
Expand Down Expand Up @@ -86,9 +86,13 @@ const TableSurface = <D,>({ table }: { table: DatatableInstance<D> }) => {
<Table table={table} />
</Surface>
{table.options.enableRowSelection &&
table.options.enableSelectionToolbar && <Selection table={table} />}
table.options.enableSelectionToolbar && (
<SelectionToolbar<D> instance={table} />
)}
{table.options.enablePagination &&
table.getRowModel().rows.length > 0 && <Pagination table={table} />}
table.getRowModel().rows.length > 0 && (
<PaginationToolbar instance={table} />
)}
</DatatableRoot>
);
};
Expand Down
Loading

0 comments on commit cb2f137

Please sign in to comment.