@particle-network/ui-react 0.7.0-beta.2 → 0.7.0-beta.20

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 (62) hide show
  1. package/dist/components/ProgressWrapper/index.js +47 -45
  2. package/dist/components/UXButton/button-theme.js +8 -8
  3. package/dist/components/UXColorPicker/color-fields.js +1 -1
  4. package/dist/components/UXHint/index.d.ts +6 -3
  5. package/dist/components/UXHint/index.js +9 -19
  6. package/dist/components/UXSimplePopover/index.d.ts +1 -0
  7. package/dist/components/UXSimplePopover/index.js +1 -0
  8. package/dist/components/UXSimplePopover/provider.d.ts +22 -0
  9. package/dist/components/UXSimplePopover/provider.js +197 -0
  10. package/dist/components/UXSimplePopover/simple-popover.d.ts +8 -3
  11. package/dist/components/UXSimplePopover/simple-popover.js +114 -104
  12. package/dist/components/UXTable/base/index.d.ts +10 -0
  13. package/dist/components/UXTable/base/index.js +6 -0
  14. package/dist/components/UXTable/base/table-body.d.ts +20 -0
  15. package/dist/components/UXTable/base/table-body.js +4 -0
  16. package/dist/components/UXTable/base/table-cell.d.ts +6 -0
  17. package/dist/components/UXTable/base/table-cell.js +4 -0
  18. package/dist/components/UXTable/base/table-column.d.ts +6 -0
  19. package/dist/components/UXTable/base/table-column.js +4 -0
  20. package/dist/components/UXTable/base/table-header.d.ts +6 -0
  21. package/dist/components/UXTable/base/table-header.js +4 -0
  22. package/dist/components/UXTable/base/table-row.d.ts +6 -0
  23. package/dist/components/UXTable/base/table-row.js +4 -0
  24. package/dist/components/UXTable/index.d.ts +7 -37
  25. package/dist/components/UXTable/index.js +5 -14
  26. package/dist/components/UXTable/table-body.d.ts +15 -0
  27. package/dist/components/UXTable/table-body.js +87 -0
  28. package/dist/components/UXTable/table-cell.d.ts +19 -0
  29. package/dist/components/UXTable/table-cell.js +45 -0
  30. package/dist/components/UXTable/table-checkbox-cell.d.ts +23 -0
  31. package/dist/components/UXTable/table-checkbox-cell.js +48 -0
  32. package/dist/components/UXTable/table-column-header.d.ts +25 -0
  33. package/dist/components/UXTable/table-column-header.js +66 -0
  34. package/dist/components/UXTable/table-header-row.d.ts +14 -0
  35. package/dist/components/UXTable/table-header-row.js +29 -0
  36. package/dist/components/UXTable/table-row-group.d.ts +8 -0
  37. package/dist/components/UXTable/table-row-group.js +24 -0
  38. package/dist/components/UXTable/table-row.d.ts +15 -0
  39. package/dist/components/UXTable/table-row.js +61 -0
  40. package/dist/components/UXTable/table-select-all-checkbox.d.ts +18 -0
  41. package/dist/components/UXTable/table-select-all-checkbox.js +46 -0
  42. package/dist/components/UXTable/table-theme.d.ts +452 -0
  43. package/dist/components/UXTable/table-theme.js +282 -0
  44. package/dist/components/UXTable/table.d.ts +8 -0
  45. package/dist/components/UXTable/table.js +96 -0
  46. package/dist/components/UXTable/use-table.d.ts +145 -0
  47. package/dist/components/UXTable/use-table.js +127 -0
  48. package/dist/components/UXTable/virtualized-table-body.d.ts +17 -0
  49. package/dist/components/UXTable/virtualized-table-body.js +107 -0
  50. package/dist/components/UXTable/virtualized-table.d.ts +8 -0
  51. package/dist/components/UXTable/virtualized-table.js +115 -0
  52. package/dist/components/UXThemeSwitch/theme-switch.js +8 -1
  53. package/dist/components/UXThemeSwitch/use-theme.js +1 -1
  54. package/dist/components/UXToast/index.d.ts +4 -1
  55. package/dist/components/UXToast/index.js +2 -2
  56. package/dist/components/layout/Box/box-theme.d.ts +2 -2
  57. package/dist/components/layout/Box/box-theme.js +1 -1
  58. package/dist/components/typography/text-theme.d.ts +2 -2
  59. package/dist/components/typography/text-theme.js +1 -1
  60. package/package.json +10 -4
  61. package/dist/components/UXTable/table.extend.d.ts +0 -34
  62. package/dist/components/UXTable/table.extend.js +0 -145
@@ -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;
@@ -0,0 +1,61 @@
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 { useHover } from "@react-aria/interactions";
9
+ import { useTableRow } from "@react-aria/table";
10
+ const TableRow = forwardRef((props, ref)=>{
11
+ const { as, className, children, node, slots, state, isSelectable, classNames, ...otherProps } = props;
12
+ const Component = as || (props?.href ? 'a' : 'tr');
13
+ const shouldFilterDOMProps = 'string' == typeof Component;
14
+ const domRef = useDOMRef(ref);
15
+ const { rowProps } = useTableRow({
16
+ node
17
+ }, state, domRef);
18
+ const trStyles = cn(classNames?.tr, className, node.props?.className);
19
+ const { isFocusVisible, focusProps } = useFocusRing();
20
+ const isDisabled = state.disabledKeys.has(node.key);
21
+ const isSelected = state.selectionManager.isSelected(node.key);
22
+ const { isHovered, hoverProps } = useHover({
23
+ isDisabled
24
+ });
25
+ const { isFirst, isLast, isMiddle, isOdd } = useMemo(()=>{
26
+ const isFirst = node.key === state.collection.getFirstKey();
27
+ const isLast = node.key === state.collection.getLastKey();
28
+ const isMiddle = !isFirst && !isLast;
29
+ const isOdd = node?.index ? (node.index + 1) % 2 === 0 : false;
30
+ return {
31
+ isFirst,
32
+ isLast,
33
+ isMiddle,
34
+ isOdd
35
+ };
36
+ }, [
37
+ node,
38
+ state.collection
39
+ ]);
40
+ return /*#__PURE__*/ jsx(Component, {
41
+ ref: domRef,
42
+ "data-disabled": dataAttr(isDisabled),
43
+ "data-first": dataAttr(isFirst),
44
+ "data-focus-visible": dataAttr(isFocusVisible),
45
+ "data-hover": dataAttr(isHovered),
46
+ "data-last": dataAttr(isLast),
47
+ "data-middle": dataAttr(isMiddle),
48
+ "data-odd": dataAttr(isOdd),
49
+ "data-selected": dataAttr(isSelected),
50
+ ...mergeProps(rowProps, focusProps, isSelectable ? hoverProps : {}, filterDOMProps(node.props, {
51
+ enabled: shouldFilterDOMProps
52
+ }), otherProps),
53
+ className: slots.tr?.({
54
+ class: trStyles
55
+ }),
56
+ children: children
57
+ });
58
+ });
59
+ TableRow.displayName = 'HeroUI.TableRow';
60
+ const table_row = TableRow;
61
+ export { table_row as default };
@@ -0,0 +1,18 @@
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 TableSelectAllCheckboxProps<T = object> extends HTMLHeroUIProps<'th'> {
5
+ /**
6
+ * The table column.
7
+ */
8
+ node: GridNode<T>;
9
+ slots: ValuesType['slots'];
10
+ state: ValuesType['state'];
11
+ color: ValuesType['color'];
12
+ disableAnimation: ValuesType['disableAnimation'];
13
+ checkboxesProps: ValuesType['checkboxesProps'];
14
+ selectionMode: ValuesType['selectionMode'];
15
+ classNames?: ValuesType['classNames'];
16
+ }
17
+ declare const TableSelectAllCheckbox: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"th", TableSelectAllCheckboxProps<object>, never>;
18
+ export default TableSelectAllCheckbox;
@@ -0,0 +1,46 @@
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 { useTableColumnHeader, useTableSelectAllCheckbox } from "@react-aria/table";
9
+ import { VisuallyHidden } from "@react-aria/visually-hidden";
10
+ const TableSelectAllCheckbox = forwardRef((props, ref)=>{
11
+ const { as, className, node, slots, state, selectionMode, color, checkboxesProps, disableAnimation, classNames, ...otherProps } = props;
12
+ const Component = as || 'th';
13
+ const shouldFilterDOMProps = 'string' == typeof Component;
14
+ const domRef = useDOMRef(ref);
15
+ const { columnHeaderProps } = useTableColumnHeader({
16
+ node
17
+ }, state, domRef);
18
+ const { isFocusVisible, focusProps } = useFocusRing();
19
+ const { checkboxProps } = useTableSelectAllCheckbox(state);
20
+ const thStyles = cn(classNames?.th, className, node.props?.className);
21
+ const isSingleSelectionMode = 'single' === selectionMode;
22
+ const { onChange, ...otherCheckboxProps } = checkboxProps;
23
+ return /*#__PURE__*/ jsx(Component, {
24
+ ref: domRef,
25
+ "data-focus-visible": dataAttr(isFocusVisible),
26
+ ...mergeProps(columnHeaderProps, focusProps, filterDOMProps(node.props, {
27
+ enabled: shouldFilterDOMProps
28
+ }), filterDOMProps(otherProps, {
29
+ enabled: shouldFilterDOMProps
30
+ })),
31
+ className: slots.th?.({
32
+ class: thStyles
33
+ }),
34
+ children: isSingleSelectionMode ? /*#__PURE__*/ jsx(VisuallyHidden, {
35
+ children: checkboxProps['aria-label']
36
+ }) : /*#__PURE__*/ jsx(Checkbox, {
37
+ color: color,
38
+ disableAnimation: disableAnimation,
39
+ onValueChange: onChange,
40
+ ...mergeProps(checkboxesProps, otherCheckboxProps)
41
+ })
42
+ });
43
+ });
44
+ TableSelectAllCheckbox.displayName = 'HeroUI.TableSelectAllCheckbox';
45
+ const table_select_all_checkbox = TableSelectAllCheckbox;
46
+ export { table_select_all_checkbox as default };