@react-types/table
Advanced tools
Comparing version 3.0.0-nightly.2904 to 3.0.0-nightly-4980928d3-240906
{ | ||
"name": "@react-types/table", | ||
"version": "3.0.0-nightly.2904+e14523fed", | ||
"version": "3.0.0-nightly-4980928d3-240906", | ||
"description": "Spectrum UI components in React", | ||
@@ -12,7 +12,7 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-types/grid": "3.0.0-nightly.2904+e14523fed", | ||
"@react-types/shared": "3.0.0-nightly.1219+e14523fed" | ||
"@react-types/grid": "^3.0.0-nightly-4980928d3-240906", | ||
"@react-types/shared": "^3.0.0-nightly-4980928d3-240906" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0-rc.1" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
}, | ||
@@ -22,3 +22,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "e14523fedd93ac1a4ede355aed70988af572ae74" | ||
} | ||
"stableVersion": "3.10.1" | ||
} |
@@ -13,6 +13,17 @@ /* | ||
import {AriaLabelingProps, AsyncLoadable, CollectionChildren, DOMProps, LoadingState, MultipleSelection, Sortable, StyleProps} from '@react-types/shared'; | ||
import {AriaLabelingProps, AsyncLoadable, DOMProps, Key, LinkDOMProps, LoadingState, MultipleSelection, Sortable, SpectrumSelectionProps, StyleProps} from '@react-types/shared'; | ||
import {GridCollection, GridNode} from '@react-types/grid'; | ||
import {Key, ReactElement, ReactNode} from 'react'; | ||
import {JSX, ReactElement, ReactNode} from 'react'; | ||
/** Widths that result in a constant pixel value for the same Table width. */ | ||
export type ColumnStaticSize = number | `${number}` | `${number}%`; // match regex: /^(\d+)(?=%$)/ | ||
/** | ||
* Widths that change size in relation to the remaining space and in ratio to other dynamic columns. | ||
* All numbers must be integers and greater than 0. | ||
* FR units take up remaining, if any, space in the table. | ||
*/ | ||
export type ColumnDynamicSize = `${number}fr`; // match regex: /^(\d+)(?=fr$)/ | ||
/** All possible sizes a column can be assigned. */ | ||
export type ColumnSize = ColumnStaticSize | ColumnDynamicSize; | ||
export interface TableProps<T> extends MultipleSelection, Sortable { | ||
@@ -25,3 +36,6 @@ /** The elements that make up the table. Includes the TableHeader, TableBody, Columns, and Rows. */ | ||
export interface SpectrumTableProps<T> extends TableProps<T>, DOMProps, AriaLabelingProps, StyleProps { | ||
/** | ||
* @deprecated - use SpectrumTableProps from '@adobe/react-spectrum' instead. | ||
*/ | ||
export interface SpectrumTableProps<T> extends TableProps<T>, SpectrumSelectionProps, DOMProps, AriaLabelingProps, StyleProps { | ||
/** | ||
@@ -40,3 +54,20 @@ * Sets the amount of vertical padding within each cell. | ||
/** Sets what the TableView should render when there is no content to display. */ | ||
renderEmptyState?: () => JSX.Element | ||
renderEmptyState?: () => JSX.Element, | ||
/** Handler that is called when a user performs an action on a row. */ | ||
onAction?: (key: Key) => void, | ||
/** | ||
* Handler that is called when a user starts a column resize. | ||
*/ | ||
onResizeStart?: (widths: Map<Key, ColumnSize>) => void, | ||
/** | ||
* Handler that is called when a user performs a column resize. | ||
* Can be used with the width property on columns to put the column widths into | ||
* a controlled state. | ||
*/ | ||
onResize?: (widths: Map<Key, ColumnSize>) => void, | ||
/** | ||
* Handler that is called after a user performs a column resize. | ||
* Can be used to store the widths of columns for another future session. | ||
*/ | ||
onResizeEnd?: (widths: Map<Key, ColumnSize>) => void | ||
} | ||
@@ -61,8 +92,11 @@ | ||
/** The width of the column. */ | ||
width?: number | string, | ||
width?: ColumnSize | null, | ||
/** The minimum width of the column. */ | ||
minWidth?: number | string, | ||
minWidth?: ColumnStaticSize | null, | ||
/** The maximum width of the column. */ | ||
maxWidth?: number | string, | ||
// defaultWidth?: number | string | ||
maxWidth?: ColumnStaticSize | null, | ||
/** The default width of the column. */ | ||
defaultWidth?: ColumnSize | null, | ||
/** Whether the column allows resizing. */ | ||
allowsResizing?: boolean, | ||
/** Whether the column allows sorting. */ | ||
@@ -95,5 +129,6 @@ allowsSorting?: boolean, | ||
export type RowElement<T> = ReactElement<RowProps<T>>; | ||
export interface TableBodyProps<T> extends Omit<AsyncLoadable, 'isLoading'> { | ||
/** The contents of the table body. Supports static items or a function for dynamic rendering. */ | ||
children: CollectionChildren<T>, | ||
children: RowElement<T> | RowElement<T>[] | ((item: T) => RowElement<T>), | ||
/** A list of row objects in the table body used when dynamically rendering rows. */ | ||
@@ -105,6 +140,11 @@ items?: Iterable<T>, | ||
export interface RowProps { | ||
// treeble case? Unsupported props for now | ||
// /** A list of child item objects used when dynamically rendering row children. */ | ||
// childItems?: Iterable<T>, | ||
export interface RowProps<T> extends LinkDOMProps { | ||
/** | ||
* A list of child item objects used when dynamically rendering row children. Requires the feature flag to be | ||
* enabled along with UNSTABLE_allowsExpandableRows, see https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows. | ||
* @version alpha | ||
* @private | ||
*/ | ||
UNSTABLE_childItems?: Iterable<T>, | ||
// TODO: update when async loading is supported for expandable rows | ||
// /** Whether this row has children, even if not loaded yet. */ | ||
@@ -129,3 +169,3 @@ // hasChildItems?: boolean, | ||
export interface TableCollection<T> extends GridCollection<T> { | ||
// TODO perhaps elaborate on this? maybe not clear enought, essentially returns the table header rows (e.g. in a tiered headers table, will return the nodes containing the top tier column, next tier, etc) | ||
// TODO perhaps elaborate on this? maybe not clear enough, essentially returns the table header rows (e.g. in a tiered headers table, will return the nodes containing the top tier column, next tier, etc) | ||
/** A list of header row nodes in the table. */ | ||
@@ -137,4 +177,6 @@ headerRows: GridNode<T>[], | ||
rowHeaderColumnKeys: Set<Key>, | ||
/** The node that makes up the header of the table. */ | ||
head?: GridNode<T>, | ||
/** The node that makes up the body of the table. */ | ||
body: GridNode<T> | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
162
0
8626
3
+ Added@react-types/grid@3.2.10(transitive)
+ Added@react-types/shared@3.26.0(transitive)
+ Addedreact@19.0.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedreact@17.0.2(transitive)