@gusarov-studio/rubik-ui 9.3.0 → 9.4.1

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.
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { FileTab } from "./types";
3
+ interface FileTabsTriggerDragLayerProps {
4
+ tab: FileTab;
5
+ }
6
+ declare const FileTabsTriggerDragLayer: React.FC<FileTabsTriggerDragLayerProps>;
7
+ export { FileTabsTriggerDragLayer, type FileTabsTriggerDragLayerProps };
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import type { FileTab, WidthValue } from "./types";
3
+ import "./FileTabs.scss";
4
+ interface FileTabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onClick"> {
5
+ tabs: FileTab[];
6
+ activeTabId: FileTab["id"];
7
+ onTabSelect: (tab: FileTab, event?: React.MouseEvent) => void;
8
+ onContextClick?: (tab: FileTab, event?: React.MouseEvent) => void;
9
+ onReorder?: (reorderedFileTabs: FileTab[]) => void;
10
+ onClose: (tab: FileTab, event?: React.MouseEvent) => void;
11
+ onAddClick?: (event?: React.MouseEvent) => void;
12
+ minTabSize?: WidthValue;
13
+ maxTabSize?: WidthValue;
14
+ draggable?: boolean;
15
+ dropdownInvisibleTabs?: boolean;
16
+ }
17
+ declare const FileTabs: React.ForwardRefExoticComponent<FileTabsProps & React.RefAttributes<HTMLDivElement>>;
18
+ export { FileTabs, type FileTabsProps };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const FileTabsDragLayer: React.FC;
3
+ export { FileTabsDragLayer };
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import type { FileTab, DropSideType, WidthValue } from "./types";
3
+ interface FileTabsTriggerProps {
4
+ tab: FileTab;
5
+ active: boolean;
6
+ onTabSelect: (tab: FileTab, event?: React.MouseEvent) => void;
7
+ onContextClick?: (tab: FileTab, event?: React.MouseEvent) => void;
8
+ reorder: (draggedTabId: string, targetTabId: string, dropSide: DropSideType | null) => void;
9
+ onClose: (tab: FileTab, event?: React.MouseEvent) => void;
10
+ draggable?: boolean;
11
+ minTabSize?: WidthValue;
12
+ maxTabSize?: WidthValue;
13
+ setAutoScrollable?: (cadDrop: boolean) => void;
14
+ }
15
+ declare const FileTabsTrigger: React.ForwardRefExoticComponent<FileTabsTriggerProps & React.RefAttributes<HTMLDivElement>>;
16
+ export { FileTabsTrigger, type FileTabsTriggerProps };
@@ -0,0 +1,5 @@
1
+ declare const dropSide: {
2
+ readonly LEFT: "left";
3
+ readonly RIGHT: "right";
4
+ };
5
+ export { dropSide };
@@ -0,0 +1,2 @@
1
+ export * from "./dropSide";
2
+ export * from "./triggerClassname";
@@ -0,0 +1,2 @@
1
+ declare const triggerClassname = "r-file-tabs__trigger";
2
+ export { triggerClassname };
@@ -0,0 +1,4 @@
1
+ export * from "./useDragFileTab";
2
+ export * from "./useDropFileTab";
3
+ export * from "./useFocusScrolling";
4
+ export * from "./useScrollbarSync";
@@ -0,0 +1,6 @@
1
+ import { type ConnectDragSource } from "react-dnd";
2
+ import type { FileTab } from "../types";
3
+ declare const useDragFileTab: (tab: FileTab, draggable?: boolean) => [{
4
+ isDragging: boolean;
5
+ }, ConnectDragSource];
6
+ export { useDragFileTab };
@@ -0,0 +1,15 @@
1
+ import { type RefObject } from "react";
2
+ import { type DragElementWrapper } from "react-dnd";
3
+ import type { FileTab, DropSideType } from "../types";
4
+ interface UseDropFileTabParams {
5
+ tab: FileTab;
6
+ triggerRef: RefObject<HTMLElement>;
7
+ reorder: (draggedTabId: string, targetTabId: string, hoverSide: DropSideType | null) => void;
8
+ setAutoScrollable?: (cadDrop: boolean) => void;
9
+ }
10
+ declare const useDropFileTab: ({ tab, triggerRef, reorder, setAutoScrollable, }: UseDropFileTabParams) => [{
11
+ isOver: boolean;
12
+ canDrop: boolean;
13
+ dropSide: DropSideType | null;
14
+ }, DragElementWrapper<HTMLElement>];
15
+ export { useDropFileTab };
@@ -0,0 +1,3 @@
1
+ import { type RefObject } from "react";
2
+ declare const useFocusScrolling: (containerRef: RefObject<HTMLDivElement>) => void;
3
+ export { useFocusScrolling };
@@ -0,0 +1,12 @@
1
+ import { type RefObject } from "react";
2
+ import type { FileTab, WidthValue } from "../types";
3
+ interface UseScrollbarSyncParams {
4
+ unpinnedRef: RefObject<HTMLDivElement>;
5
+ scrollbarContainerRef: RefObject<HTMLDivElement>;
6
+ scrollbarContentRef: RefObject<HTMLDivElement>;
7
+ tabs: FileTab[];
8
+ minTabSize?: WidthValue;
9
+ maxTabSize?: WidthValue;
10
+ }
11
+ declare const useScrollbarSync: ({ unpinnedRef, scrollbarContainerRef, scrollbarContentRef, tabs, minTabSize, maxTabSize, }: UseScrollbarSyncParams) => void;
12
+ export { useScrollbarSync };
@@ -0,0 +1 @@
1
+ export * from "./FileTabs";
@@ -0,0 +1,15 @@
1
+ import type React from "react";
2
+ import type { ValueOf } from "../types/ValueOf";
3
+ import type { dropSide } from "./constants";
4
+ import type { CSSUnit } from "../types/CSSUnit";
5
+ interface FileTab {
6
+ id: string;
7
+ type: string;
8
+ label: string;
9
+ icon?: React.ReactNode;
10
+ closeable?: boolean;
11
+ pinned?: boolean;
12
+ }
13
+ type DropSideType = ValueOf<typeof dropSide>;
14
+ type WidthValue = CSSUnit | "0" | `calc(${string})` | number | "unset";
15
+ export type { FileTab, DropSideType, WidthValue };
@@ -0,0 +1,2 @@
1
+ import type { DropTargetMonitor } from "react-dnd";
2
+ export declare const getDropSide: (monitor: DropTargetMonitor, element: HTMLElement) => "left" | "right" | null;
@@ -0,0 +1,4 @@
1
+ import type { XYCoord } from "react-dnd";
2
+ import type React from "react";
3
+ declare const getItemStyles: (currentOffset: XYCoord) => React.CSSProperties;
4
+ export { getItemStyles };
@@ -0,0 +1,3 @@
1
+ import { getDropSide } from "./getDropSide";
2
+ import { getItemStyles } from "./getItemStyles";
3
+ export { getDropSide, getItemStyles };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from "./CloseButton";
12
12
  export * from "./ContextMenu";
13
13
  export * from "./Dropdown";
14
14
  export * from "./FeatureIcon";
15
+ export * from "./FileTabs";
15
16
  export * from "./Icon";
16
17
  export * from "./IconButton";
17
18
  export * from "./InputSlider";