@deadragdoll/reactnu 0.1.24 → 0.1.49

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.
@@ -16,6 +16,8 @@ export type NuIconDefinition = {
16
16
  onContextMenu?: MouseEventHandler<HTMLButtonElement>;
17
17
  onDoubleClick?: MouseEventHandler<HTMLButtonElement>;
18
18
  onPositionChange?: (position: NuIconPosition, icon: NuIconInfo) => void;
19
+ /** Application-defined data preserved when the icon moves to another grid. */
20
+ payload?: unknown;
19
21
  position?: NuIconPosition;
20
22
  };
21
23
  export type NuIconInfo = Omit<NuIconDefinition, "id" | "position"> & {
@@ -33,3 +35,10 @@ export type NuIconManager = {
33
35
  updateIcon: (id: string, patch: Partial<Omit<NuIconDefinition, "id">>) => void;
34
36
  };
35
37
  export type NuIconContextMenuItems = MainMenuNode[] | ((manager: NuIconManager) => MainMenuNode[]);
38
+ export type NuIconDropContext = {
39
+ position: NuIconPosition;
40
+ source: NuIconManager;
41
+ sourceGrid: HTMLElement;
42
+ target: NuIconManager;
43
+ targetGrid: HTMLElement;
44
+ };
@@ -1,7 +1,15 @@
1
1
  import { HTMLAttributes } from "react";
2
- import { NuIconContextMenuItems, NuIconArrangeMode } from "./IconGrid.types";
2
+ import { NuIconContextMenuItems, NuIconArrangeMode, NuIconDropContext, NuIconInfo } from "./IconGrid.types";
3
3
  export type NuIconGridProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
4
+ /** Filters icons accepted from another grid before `onIconDrop` is called. */
5
+ accepts?: (icon: NuIconInfo) => boolean;
4
6
  contextMenuItems?: NuIconContextMenuItems;
5
7
  defaultArrangeMode?: NuIconArrangeMode;
8
+ /** Enables hit testing for a non-interactive grid surface behind other content. */
9
+ dropTarget?: boolean;
10
+ /** Called by the target grid before an icon is transferred. Return false to reject the drop. */
11
+ onIconDrop?: (icon: NuIconInfo, context: NuIconDropContext) => boolean | void;
12
+ /** Called by the source grid after its icon was transferred to another grid. */
13
+ onIconMoveOut?: (icon: NuIconInfo, context: NuIconDropContext) => void;
6
14
  };
7
- export declare function NuIconGrid({ className, contextMenuItems: contextMenuItemsSource, defaultArrangeMode, onContextMenu, onPointerDown, ...props }: NuIconGridProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function NuIconGrid({ accepts, className, contextMenuItems: contextMenuItemsSource, defaultArrangeMode, dropTarget, onIconDrop, onIconMoveOut, onContextMenu, onPointerDown, ...props }: NuIconGridProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { ForwardedRef, HTMLAttributes, RefAttributes } from "react";
1
+ import { ForwardedRef, HTMLAttributes, MouseEvent, RefAttributes } from "react";
2
2
  import { ListBoxGroup, ListBoxItem } from "./internals/types";
3
3
  export type { ListBoxCategory, ListBoxGroup, ListBoxItem, ListBoxLabel } from "./internals/types";
4
4
  export type ListBoxHandle = {
@@ -11,6 +11,7 @@ export type ListBoxHandle = {
11
11
  export type ListBoxProps = Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> & {
12
12
  data: ListBoxGroup[];
13
13
  checkedIds?: string[];
14
+ onPopupMenu?: (event: MouseEvent<HTMLDivElement>, item: ListBoxItem, group: ListBoxGroup) => void;
14
15
  emptyText?: string;
15
16
  onItemCheckChange?: (item: ListBoxItem, group: ListBoxGroup, checked: boolean) => void;
16
17
  onItemDoubleClick?: (item: ListBoxItem, group: ListBoxGroup) => void;
@@ -19,5 +20,5 @@ export type ListBoxProps = Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> & {
19
20
  uncheckedShape?: "box" | "none";
20
21
  onItemSelect?: (item: ListBoxItem, group: ListBoxGroup) => void;
21
22
  };
22
- declare function ListBoxInner({ className, data, checkedIds, emptyText, onItemCheckChange, onItemDoubleClick, onItemSelect, rightCheckBox, selectedId, uncheckedShape, ...props }: ListBoxProps, ref: ForwardedRef<ListBoxHandle>): import("react/jsx-runtime").JSX.Element;
23
+ declare function ListBoxInner({ className, data, checkedIds, emptyText, onPopupMenu, onItemCheckChange, onItemDoubleClick, onItemSelect, rightCheckBox, selectedId, uncheckedShape, ...props }: ListBoxProps, ref: ForwardedRef<ListBoxHandle>): import("react/jsx-runtime").JSX.Element;
23
24
  export declare const ListBox: (props: ListBoxProps & RefAttributes<ListBoxHandle>) => ReturnType<typeof ListBoxInner>;
@@ -1,3 +1,4 @@
1
+ import { MouseEvent } from "react";
1
2
  import { ListBoxGroup, ListBoxItem } from "./types";
2
3
  type ListBoxGroupViewProps = {
3
4
  group: ListBoxGroup;
@@ -6,6 +7,7 @@ type ListBoxGroupViewProps = {
6
7
  listboxId: string;
7
8
  onActivateItem: (item: ListBoxItem, group: ListBoxGroup, itemId: string) => void;
8
9
  onDoubleClickItem?: (item: ListBoxItem, group: ListBoxGroup) => void;
10
+ onPopupMenuItem?: (event: MouseEvent<HTMLDivElement>, item: ListBoxItem, group: ListBoxGroup, itemId: string) => void;
9
11
  onToggleItemCheck: (itemId: string) => void;
10
12
  registerItemRef: (itemId: string, node: HTMLDivElement | null) => void;
11
13
  resolvedActiveId: string | null;
@@ -13,5 +15,5 @@ type ListBoxGroupViewProps = {
13
15
  selectedId?: string;
14
16
  uncheckedShape: "box" | "none";
15
17
  };
16
- export declare function ListBoxGroupView({ group, groupIndex, isItemChecked, listboxId, onActivateItem, onDoubleClickItem, onToggleItemCheck, registerItemRef, resolvedActiveId, rightCheckBox, selectedId, uncheckedShape }: ListBoxGroupViewProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function ListBoxGroupView({ group, groupIndex, isItemChecked, listboxId, onActivateItem, onDoubleClickItem, onPopupMenuItem, onToggleItemCheck, registerItemRef, resolvedActiveId, rightCheckBox, selectedId, uncheckedShape }: ListBoxGroupViewProps): import("react/jsx-runtime").JSX.Element;
17
19
  export {};
@@ -1,3 +1,4 @@
1
+ import { MouseEvent } from "react";
1
2
  import { ListBoxGroup, ListBoxItem } from "./types";
2
3
  type ListBoxItemViewProps = {
3
4
  group: ListBoxGroup;
@@ -8,11 +9,12 @@ type ListBoxItemViewProps = {
8
9
  itemId: string;
9
10
  onActivate: (item: ListBoxItem, group: ListBoxGroup, itemId: string) => void;
10
11
  onDoubleClick?: (item: ListBoxItem, group: ListBoxGroup) => void;
12
+ onPopupMenu?: (event: MouseEvent<HTMLDivElement>, item: ListBoxItem, group: ListBoxGroup, itemId: string) => void;
11
13
  onToggleCheck: (itemId: string) => void;
12
14
  registerItemRef: (itemId: string, node: HTMLDivElement | null) => void;
13
15
  rightCheckBox: boolean;
14
16
  uncheckedShape: "box" | "none";
15
17
  };
16
- declare function ListBoxItemViewInner({ group, isActive, isChecked, isSelected, item, itemId, onActivate, onDoubleClick, onToggleCheck, registerItemRef, rightCheckBox, uncheckedShape }: ListBoxItemViewProps): import("react/jsx-runtime").JSX.Element;
18
+ declare function ListBoxItemViewInner({ group, isActive, isChecked, isSelected, item, itemId, onActivate, onPopupMenu, onDoubleClick, onToggleCheck, registerItemRef, rightCheckBox, uncheckedShape }: ListBoxItemViewProps): import("react/jsx-runtime").JSX.Element;
17
19
  export declare const ListBoxItemView: import("react").MemoExoticComponent<typeof ListBoxItemViewInner>;
18
20
  export {};
@@ -1,6 +1,7 @@
1
1
  import { HTMLAttributes } from "react";
2
2
  import { MainMenuItem, MainMenuNode } from "../MainMenu/MainMenu.types";
3
3
  export type PopupMenuPointAnchor = {
4
+ themeSource?: HTMLElement;
4
5
  type: "point";
5
6
  x: number;
6
7
  y: number;
@@ -5,7 +5,7 @@ export declare function usePopupMenu(): {
5
5
  close: () => void;
6
6
  open: boolean;
7
7
  openAtElement: (element: HTMLElement) => void;
8
- openAtPoint: (x: number, y: number) => void;
8
+ openAtPoint: (x: number, y: number, themeSource?: HTMLElement) => void;
9
9
  openFromClick: (event: MouseEvent<HTMLElement>) => void;
10
10
  openFromContextMenu: (event: MouseEvent<HTMLElement>) => void;
11
11
  setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
@@ -1,5 +1,5 @@
1
- import { ForwardedRef, HTMLAttributes, RefAttributes } from "react";
2
- import { TreeListColumn, TreeListGetCellContent, TreeListItemBase } from "./internals/types";
1
+ import { ForwardedRef, HTMLAttributes, MouseEvent, RefAttributes } from "react";
2
+ import { TreeListColumn, TreeListCellContext, TreeListGetCellContent, TreeListItemBase } from "./internals/types";
3
3
  export type { TreeListCellContext, TreeListColumn, TreeListGetCellContent, TreeListItemBase } from "./internals/types";
4
4
  export type TreeListViewHandle = {
5
5
  activateItem: (itemId: string) => void;
@@ -13,6 +13,7 @@ export type TreeListViewHandle = {
13
13
  export type TreeListViewProps<T extends TreeListItemBase<T>> = Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> & {
14
14
  activeItemId?: string;
15
15
  checkedIds?: string[];
16
+ onPopupMenu?: (event: MouseEvent<HTMLDivElement>, item: T, context: TreeListCellContext<T>) => void;
16
17
  columns: TreeListColumn<T>[];
17
18
  data: T[];
18
19
  dataVersion?: number;
@@ -29,5 +30,5 @@ export type TreeListViewProps<T extends TreeListItemBase<T>> = Omit<HTMLAttribut
29
30
  selectedId?: string;
30
31
  uncheckedShape?: "box" | "none";
31
32
  };
32
- declare function TreeListViewInner<T extends TreeListItemBase<T>>({ activeItemId: activeItemIdProp, checkedIds, className, columns, data, dataVersion, defaultActiveItemId, defaultExpandedIds, emptyText, expandedIds, getCellContent, onActiveItemChange, onExpandedIdsChange, onItemCheckChange, onItemDoubleClick, onItemSelect, selectedId, uncheckedShape, ...props }: TreeListViewProps<T>, ref: ForwardedRef<TreeListViewHandle>): import("react/jsx-runtime").JSX.Element;
33
+ declare function TreeListViewInner<T extends TreeListItemBase<T>>({ activeItemId: activeItemIdProp, checkedIds, className, columns, onPopupMenu, data, dataVersion, defaultActiveItemId, defaultExpandedIds, emptyText, expandedIds, getCellContent, onActiveItemChange, onExpandedIdsChange, onItemCheckChange, onItemDoubleClick, onItemSelect, selectedId, uncheckedShape, ...props }: TreeListViewProps<T>, ref: ForwardedRef<TreeListViewHandle>): import("react/jsx-runtime").JSX.Element;
33
34
  export declare const TreeListView: <T extends TreeListItemBase<T>>(props: TreeListViewProps<T> & RefAttributes<TreeListViewHandle>) => ReturnType<typeof TreeListViewInner>;
@@ -1,4 +1,5 @@
1
- import { TreeListColumn, TreeListGetCellContent, TreeListItemBase } from "./types";
1
+ import { MouseEvent } from "react";
2
+ import { TreeListCellContext, TreeListColumn, TreeListGetCellContent, TreeListItemBase } from "./types";
2
3
  type TreeListViewRowProps<T extends TreeListItemBase<T>> = {
3
4
  activeItemId: string | null;
4
5
  checkedIds?: string[];
@@ -12,6 +13,7 @@ type TreeListViewRowProps<T extends TreeListItemBase<T>> = {
12
13
  item: T;
13
14
  onActivateItem: (item: T, itemId: string) => void;
14
15
  onDoubleClickItem?: (item: T) => void;
16
+ onPopupMenuItem?: (event: MouseEvent<HTMLDivElement>, item: T, context: TreeListCellContext<T>) => void;
15
17
  onToggleItemCheck?: (item: T, checked: boolean) => void;
16
18
  onToggleItemExpanded: (item: T, expanded: boolean) => void;
17
19
  originOffset: number;
@@ -23,6 +25,6 @@ type TreeListViewRowProps<T extends TreeListItemBase<T>> = {
23
25
  treeId: string;
24
26
  uncheckedShape: "box" | "none";
25
27
  };
26
- declare function TreeListViewRowInner<T extends TreeListItemBase<T>>({ activeItemId, checkedIds, columns, depth, expandedIdSet, getCellContent, guideMask, guideOffsets, hasNextSibling, item, onActivateItem, onDoubleClickItem, onToggleItemCheck, onToggleItemExpanded, originOffset, registerItemRef, rowIndexMap, selectedItemId, templateColumns, treeColumnId, treeId, uncheckedShape }: TreeListViewRowProps<T>): import("react/jsx-runtime").JSX.Element;
28
+ declare function TreeListViewRowInner<T extends TreeListItemBase<T>>({ activeItemId, checkedIds, columns, depth, expandedIdSet, getCellContent, guideMask, guideOffsets, hasNextSibling, item, onActivateItem, onDoubleClickItem, onPopupMenuItem, onToggleItemCheck, onToggleItemExpanded, originOffset, registerItemRef, rowIndexMap, selectedItemId, templateColumns, treeColumnId, treeId, uncheckedShape }: TreeListViewRowProps<T>): import("react/jsx-runtime").JSX.Element;
27
29
  export declare const TreeListViewRow: typeof TreeListViewRowInner;
28
30
  export {};