Skip to content

Commit

Permalink
chore: not extending html props from paste types
Browse files Browse the repository at this point in the history
  • Loading branch information
SiTaggart committed Oct 3, 2023
1 parent a4a7b13 commit 2d60e24
Show file tree
Hide file tree
Showing 18 changed files with 5,533 additions and 830 deletions.
6 changes: 6 additions & 0 deletions .changeset/tender-parrots-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@twilio-paste/table": patch
"@twilio-paste/core": patch
---

[Table] Improved TsDoc type annotations
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
"author": "Twilio Inc.",
"license": "MIT",
"workspaces": {
"packages": ["apps/**/*", "packages/**/*", "templates/**/*", "!packages/paste-core/core-bundle/**/*"]
"packages": [
"apps/**/*",
"packages/**/*",
"templates/**/*",
"!packages/paste-core/core-bundle/**/*"
]
},
"types": "./types/index.d.ts",
"engines": {
Expand Down Expand Up @@ -222,5 +227,9 @@
}
},
"packageManager": "[email protected]",
"browserslist": ["last 2 versions", "not dead", "not IE 11"]
"browserslist": [
"last 2 versions",
"not dead",
"not IE 11"
]
}
23 changes: 13 additions & 10 deletions packages/paste-core/components/data-grid/src/DataGridCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,12 @@ import { DataGridContext } from "./DataGridContext";
import { Td } from "./table/Td";
import type { TdProps } from "./table/Td";
import { Th } from "./table/Th";
import type { ThProps } from "./table/Th";
import { ensureFocus, isCell, updateTabIndexForActionable } from "./utils";

// This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export

type CellType = "th" | "td";
export interface DataGridCellProps extends Pick<TdProps, "textAlign"> {
/**
* Cells can either be th or td, so rows can have headers.
*
* @type {CellType}
* @memberof DataGridCellProps
*/
as?: CellType;
export type DataGridCellBasePropsProps = {
/**
* Overrides the default element name to apply unique styles with the Customization Provider
*
Expand All @@ -36,7 +29,17 @@ export interface DataGridCellProps extends Pick<TdProps, "textAlign"> {
* @memberof DataGridCellProps
*/
colSpan?: number;
}
};
type DataGridCellAsThProps = ThProps &
DataGridCellBasePropsProps & {
as?: "th";
};
type DataGridCellAsTdProps = TdProps &
DataGridCellBasePropsProps & {
as?: "td";
};

export type DataGridCellProps = DataGridCellAsThProps | DataGridCellAsTdProps;

/**
* DataGrid cell component. Every visible box in a data grid is powered by the cell.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { BoxProps } from "@twilio-paste/box";
import { Button } from "@twilio-paste/button";
import type { ButtonProps } from "@twilio-paste/button";
import { ArrowDownIcon } from "@twilio-paste/icons/esm/ArrowDownIcon";
import { ArrowUpIcon } from "@twilio-paste/icons/esm/ArrowUpIcon";
import { UnsortedIcon } from "@twilio-paste/icons/esm/UnsortedIcon";
import { ScreenReaderOnly } from "@twilio-paste/screen-reader-only";
import type { HTMLPasteProps } from "@twilio-paste/types";
import * as React from "react";

export type SortDirection = "ascending" | "descending" | "none";
Expand Down Expand Up @@ -37,7 +39,7 @@ const DataGridHeaderSortIcon: React.FC<React.PropsWithChildren<DataGridHeaderSor

DataGridHeaderSortIcon.displayName = "DataGridHeaderSortIcon";

export interface DataGridHeaderSortProps extends DataGridHeaderSortIconProps {
export interface DataGridHeaderSortProps extends HTMLPasteProps<"button">, DataGridHeaderSortIconProps {
/**
* Overrides the default element name to apply unique styles with the Customization Provider
*
Expand Down Expand Up @@ -76,6 +78,7 @@ export interface DataGridHeaderSortProps extends DataGridHeaderSortIconProps {
* @memberof DataGridHeaderSortProps
*/
i18nUnsortedLabel?: string;
tabIndex?: ButtonProps["tabIndex"];
}

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/paste-core/components/data-grid/src/DataGridRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import * as React from "react";

import { DataGridContext } from "./DataGridContext";
import { Tr } from "./table/Tr";
import type { TrProps } from "./table/Tr";

export interface DataGridRowProps {
export interface DataGridRowProps extends TrProps {
children: NonNullable<React.ReactNode>;
/**
* Visally displays a row highlight indicating selection and sets `aria-selected`
Expand Down
Loading

0 comments on commit 2d60e24

Please sign in to comment.