@alaarab/ogrid-react-fluent 2.0.11 → 2.0.12

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 (27) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/ColumnChooser/ColumnChooser.js +10 -128
  3. package/dist/esm/ColumnChooser/ColumnChooser.module.css +45 -10
  4. package/dist/esm/ColumnHeaderFilter/ColumnHeaderFilter.js +16 -36
  5. package/dist/esm/ColumnHeaderMenu/ColumnHeaderMenu.js +9 -3
  6. package/dist/esm/ColumnHeaderMenu/ColumnHeaderMenu.module.css +7 -7
  7. package/dist/esm/DataGridTable/DataGridTable.js +118 -295
  8. package/dist/esm/DataGridTable/DataGridTable.module.css +546 -437
  9. package/dist/esm/DataGridTable/DropIndicator.js +5 -0
  10. package/dist/esm/DataGridTable/EmptyState.js +5 -0
  11. package/dist/esm/DataGridTable/GridContextMenu.js +10 -32
  12. package/dist/esm/DataGridTable/LoadingOverlay.js +6 -0
  13. package/dist/esm/{FluentDataTable/FluentDataTable.js → OGrid/OGrid.js} +0 -2
  14. package/dist/esm/OGrid/index.js +1 -0
  15. package/dist/esm/index.js +1 -1
  16. package/dist/types/ColumnChooser/ColumnChooser.d.ts +2 -8
  17. package/dist/types/ColumnHeaderFilter/ColumnHeaderFilter.d.ts +2 -20
  18. package/dist/types/DataGridTable/DropIndicator.d.ts +7 -0
  19. package/dist/types/DataGridTable/EmptyState.d.ts +11 -0
  20. package/dist/types/DataGridTable/LoadingOverlay.d.ts +6 -0
  21. package/dist/types/{FluentDataTable/FluentDataTable.d.ts → OGrid/OGrid.d.ts} +0 -2
  22. package/dist/types/OGrid/index.d.ts +1 -0
  23. package/dist/types/PaginationControls/PaginationControls.d.ts +2 -10
  24. package/dist/types/index.d.ts +1 -1
  25. package/package.json +3 -3
  26. package/dist/esm/FluentDataTable/index.js +0 -1
  27. package/dist/types/FluentDataTable/index.d.ts +0 -1
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styles from './DataGridTable.module.css';
3
+ export function DropIndicator({ dropIndicatorX, wrapperLeft }) {
4
+ return (_jsx("div", { className: styles.dropIndicator, style: { left: dropIndicatorX - wrapperLeft } }));
5
+ }
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styles from './DataGridTable.module.css';
3
+ export function EmptyState({ emptyState }) {
4
+ return (_jsx("div", { className: styles.emptyStateInGrid, children: _jsx("div", { className: styles.emptyStateInGridMessageSticky, children: emptyState.render ? (emptyState.render()) : (_jsxs(_Fragment, { children: [_jsx("span", { className: styles.emptyStateInGridIcon, "aria-hidden": true, children: '\uD83D\uDCCB' }), _jsx("div", { className: styles.emptyStateInGridTitle, children: "No results found" }), _jsx("div", { className: styles.emptyStateInGridMessage, children: emptyState.message != null ? (emptyState.message) : emptyState.hasActiveFilters ? (_jsxs(_Fragment, { children: ["No items match your current filters. Try adjusting your search or", ' ', _jsx("button", { type: "button", className: styles.emptyStateInGridLink, onClick: emptyState.onClearAll, children: "clear all filters" }), ' ', "to see all items."] })) : ('There are no items available at this time.') })] })) }) }));
5
+ }
@@ -1,35 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from 'react';
3
- import { GRID_CONTEXT_MENU_ITEMS, getContextMenuHandlers, formatShortcut } from '@alaarab/ogrid-react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { GridContextMenu as BaseGridContextMenu } from '@alaarab/ogrid-react';
4
3
  import styles from './DataGridTable.module.css';
4
+ const classNames = {
5
+ contextMenu: styles.contextMenu,
6
+ contextMenuItem: styles.contextMenuItem,
7
+ contextMenuItemLabel: styles.contextMenuItemLabel,
8
+ contextMenuItemShortcut: styles.contextMenuItemShortcut,
9
+ contextMenuDivider: styles.contextMenuDivider,
10
+ };
5
11
  export function GridContextMenu(props) {
6
- const { x, y, hasSelection, canUndo, canRedo, onClose } = props;
7
- const ref = React.useRef(null);
8
- const handlers = React.useMemo(() => getContextMenuHandlers(props), [props]);
9
- const isDisabled = React.useCallback((item) => {
10
- if (item.disabledWhenNoSelection && !hasSelection)
11
- return true;
12
- if (item.id === 'undo' && !canUndo)
13
- return true;
14
- if (item.id === 'redo' && !canRedo)
15
- return true;
16
- return false;
17
- }, [hasSelection, canUndo, canRedo]);
18
- React.useEffect(() => {
19
- const handleClickOutside = (e) => {
20
- if (ref.current && !ref.current.contains(e.target))
21
- onClose();
22
- };
23
- const handleKeyDown = (e) => {
24
- if (e.key === 'Escape')
25
- onClose();
26
- };
27
- document.addEventListener('mousedown', handleClickOutside, true);
28
- document.addEventListener('keydown', handleKeyDown, true);
29
- return () => {
30
- document.removeEventListener('mousedown', handleClickOutside, true);
31
- document.removeEventListener('keydown', handleKeyDown, true);
32
- };
33
- }, [onClose]);
34
- return (_jsx("div", { ref: ref, className: styles.contextMenu, role: "menu", style: { left: x, top: y }, "aria-label": "Grid context menu", children: GRID_CONTEXT_MENU_ITEMS.map((item) => (_jsxs(React.Fragment, { children: [item.dividerBefore && _jsx("div", { className: styles.contextMenuDivider }), _jsxs("button", { type: "button", className: styles.contextMenuItem, onClick: handlers[item.id], disabled: isDisabled(item), children: [_jsx("span", { className: styles.contextMenuItemLabel, children: item.label }), item.shortcut && (_jsx("span", { className: styles.contextMenuItemShortcut, children: formatShortcut(item.shortcut) }))] })] }, item.id))) }));
12
+ return _jsx(BaseGridContextMenu, { ...props, classNames: classNames });
35
13
  }
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Spinner } from '@fluentui/react-components';
3
+ import styles from './DataGridTable.module.css';
4
+ export function LoadingOverlay({ message }) {
5
+ return (_jsx("div", { className: styles.loadingOverlay, "aria-live": "polite", children: _jsxs("div", { className: styles.loadingOverlayContent, children: [_jsx(Spinner, { size: "small" }), _jsx("span", { className: styles.loadingOverlayText, children: message })] }) }));
6
+ }
@@ -14,5 +14,3 @@ const OGridInner = forwardRef(function OGridInner(props, ref) {
14
14
  });
15
15
  OGridInner.displayName = 'OGrid';
16
16
  export const OGrid = React.memo(OGridInner);
17
- /** @deprecated Use `OGrid` instead. Backward-compat alias. */
18
- export const FluentDataTable = OGrid;
@@ -0,0 +1 @@
1
+ export { OGrid } from './OGrid';
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Components
2
- export { OGrid, FluentDataTable } from './FluentDataTable';
2
+ export { OGrid } from './OGrid';
3
3
  export { DataGridTable } from './DataGridTable/DataGridTable';
4
4
  export { ColumnChooser } from './ColumnChooser/ColumnChooser';
5
5
  export { ColumnHeaderFilter } from './ColumnHeaderFilter/ColumnHeaderFilter';
@@ -1,10 +1,4 @@
1
1
  import * as React from 'react';
2
- import type { IColumnDefinition } from '@alaarab/ogrid-react';
3
- export type { IColumnDefinition };
4
- export interface IColumnChooserProps {
5
- columns: IColumnDefinition[];
6
- visibleColumns: Set<string>;
7
- onVisibilityChange: (columnKey: string, visible: boolean) => void;
8
- className?: string;
9
- }
2
+ import type { IColumnChooserProps } from '@alaarab/ogrid-react';
3
+ export type { IColumnChooserProps };
10
4
  export declare const ColumnChooser: React.FC<IColumnChooserProps>;
@@ -1,22 +1,4 @@
1
1
  import * as React from 'react';
2
- import type { UserLike, ColumnFilterType, IDateFilterValue } from '@alaarab/ogrid-react';
3
- export interface IColumnHeaderFilterProps {
4
- columnKey: string;
5
- columnName: string;
6
- filterType: ColumnFilterType;
7
- isSorted?: boolean;
8
- isSortedDescending?: boolean;
9
- onSort?: () => void;
10
- selectedValues?: string[];
11
- onFilterChange?: (values: string[]) => void;
12
- options?: string[];
13
- isLoadingOptions?: boolean;
14
- textValue?: string;
15
- onTextChange?: (value: string) => void;
16
- selectedUser?: UserLike;
17
- onUserChange?: (user: UserLike | undefined) => void;
18
- peopleSearch?: (query: string) => Promise<UserLike[]>;
19
- dateValue?: IDateFilterValue;
20
- onDateChange?: (value: IDateFilterValue | undefined) => void;
21
- }
2
+ import type { IColumnHeaderFilterProps } from '@alaarab/ogrid-react';
3
+ export type { IColumnHeaderFilterProps };
22
4
  export declare const ColumnHeaderFilter: React.FC<IColumnHeaderFilterProps>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ interface DropIndicatorProps {
3
+ dropIndicatorX: number;
4
+ wrapperLeft: number;
5
+ }
6
+ export declare function DropIndicator({ dropIndicatorX, wrapperLeft }: DropIndicatorProps): React.ReactElement;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ interface EmptyStateProps {
3
+ emptyState: {
4
+ render?: () => React.ReactNode;
5
+ message?: React.ReactNode;
6
+ hasActiveFilters?: boolean;
7
+ onClearAll?: () => void;
8
+ };
9
+ }
10
+ export declare function EmptyState({ emptyState }: EmptyStateProps): React.ReactElement;
11
+ export {};
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface LoadingOverlayProps {
3
+ message: string;
4
+ }
5
+ export declare function LoadingOverlay({ message }: LoadingOverlayProps): React.ReactElement;
6
+ export {};
@@ -3,5 +3,3 @@ import { type IOGridProps, type IOGridApi } from '@alaarab/ogrid-react';
3
3
  export type { IOGridProps } from '@alaarab/ogrid-react';
4
4
  declare const OGridInner: React.ForwardRefExoticComponent<IOGridProps<unknown> & React.RefAttributes<IOGridApi<unknown>>>;
5
5
  export declare const OGrid: typeof OGridInner;
6
- /** @deprecated Use `OGrid` instead. Backward-compat alias. */
7
- export declare const FluentDataTable: React.ForwardRefExoticComponent<IOGridProps<unknown> & React.RefAttributes<IOGridApi<unknown>>>;
@@ -0,0 +1 @@
1
+ export { OGrid, type IOGridProps } from './OGrid';
@@ -1,12 +1,4 @@
1
1
  import * as React from 'react';
2
- export interface IPaginationControlsProps {
3
- currentPage: number;
4
- pageSize: number;
5
- totalCount: number;
6
- onPageChange: (page: number) => void;
7
- onPageSizeChange: (pageSize: number) => void;
8
- pageSizeOptions?: number[];
9
- entityLabelPlural?: string;
10
- className?: string;
11
- }
2
+ import type { IPaginationControlsProps } from '@alaarab/ogrid-react';
3
+ export type { IPaginationControlsProps };
12
4
  export declare const PaginationControls: React.FC<IPaginationControlsProps>;
@@ -1,4 +1,4 @@
1
- export { OGrid, FluentDataTable, type IOGridProps } from './FluentDataTable';
1
+ export { OGrid, type IOGridProps } from './OGrid';
2
2
  export { DataGridTable } from './DataGridTable/DataGridTable';
3
3
  export { ColumnChooser, type IColumnChooserProps } from './ColumnChooser/ColumnChooser';
4
4
  export { ColumnHeaderFilter, type IColumnHeaderFilterProps } from './ColumnHeaderFilter/ColumnHeaderFilter';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-react-fluent",
3
- "version": "2.0.11",
4
- "description": "OGrid Fluent UI implementation – DataGrid-powered data table with sorting, filtering, pagination, column chooser, and CSV export.",
3
+ "version": "2.0.12",
4
+ "description": "OGrid React Fluent implementation – DataGrid-powered data table with sorting, filtering, pagination, column chooser, and CSV export.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "node": ">=18"
41
41
  },
42
42
  "dependencies": {
43
- "@alaarab/ogrid-react": "2.0.11"
43
+ "@alaarab/ogrid-react": "2.0.12"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@fluentui/react-components": "^9.0.0",
@@ -1 +0,0 @@
1
- export { OGrid, FluentDataTable } from './FluentDataTable';
@@ -1 +0,0 @@
1
- export { OGrid, FluentDataTable, type IOGridProps } from './FluentDataTable';