@particle-network/ui-react 0.7.0-beta.6 → 0.7.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/components/ProgressWrapper/index.js +1 -1
  2. package/dist/components/UXColorPicker/color-fields.js +1 -1
  3. package/dist/components/UXSimplePopover/simple-popover.js +1 -1
  4. package/dist/components/UXTable/base/index.d.ts +10 -0
  5. package/dist/components/UXTable/base/index.js +6 -0
  6. package/dist/components/UXTable/base/table-body.d.ts +20 -0
  7. package/dist/components/UXTable/base/table-body.js +4 -0
  8. package/dist/components/UXTable/base/table-cell.d.ts +6 -0
  9. package/dist/components/UXTable/base/table-cell.js +4 -0
  10. package/dist/components/UXTable/base/table-column.d.ts +6 -0
  11. package/dist/components/UXTable/base/table-column.js +4 -0
  12. package/dist/components/UXTable/base/table-header.d.ts +6 -0
  13. package/dist/components/UXTable/base/table-header.js +4 -0
  14. package/dist/components/UXTable/base/table-row.d.ts +6 -0
  15. package/dist/components/UXTable/base/table-row.js +4 -0
  16. package/dist/components/UXTable/index.d.ts +7 -37
  17. package/dist/components/UXTable/index.js +5 -14
  18. package/dist/components/UXTable/table-body.d.ts +15 -0
  19. package/dist/components/UXTable/table-body.js +87 -0
  20. package/dist/components/UXTable/table-cell.d.ts +19 -0
  21. package/dist/components/UXTable/table-cell.js +45 -0
  22. package/dist/components/UXTable/table-checkbox-cell.d.ts +23 -0
  23. package/dist/components/UXTable/table-checkbox-cell.js +48 -0
  24. package/dist/components/UXTable/table-column-header.d.ts +25 -0
  25. package/dist/components/UXTable/table-column-header.js +66 -0
  26. package/dist/components/UXTable/table-header-row.d.ts +14 -0
  27. package/dist/components/UXTable/table-header-row.js +29 -0
  28. package/dist/components/UXTable/table-row-group.d.ts +8 -0
  29. package/dist/components/UXTable/table-row-group.js +24 -0
  30. package/dist/components/UXTable/table-row.d.ts +15 -0
  31. package/dist/components/UXTable/table-row.js +61 -0
  32. package/dist/components/UXTable/table-select-all-checkbox.d.ts +18 -0
  33. package/dist/components/UXTable/table-select-all-checkbox.js +46 -0
  34. package/dist/components/UXTable/table-theme.d.ts +452 -0
  35. package/dist/components/UXTable/table-theme.js +282 -0
  36. package/dist/components/UXTable/table.d.ts +8 -0
  37. package/dist/components/UXTable/table.js +96 -0
  38. package/dist/components/UXTable/use-table.d.ts +145 -0
  39. package/dist/components/UXTable/use-table.js +127 -0
  40. package/dist/components/UXTable/virtualized-table-body.d.ts +17 -0
  41. package/dist/components/UXTable/virtualized-table-body.js +107 -0
  42. package/dist/components/UXTable/virtualized-table.d.ts +8 -0
  43. package/dist/components/UXTable/virtualized-table.js +115 -0
  44. package/dist/components/UXThemeSwitch/theme-switch.js +2 -1
  45. package/package.json +9 -3
  46. package/dist/components/UXTable/table.extend.d.ts +0 -34
  47. package/dist/components/UXTable/table.extend.js +0 -145
@@ -82,7 +82,7 @@ const ProgressWrapper = ({ className, value = 0, width, height, radius = 'sm', s
82
82
  ...restProps,
83
83
  children: [
84
84
  /*#__PURE__*/ jsxs("svg", {
85
- className: cn('absolute left-0 top-0', svgClassName),
85
+ className: cn('absolute top-0 left-0', svgClassName),
86
86
  width: widthValue,
87
87
  height: heightValue,
88
88
  children: [
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useCallback, useState } from "react";
4
- import { Switch3Icon } from "@particle-network/icons/web";
4
+ import Switch3Icon from "@particle-network/icons/web/Switch3Icon";
5
5
  import { Flex, VStack } from "../layout/index.js";
6
6
  import { Text } from "../typography/Text.js";
7
7
  import { UXButton } from "../UXButton/index.js";
@@ -105,7 +105,7 @@ const UXSimplePopover = (props)=>{
105
105
  ref: popoverRef,
106
106
  id: popoverId,
107
107
  popover: isClick ? 'auto' : 'manual',
108
- className: cn('bg-content1 text-foreground-300 shadow-box text-tiny leading-1.4 wrap-break-word rounded-medium max-w-[300px] break-words p-2.5 antialiased', classNames.content),
108
+ className: cn('bg-content1 text-foreground-300 shadow-box text-tiny leading-1.4 rounded-medium max-w-[300px] p-2.5 break-words wrap-break-word antialiased', classNames.content),
109
109
  style: popoverAnchorStyle,
110
110
  children: content
111
111
  })
@@ -0,0 +1,10 @@
1
+ export { default as TableBody } from './table-body';
2
+ export { default as TableCell } from './table-cell';
3
+ export { default as TableColumn } from './table-column';
4
+ export { default as TableHeader } from './table-header';
5
+ export { default as TableRow } from './table-row';
6
+ export type { TableBodyProps } from './table-body';
7
+ export type { TableCellProps } from './table-cell';
8
+ export type { TableColumnProps } from './table-column';
9
+ export type { TableHeaderProps } from './table-header';
10
+ export type { TableRowProps } from './table-row';
@@ -0,0 +1,6 @@
1
+ import table_body from "./table-body.js";
2
+ import table_cell from "./table-cell.js";
3
+ import table_column from "./table-column.js";
4
+ import table_header from "./table-header.js";
5
+ import table_row from "./table-row.js";
6
+ export { table_body as TableBody, table_cell as TableCell, table_column as TableColumn, table_header as TableHeader, table_row as TableRow };
@@ -0,0 +1,20 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { HTMLHeroUIProps } from '@heroui/system';
3
+ import type { TableBodyProps as TableBodyBaseProps } from '@react-types/table';
4
+ export interface TableBodyProps<T> extends TableBodyBaseProps<T>, Omit<HTMLHeroUIProps<'tbody'>, keyof TableBodyBaseProps<T>> {
5
+ /**
6
+ * Provides content to display a loading component when the `loadingState` is `loading` or `loadingMore`.
7
+ */
8
+ loadingContent?: ReactNode;
9
+ /**
10
+ * Whether the table data is currently loading.
11
+ * @default false
12
+ */
13
+ isLoading?: boolean;
14
+ /**
15
+ * Provides content to display when there are no rows in the table.
16
+ * */
17
+ emptyContent?: ReactNode;
18
+ }
19
+ declare const TableBody: <T>(props: TableBodyProps<T>) => JSX.Element;
20
+ export default TableBody;
@@ -0,0 +1,4 @@
1
+ import { TableBody } from "@react-stately/table";
2
+ const table_body_TableBody = TableBody;
3
+ const table_body = table_body_TableBody;
4
+ export { table_body as default };
@@ -0,0 +1,6 @@
1
+ import type { JSX } from 'react';
2
+ import type { HTMLHeroUIProps } from '@heroui/system';
3
+ import type { CellProps } from '@react-types/table';
4
+ export type TableCellProps = CellProps & HTMLHeroUIProps<'td'>;
5
+ declare const TableCell: (props: TableCellProps) => JSX.Element;
6
+ export default TableCell;
@@ -0,0 +1,4 @@
1
+ import { Cell } from "@react-stately/table";
2
+ const TableCell = Cell;
3
+ const table_cell = TableCell;
4
+ export { table_cell as default };
@@ -0,0 +1,6 @@
1
+ import type { JSX } from 'react';
2
+ import type { HTMLHeroUIProps } from '@heroui/system';
3
+ import type { SpectrumColumnProps } from '@react-types/table';
4
+ export type TableColumnProps<T> = Omit<SpectrumColumnProps<T>, 'showDivider'> & Omit<HTMLHeroUIProps<'th'>, keyof SpectrumColumnProps<T>>;
5
+ declare const TableColumn: <T>(props: TableColumnProps<T>) => JSX.Element;
6
+ export default TableColumn;
@@ -0,0 +1,4 @@
1
+ import { Column } from "@react-stately/table";
2
+ const TableColumn = Column;
3
+ const table_column = TableColumn;
4
+ export { table_column as default };
@@ -0,0 +1,6 @@
1
+ import type { JSX } from 'react';
2
+ import type { HTMLHeroUIProps } from '@heroui/system';
3
+ import type { TableHeaderProps as TableHeaderBaseProps } from '@react-types/table';
4
+ export type TableHeaderProps<T> = TableHeaderBaseProps<T> & Omit<HTMLHeroUIProps<'thead'>, keyof TableHeaderBaseProps<T>>;
5
+ declare const TableHeader: <T>(props: TableHeaderProps<T>) => JSX.Element;
6
+ export default TableHeader;
@@ -0,0 +1,4 @@
1
+ import { TableHeader } from "@react-stately/table";
2
+ const table_header_TableHeader = TableHeader;
3
+ const table_header = table_header_TableHeader;
4
+ export { table_header as default };
@@ -0,0 +1,6 @@
1
+ import type { JSX } from 'react';
2
+ import type { HTMLHeroUIProps } from '@heroui/system';
3
+ import type { RowProps } from '@react-types/table';
4
+ export type TableRowProps<T = object> = RowProps<T> & Omit<HTMLHeroUIProps<'tr'>, keyof RowProps<T>>;
5
+ declare const TableRow: (props: TableRowProps) => JSX.Element;
6
+ export default TableRow;
@@ -0,0 +1,4 @@
1
+ import { Row } from "@react-stately/table";
2
+ const TableRow = Row;
3
+ const table_row = TableRow;
4
+ export { table_row as default };
@@ -1,37 +1,7 @@
1
- import React from 'react';
2
- import ExtendedTable from './table.extend';
3
- export type UXTableProps = React.ComponentPropsWithRef<typeof ExtendedTable>;
4
- export declare const UXTable: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"table", (Omit<import("@heroui/system-rsc").OmitCommonProps<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref">, keyof import("@heroui/table").TableProps<object>> & import("@heroui/table").TableProps<object> & {
5
- as?: import("@heroui/system-rsc").As<any> | undefined;
6
- } & {
7
- color?: "default" | undefined;
8
- size?: "md" | "lg" | undefined;
9
- layout?: "auto" | "fixed" | undefined;
10
- radius?: "sm" | "md" | "lg" | "none" | undefined;
11
- shadow?: "sm" | "md" | "lg" | "none" | undefined;
12
- hideHeader?: boolean | undefined;
13
- isStriped?: boolean | undefined;
14
- isCompact?: boolean | undefined;
15
- isHeaderSticky?: boolean | undefined;
16
- isSelectable?: boolean | undefined;
17
- isMultiSelectable?: boolean | undefined;
18
- fullWidth?: boolean | undefined;
19
- align?: "start" | "end" | "center" | undefined;
20
- }, "ref"> | Omit<import("@heroui/system-rsc").OmitCommonProps<Omit<Omit<any, "ref">, never>, keyof import("@heroui/table").TableProps<object>> & import("@heroui/table").TableProps<object> & {
21
- as?: import("@heroui/system-rsc").As<any> | undefined;
22
- } & {
23
- color?: "default" | undefined;
24
- size?: "md" | "lg" | undefined;
25
- layout?: "auto" | "fixed" | undefined;
26
- radius?: "sm" | "md" | "lg" | "none" | undefined;
27
- shadow?: "sm" | "md" | "lg" | "none" | undefined;
28
- hideHeader?: boolean | undefined;
29
- isStriped?: boolean | undefined;
30
- isCompact?: boolean | undefined;
31
- isHeaderSticky?: boolean | undefined;
32
- isSelectable?: boolean | undefined;
33
- isMultiSelectable?: boolean | undefined;
34
- fullWidth?: boolean | undefined;
35
- align?: "start" | "end" | "center" | undefined;
36
- }, "ref">) & React.RefAttributes<HTMLElement>, never>;
37
- export { TableBody as UXTableBody, TableCell as UXTableCell, TableColumn as UXTableColumn, TableHeader as UXTableHeader, TableRow as UXTableRow, } from '@heroui/table';
1
+ export type { TableProps as UXTableProps } from './table';
2
+ export type { DisabledBehavior, Selection, SelectionBehavior, SelectionMode, SortDescriptor, } from '@react-types/shared';
3
+ export { useTable } from './use-table';
4
+ export { getKeyValue } from '@heroui/shared-utils';
5
+ export { default as UXTable } from './table';
6
+ export type { TableBodyProps as UXTableBodyProps, TableCellProps as UXTableCellProps, TableColumnProps as UXTableColumnProps, TableHeaderProps as UXTableHeaderProps, TableRowProps as UXTableRowProps, } from './base';
7
+ export { TableBody as UXTableBody, TableCell as UXTableCell, TableColumn as UXTableColumn, TableHeader as UXTableHeader, TableRow as UXTableRow, } from './base';
@@ -1,14 +1,5 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import "react";
3
- import { forwardRef } from "@heroui/system";
4
- import table_extend from "./table.extend.js";
5
- import { TableBody, TableCell, TableColumn, TableHeader, TableRow } from "@heroui/table";
6
- const UXTable = forwardRef((props, ref)=>{
7
- const { selectionMode = 'single', ...restProps } = props;
8
- return /*#__PURE__*/ jsx(table_extend, {
9
- selectionMode: selectionMode,
10
- ...restProps,
11
- ref: ref
12
- });
13
- });
14
- export { UXTable, TableBody as UXTableBody, TableCell as UXTableCell, TableColumn as UXTableColumn, TableHeader as UXTableHeader, TableRow as UXTableRow };
1
+ import { useTable } from "./use-table.js";
2
+ import { getKeyValue } from "@heroui/shared-utils";
3
+ import table from "./table.js";
4
+ import { TableBody, TableCell, TableColumn, TableHeader, TableRow } from "./base/index.js";
5
+ export { table as UXTable, TableBody as UXTableBody, TableCell as UXTableCell, TableColumn as UXTableColumn, TableHeader as UXTableHeader, TableRow as UXTableRow, getKeyValue, useTable };
@@ -0,0 +1,15 @@
1
+ import type { HTMLHeroUIProps } from '@heroui/system';
2
+ import type { ValuesType } from './use-table';
3
+ export interface TableBodyProps extends HTMLHeroUIProps<'tbody'> {
4
+ slots: ValuesType['slots'];
5
+ collection: ValuesType['collection'];
6
+ state: ValuesType['state'];
7
+ isSelectable: ValuesType['isSelectable'];
8
+ color: ValuesType['color'];
9
+ disableAnimation: ValuesType['disableAnimation'];
10
+ checkboxesProps: ValuesType['checkboxesProps'];
11
+ selectionMode: ValuesType['selectionMode'];
12
+ classNames?: ValuesType['classNames'];
13
+ }
14
+ declare const TableBody: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"tbody", TableBodyProps, never>;
15
+ export default TableBody;
@@ -0,0 +1,87 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { filterDOMProps, useDOMRef } from "@heroui/react-utils";
4
+ import { dataAttr, mergeProps } from "@heroui/shared-utils";
5
+ import { forwardRef } from "@heroui/system";
6
+ import { cn } from "@heroui/theme";
7
+ import { useTableRowGroup } from "@react-aria/table";
8
+ import { UXEmpty } from "../UXEmpty/index.js";
9
+ import table_cell from "./table-cell.js";
10
+ import table_checkbox_cell from "./table-checkbox-cell.js";
11
+ import table_row from "./table-row.js";
12
+ const TableBody = forwardRef((props, ref)=>{
13
+ const { as, className, slots, state, collection, isSelectable, color, disableAnimation, checkboxesProps, selectionMode, classNames, ...otherProps } = props;
14
+ const Component = as || 'tbody';
15
+ const shouldFilterDOMProps = 'string' == typeof Component;
16
+ const domRef = useDOMRef(ref);
17
+ const { rowGroupProps } = useTableRowGroup();
18
+ const tbodyStyles = cn(classNames?.tbody, className);
19
+ const bodyProps = collection?.body.props;
20
+ const isLoading = bodyProps?.isLoading || bodyProps?.loadingState === 'loading' || bodyProps?.loadingState === 'loadingMore';
21
+ const renderRows = useMemo(()=>[
22
+ ...collection.body.childNodes
23
+ ].map((row)=>/*#__PURE__*/ jsx(table_row, {
24
+ classNames: classNames,
25
+ isSelectable: isSelectable,
26
+ node: row,
27
+ slots: slots,
28
+ state: state,
29
+ children: [
30
+ ...row.childNodes
31
+ ].map((cell)=>cell.props.isSelectionCell ? /*#__PURE__*/ jsx(table_checkbox_cell, {
32
+ checkboxesProps: checkboxesProps,
33
+ classNames: classNames,
34
+ color: color,
35
+ disableAnimation: disableAnimation,
36
+ node: cell,
37
+ rowKey: row.key,
38
+ selectionMode: selectionMode,
39
+ slots: slots,
40
+ state: state
41
+ }, cell.key) : /*#__PURE__*/ jsx(table_cell, {
42
+ classNames: classNames,
43
+ node: cell,
44
+ rowKey: row.key,
45
+ slots: slots,
46
+ state: state
47
+ }, cell.key))
48
+ }, row.key)), [
49
+ collection.body.childNodes,
50
+ classNames,
51
+ isSelectable,
52
+ slots,
53
+ state
54
+ ]);
55
+ let emptyContent;
56
+ let loadingContent;
57
+ if (0 === collection.size) emptyContent = /*#__PURE__*/ jsx("tr", {
58
+ role: "row",
59
+ children: /*#__PURE__*/ jsx("td", {
60
+ className: slots?.emptyWrapper({
61
+ class: classNames?.emptyWrapper
62
+ }),
63
+ colSpan: collection.columnCount,
64
+ role: "gridcell",
65
+ children: !isLoading && /*#__PURE__*/ jsx(UXEmpty, {})
66
+ })
67
+ });
68
+ return /*#__PURE__*/ jsxs(Component, {
69
+ ref: domRef,
70
+ ...mergeProps(rowGroupProps, filterDOMProps(bodyProps, {
71
+ enabled: shouldFilterDOMProps
72
+ }), otherProps),
73
+ className: slots.tbody?.({
74
+ class: tbodyStyles
75
+ }),
76
+ "data-empty": dataAttr(0 === collection.size),
77
+ "data-loading": dataAttr(isLoading),
78
+ children: [
79
+ renderRows,
80
+ loadingContent,
81
+ emptyContent
82
+ ]
83
+ });
84
+ });
85
+ TableBody.displayName = 'HeroUI.TableBody';
86
+ const table_body = TableBody;
87
+ export { table_body as default };
@@ -0,0 +1,19 @@
1
+ import type { Key as ReactKey } from 'react';
2
+ import type { HTMLHeroUIProps } from '@heroui/system';
3
+ import type { GridNode } from '@react-types/grid';
4
+ import type { ValuesType } from './use-table';
5
+ export interface TableCellProps<T = object> extends HTMLHeroUIProps<'td'> {
6
+ /**
7
+ * The key of the table row.
8
+ */
9
+ rowKey: ReactKey;
10
+ /**
11
+ * The table cell.
12
+ */
13
+ node: GridNode<T>;
14
+ slots: ValuesType['slots'];
15
+ state: ValuesType['state'];
16
+ classNames?: ValuesType['classNames'];
17
+ }
18
+ declare const TableCell: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"td", TableCellProps<object>, never>;
19
+ export default TableCell;
@@ -0,0 +1,45 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { filterDOMProps, useDOMRef } from "@heroui/react-utils";
4
+ import { dataAttr, mergeProps } from "@heroui/shared-utils";
5
+ import { forwardRef } from "@heroui/system";
6
+ import { cn } from "@heroui/theme";
7
+ import { useFocusRing } from "@react-aria/focus";
8
+ import { useTableCell } from "@react-aria/table";
9
+ const TableCell = forwardRef((props, ref)=>{
10
+ const { as, className, node, rowKey, slots, state, classNames, ...otherProps } = props;
11
+ const Component = as || 'td';
12
+ const shouldFilterDOMProps = 'string' == typeof Component;
13
+ const domRef = useDOMRef(ref);
14
+ const { gridCellProps } = useTableCell({
15
+ node
16
+ }, state, domRef);
17
+ const tdStyles = cn(classNames?.td, className, node.props?.className);
18
+ const { isFocusVisible, focusProps } = useFocusRing();
19
+ const isRowSelected = state.selectionManager.isSelected(rowKey);
20
+ const cell = useMemo(()=>{
21
+ const cellType = typeof node.rendered;
22
+ return 'object' !== cellType && 'function' !== cellType ? /*#__PURE__*/ jsx("span", {
23
+ children: node.rendered
24
+ }) : node.rendered;
25
+ }, [
26
+ node.rendered
27
+ ]);
28
+ const columnProps = node.column?.props || {};
29
+ return /*#__PURE__*/ jsx(Component, {
30
+ ref: domRef,
31
+ "data-focus-visible": dataAttr(isFocusVisible),
32
+ "data-selected": dataAttr(isRowSelected),
33
+ ...mergeProps(gridCellProps, focusProps, filterDOMProps(node.props, {
34
+ enabled: shouldFilterDOMProps
35
+ }), otherProps),
36
+ className: slots.td?.({
37
+ align: columnProps.align,
38
+ class: tdStyles
39
+ }),
40
+ children: cell
41
+ });
42
+ });
43
+ TableCell.displayName = 'HeroUI.TableCell';
44
+ const table_cell = TableCell;
45
+ export { table_cell as default };
@@ -0,0 +1,23 @@
1
+ import type { Key as ReactKey } from 'react';
2
+ import type { HTMLHeroUIProps } from '@heroui/system';
3
+ import type { GridNode } from '@react-types/grid';
4
+ import type { ValuesType } from './use-table';
5
+ export interface TableCheckboxCellProps<T = object> extends HTMLHeroUIProps<'td'> {
6
+ /**
7
+ * The key of the table row.
8
+ */
9
+ rowKey: ReactKey;
10
+ /**
11
+ * The table cell.
12
+ */
13
+ node: GridNode<T>;
14
+ slots: ValuesType['slots'];
15
+ state: ValuesType['state'];
16
+ color: ValuesType['color'];
17
+ disableAnimation: ValuesType['disableAnimation'];
18
+ checkboxesProps: ValuesType['checkboxesProps'];
19
+ selectionMode: ValuesType['selectionMode'];
20
+ classNames?: ValuesType['classNames'];
21
+ }
22
+ declare const TableCheckboxCell: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"td", TableCheckboxCellProps<object>, never>;
23
+ export default TableCheckboxCell;
@@ -0,0 +1,48 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Checkbox } from "@heroui/checkbox";
3
+ import { filterDOMProps, useDOMRef } from "@heroui/react-utils";
4
+ import { dataAttr, mergeProps } from "@heroui/shared-utils";
5
+ import { forwardRef } from "@heroui/system";
6
+ import { cn } from "@heroui/theme";
7
+ import { useFocusRing } from "@react-aria/focus";
8
+ import { useTableCell, useTableSelectionCheckbox } from "@react-aria/table";
9
+ import { VisuallyHidden } from "@react-aria/visually-hidden";
10
+ const TableCheckboxCell = forwardRef((props, ref)=>{
11
+ const { as, className, node, rowKey, slots, state, color, disableAnimation, checkboxesProps, selectionMode, classNames, ...otherProps } = props;
12
+ const Component = as || 'td';
13
+ const shouldFilterDOMProps = 'string' == typeof Component;
14
+ const domRef = useDOMRef(ref);
15
+ const { gridCellProps } = useTableCell({
16
+ node
17
+ }, state, domRef);
18
+ const { isFocusVisible, focusProps } = useFocusRing();
19
+ const { checkboxProps } = useTableSelectionCheckbox({
20
+ key: node?.parentKey || node.key
21
+ }, state);
22
+ const tdStyles = cn(classNames?.td, className, node.props?.className);
23
+ const isSingleSelectionMode = 'single' === selectionMode;
24
+ const { onChange, ...otherCheckboxProps } = checkboxProps;
25
+ const isRowSelected = state.selectionManager.isSelected(rowKey);
26
+ return /*#__PURE__*/ jsx(Component, {
27
+ ref: domRef,
28
+ "data-focus-visible": dataAttr(isFocusVisible),
29
+ "data-selected": dataAttr(isRowSelected),
30
+ ...mergeProps(gridCellProps, focusProps, filterDOMProps(node.props, {
31
+ enabled: shouldFilterDOMProps
32
+ }), otherProps),
33
+ className: slots.td?.({
34
+ class: tdStyles
35
+ }),
36
+ children: isSingleSelectionMode ? /*#__PURE__*/ jsx(VisuallyHidden, {
37
+ children: checkboxProps['aria-label']
38
+ }) : /*#__PURE__*/ jsx(Checkbox, {
39
+ color: color,
40
+ disableAnimation: disableAnimation,
41
+ onValueChange: onChange,
42
+ ...mergeProps(checkboxesProps, otherCheckboxProps)
43
+ })
44
+ });
45
+ });
46
+ TableCheckboxCell.displayName = 'HeroUI.TableCheckboxCell';
47
+ const table_checkbox_cell = TableCheckboxCell;
48
+ export { table_checkbox_cell as default };
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { HTMLHeroUIProps } from '@heroui/system';
3
+ import type { GridNode } from '@react-types/grid';
4
+ import type { ValuesType } from './use-table';
5
+ export interface SortIconProps {
6
+ 'aria-hidden'?: boolean;
7
+ 'data-direction'?: 'ascending' | 'descending';
8
+ 'data-visible'?: boolean | 'true' | 'false';
9
+ className?: string;
10
+ }
11
+ export interface TableColumnHeaderProps<T = object> extends HTMLHeroUIProps<'th'> {
12
+ slots: ValuesType['slots'];
13
+ state: ValuesType['state'];
14
+ classNames?: ValuesType['classNames'];
15
+ /**
16
+ * Custom Icon to be displayed in the table header - overrides the default chevron one
17
+ */
18
+ sortIcon?: ReactNode | ((props: SortIconProps) => ReactNode);
19
+ /**
20
+ * The table node to render.
21
+ */
22
+ node: GridNode<T>;
23
+ }
24
+ declare const TableColumnHeader: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"th", TableColumnHeaderProps<object>, never>;
25
+ export default TableColumnHeader;
@@ -0,0 +1,66 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cloneElement, isValidElement } from "react";
3
+ import { filterDOMProps, useDOMRef } from "@heroui/react-utils";
4
+ import { ChevronDownIcon } from "@heroui/shared-icons";
5
+ import { dataAttr, mergeProps } from "@heroui/shared-utils";
6
+ import { forwardRef } from "@heroui/system";
7
+ import { cn } from "@heroui/theme";
8
+ import { useFocusRing } from "@react-aria/focus";
9
+ import { useHover } from "@react-aria/interactions";
10
+ import { useTableColumnHeader } from "@react-aria/table";
11
+ import { VisuallyHidden } from "@react-aria/visually-hidden";
12
+ const normalizeWidth = (value)=>'number' == typeof value ? `${value}px` : value;
13
+ const TableColumnHeader = forwardRef((props, ref)=>{
14
+ const { as, className, state, node, slots, classNames, sortIcon, ...otherProps } = props;
15
+ const Component = as || 'th';
16
+ const shouldFilterDOMProps = 'string' == typeof Component;
17
+ const domRef = useDOMRef(ref);
18
+ const { columnHeaderProps } = useTableColumnHeader({
19
+ node
20
+ }, state, domRef);
21
+ const thStyles = cn(classNames?.th, className, node.props?.className);
22
+ const { isFocusVisible, focusProps } = useFocusRing();
23
+ const { isHovered, hoverProps } = useHover({});
24
+ const { hideHeader, align, width, minWidth, maxWidth, ...columnProps } = node.props;
25
+ const { allowsSorting } = columnProps;
26
+ const columnStyles = {};
27
+ if (width) columnStyles.width = normalizeWidth(width);
28
+ if (minWidth) columnStyles.minWidth = normalizeWidth(minWidth);
29
+ if (maxWidth) columnStyles.maxWidth = normalizeWidth(maxWidth);
30
+ const sortIconProps = {
31
+ 'aria-hidden': true,
32
+ 'data-direction': state.sortDescriptor?.direction,
33
+ 'data-visible': dataAttr(state.sortDescriptor?.column === node.key),
34
+ className: slots.sortIcon?.({
35
+ class: classNames?.sortIcon
36
+ })
37
+ };
38
+ const customSortIcon = 'function' == typeof sortIcon ? sortIcon(sortIconProps) : /*#__PURE__*/ isValidElement(sortIcon) && /*#__PURE__*/ cloneElement(sortIcon, sortIconProps);
39
+ return /*#__PURE__*/ jsxs(Component, {
40
+ ref: domRef,
41
+ colSpan: node.colspan,
42
+ "data-focus-visible": dataAttr(isFocusVisible),
43
+ "data-hover": dataAttr(isHovered),
44
+ "data-sortable": dataAttr(allowsSorting),
45
+ style: columnStyles,
46
+ ...mergeProps(columnHeaderProps, focusProps, filterDOMProps(columnProps, {
47
+ enabled: shouldFilterDOMProps
48
+ }), allowsSorting ? hoverProps : {}, otherProps),
49
+ className: slots.th?.({
50
+ align,
51
+ class: thStyles
52
+ }),
53
+ children: [
54
+ hideHeader ? /*#__PURE__*/ jsx(VisuallyHidden, {
55
+ children: node.rendered
56
+ }) : node.rendered,
57
+ allowsSorting && (customSortIcon || /*#__PURE__*/ jsx(ChevronDownIcon, {
58
+ strokeWidth: 3,
59
+ ...sortIconProps
60
+ }))
61
+ ]
62
+ });
63
+ });
64
+ TableColumnHeader.displayName = 'HeroUI.TableColumnHeader';
65
+ const table_column_header = TableColumnHeader;
66
+ export { table_column_header as default };
@@ -0,0 +1,14 @@
1
+ import type { HTMLHeroUIProps } from '@heroui/system';
2
+ import type { GridNode } from '@react-types/grid';
3
+ import type { ValuesType } from './use-table';
4
+ export interface TableHeaderRowProps<T = object> extends HTMLHeroUIProps<'tr'> {
5
+ /**
6
+ * The table node to render.
7
+ */
8
+ node: GridNode<T>;
9
+ slots: ValuesType['slots'];
10
+ state: ValuesType['state'];
11
+ classNames?: ValuesType['classNames'];
12
+ }
13
+ declare const TableHeaderRow: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"tr", TableHeaderRowProps<object>, never>;
14
+ export default TableHeaderRow;
@@ -0,0 +1,29 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { filterDOMProps, useDOMRef } from "@heroui/react-utils";
3
+ import { mergeProps } from "@heroui/shared-utils";
4
+ import { forwardRef } from "@heroui/system";
5
+ import { cn } from "@heroui/theme";
6
+ import { useTableHeaderRow } from "@react-aria/table";
7
+ const TableHeaderRow = forwardRef((props, ref)=>{
8
+ const { as, className, children, node, slots, classNames, state, ...otherProps } = props;
9
+ const Component = as || 'tr';
10
+ const shouldFilterDOMProps = 'string' == typeof Component;
11
+ const domRef = useDOMRef(ref);
12
+ const { rowProps } = useTableHeaderRow({
13
+ node
14
+ }, state, domRef);
15
+ const trStyles = cn(classNames?.tr, className, node.props?.className);
16
+ return /*#__PURE__*/ jsx(Component, {
17
+ ref: domRef,
18
+ ...mergeProps(rowProps, filterDOMProps(node.props, {
19
+ enabled: shouldFilterDOMProps
20
+ }), otherProps),
21
+ className: slots.tr?.({
22
+ class: trStyles
23
+ }),
24
+ children: children
25
+ });
26
+ });
27
+ TableHeaderRow.displayName = 'HeroUI.TableHeaderRow';
28
+ const table_header_row = TableHeaderRow;
29
+ export { table_header_row as default };
@@ -0,0 +1,8 @@
1
+ import type { HTMLHeroUIProps } from '@heroui/system';
2
+ import type { ValuesType } from './use-table';
3
+ export interface TableRowGroupProps extends HTMLHeroUIProps<'thead'> {
4
+ slots: ValuesType['slots'];
5
+ classNames?: ValuesType['classNames'];
6
+ }
7
+ declare const TableRowGroup: import("react").ForwardRefExoticComponent<TableRowGroupProps & import("react").RefAttributes<HTMLTableSectionElement>>;
8
+ export default TableRowGroup;
@@ -0,0 +1,24 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useDOMRef } from "@heroui/react-utils";
4
+ import { mergeProps } from "@heroui/shared-utils";
5
+ import { cn } from "@heroui/theme";
6
+ import { useTableRowGroup } from "@react-aria/table";
7
+ const TableRowGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
8
+ const { as, className, children, slots, classNames, ...otherProps } = props;
9
+ const Component = as || 'thead';
10
+ const domRef = useDOMRef(ref);
11
+ const { rowGroupProps } = useTableRowGroup();
12
+ const theadStyles = cn(classNames?.thead, className);
13
+ return /*#__PURE__*/ jsx(Component, {
14
+ ref: domRef,
15
+ className: slots.thead?.({
16
+ class: theadStyles
17
+ }),
18
+ ...mergeProps(rowGroupProps, otherProps),
19
+ children: children
20
+ });
21
+ });
22
+ TableRowGroup.displayName = 'HeroUI.TableRowGroup';
23
+ const table_row_group = TableRowGroup;
24
+ export { table_row_group as default };
@@ -0,0 +1,15 @@
1
+ import type { GridNode } from '@react-types/grid';
2
+ import type { TableRowProps as BaseTableRowProps } from './base/table-row';
3
+ import type { ValuesType } from './use-table';
4
+ export interface TableRowProps<T = object> extends Omit<BaseTableRowProps, 'children'> {
5
+ /**
6
+ * The table row.
7
+ */
8
+ node: GridNode<T>;
9
+ slots: ValuesType['slots'];
10
+ state: ValuesType['state'];
11
+ isSelectable?: ValuesType['isSelectable'];
12
+ classNames?: ValuesType['classNames'];
13
+ }
14
+ declare const TableRow: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"tr", TableRowProps<object>, never>;
15
+ export default TableRow;