@gamecrafters/base-ui 0.0.35 → 0.0.36
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.
- package/build/components/resizable/Resizable.d.ts +8 -2
- package/build/components/resizable/Resizable.types.d.ts +39 -8
- package/build/components/resizable/ResizableContext.d.ts +50 -0
- package/build/components/resizable/ResizablePanel.d.ts +11 -1
- package/build/components/resizable/ResizableResizeTrigger.d.ts +2 -1
- package/build/components/resizable/index.d.ts +21 -4
- package/build/components/resizable/resizableLayout.d.ts +36 -0
- package/build/components/resizable/useResizable.d.ts +31 -0
- package/build/main.cjs.js +70 -70
- package/build/main.esm.js +68 -68
- package/build/styles/main.css +1 -1
- package/package.json +91 -92
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
import type { ResizableInstance } from "./Resizable.types";
|
|
3
|
+
declare const _default: (props: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onResize"> & {
|
|
3
4
|
orientation?: import("./Resizable.types").ResizableOrientation;
|
|
4
|
-
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
disableCursor?: boolean;
|
|
7
|
+
defaultLayout?: import("./Resizable.types").ResizableLayout;
|
|
8
|
+
onLayoutChange?: (layout: import("./Resizable.types").ResizableLayout) => void;
|
|
9
|
+
onLayoutChanged?: (layout: import("./Resizable.types").ResizableLayout, details: import("./Resizable.types").ResizableLayoutChangeDetails) => void;
|
|
10
|
+
resizableRef?: React.Ref<ResizableInstance | null>;
|
|
5
11
|
className?: string;
|
|
6
12
|
} & React.RefAttributes<any>) => React.ReactNode;
|
|
7
13
|
export default _default;
|
|
@@ -1,18 +1,49 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
|
-
import type { GroupImperativeHandle, GroupProps, Layout, PanelImperativeHandle, PanelProps, SeparatorProps as PanelSeparatorProps } from "react-resizable-panels";
|
|
3
2
|
export type ResizableOrientation = "horizontal" | "vertical";
|
|
4
|
-
export type ResizableLayout =
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
7
|
-
|
|
3
|
+
export type ResizableLayout = Record<string, number>;
|
|
4
|
+
export type ResizablePanelSize = number | string;
|
|
5
|
+
export type ResizablePanelSizes = {
|
|
6
|
+
asPercentage: number;
|
|
7
|
+
inPixels: number;
|
|
8
|
+
};
|
|
9
|
+
export type ResizableLayoutChangeDetails = {
|
|
10
|
+
isUserInteraction: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ResizableInstance = {
|
|
13
|
+
getLayout: () => ResizableLayout;
|
|
14
|
+
setLayout: (layout: ResizableLayout) => ResizableLayout;
|
|
15
|
+
};
|
|
16
|
+
export type ResizablePanelInstance = {
|
|
17
|
+
collapse: () => void;
|
|
18
|
+
expand: () => void;
|
|
19
|
+
getSize: () => ResizablePanelSizes;
|
|
20
|
+
isCollapsed: () => boolean;
|
|
21
|
+
resize: (size: ResizablePanelSize) => void;
|
|
22
|
+
};
|
|
23
|
+
export type ResizableProps = Omit<React.ComponentPropsWithoutRef<"div">, "onResize"> & {
|
|
8
24
|
orientation?: ResizableOrientation;
|
|
9
|
-
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
disableCursor?: boolean;
|
|
27
|
+
defaultLayout?: ResizableLayout;
|
|
28
|
+
onLayoutChange?: (layout: ResizableLayout) => void;
|
|
29
|
+
onLayoutChanged?: (layout: ResizableLayout, details: ResizableLayoutChangeDetails) => void;
|
|
30
|
+
resizableRef?: React.Ref<ResizableInstance | null>;
|
|
10
31
|
className?: string;
|
|
11
32
|
};
|
|
12
|
-
export type ResizablePanelProps = Omit<
|
|
33
|
+
export type ResizablePanelProps = Omit<React.ComponentPropsWithoutRef<"div">, "onResize" | "id"> & {
|
|
34
|
+
id?: string | number;
|
|
35
|
+
defaultSize?: ResizablePanelSize;
|
|
36
|
+
minSize?: ResizablePanelSize;
|
|
37
|
+
maxSize?: ResizablePanelSize;
|
|
38
|
+
collapsible?: boolean;
|
|
39
|
+
collapsedSize?: ResizablePanelSize;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
onResize?: (size: ResizablePanelSizes, id: string, previous: ResizablePanelSizes | undefined) => void;
|
|
42
|
+
panelRef?: React.Ref<ResizablePanelInstance | null>;
|
|
13
43
|
className?: string;
|
|
14
44
|
};
|
|
15
|
-
export type ResizableResizeTriggerProps =
|
|
45
|
+
export type ResizableResizeTriggerProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
46
|
+
disabled?: boolean;
|
|
16
47
|
className?: string;
|
|
17
48
|
};
|
|
18
49
|
export type ResizableResizeTriggerSeparatorProps = React.ComponentPropsWithoutRef<"span"> & {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { UseResizableReturn } from "./useResizable";
|
|
2
|
+
export type ResizableContextValue = Partial<UseResizableReturn>;
|
|
3
|
+
export declare const ResizableContext: import("react").Context<Partial<{
|
|
4
|
+
groupRef: import("react").RefObject<HTMLDivElement | null>;
|
|
5
|
+
orientation: import("./Resizable.types").ResizableOrientation;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
layout: import("./Resizable.types").ResizableLayout;
|
|
8
|
+
registerPanel: (record: import("./resizableLayout").ResizablePanelRecord & {
|
|
9
|
+
onResize?: (size: import("./Resizable.types").ResizablePanelSizes, id: string, previous: import("./Resizable.types").ResizablePanelSizes | undefined) => void;
|
|
10
|
+
}) => () => void;
|
|
11
|
+
sizeOf: (id: string) => number;
|
|
12
|
+
startDrag: (trigger: HTMLElement, event: React.PointerEvent) => void;
|
|
13
|
+
moveDrag: (event: React.PointerEvent) => void;
|
|
14
|
+
endDrag: (trigger: HTMLElement, event: React.PointerEvent) => void;
|
|
15
|
+
handleTriggerKeyDown: (trigger: HTMLElement, event: React.KeyboardEvent) => void;
|
|
16
|
+
resetAt: (trigger: HTMLElement) => void;
|
|
17
|
+
collapsePanel: (id: string) => void;
|
|
18
|
+
expandPanel: (id: string) => void;
|
|
19
|
+
resizePanel: (id: string, size: import("./Resizable.types").ResizablePanelSize) => void;
|
|
20
|
+
panelSizes: (id: string) => import("./Resizable.types").ResizablePanelSizes;
|
|
21
|
+
isPanelCollapsed: (id: string) => boolean;
|
|
22
|
+
getLayout: () => {
|
|
23
|
+
[x: string]: number;
|
|
24
|
+
};
|
|
25
|
+
setLayout: (next: import("./Resizable.types").ResizableLayout) => import("./Resizable.types").ResizableLayout;
|
|
26
|
+
}>>;
|
|
27
|
+
export declare const useResizableContext: () => Partial<{
|
|
28
|
+
groupRef: import("react").RefObject<HTMLDivElement | null>;
|
|
29
|
+
orientation: import("./Resizable.types").ResizableOrientation;
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
layout: import("./Resizable.types").ResizableLayout;
|
|
32
|
+
registerPanel: (record: import("./resizableLayout").ResizablePanelRecord & {
|
|
33
|
+
onResize?: (size: import("./Resizable.types").ResizablePanelSizes, id: string, previous: import("./Resizable.types").ResizablePanelSizes | undefined) => void;
|
|
34
|
+
}) => () => void;
|
|
35
|
+
sizeOf: (id: string) => number;
|
|
36
|
+
startDrag: (trigger: HTMLElement, event: React.PointerEvent) => void;
|
|
37
|
+
moveDrag: (event: React.PointerEvent) => void;
|
|
38
|
+
endDrag: (trigger: HTMLElement, event: React.PointerEvent) => void;
|
|
39
|
+
handleTriggerKeyDown: (trigger: HTMLElement, event: React.KeyboardEvent) => void;
|
|
40
|
+
resetAt: (trigger: HTMLElement) => void;
|
|
41
|
+
collapsePanel: (id: string) => void;
|
|
42
|
+
expandPanel: (id: string) => void;
|
|
43
|
+
resizePanel: (id: string, size: import("./Resizable.types").ResizablePanelSize) => void;
|
|
44
|
+
panelSizes: (id: string) => import("./Resizable.types").ResizablePanelSizes;
|
|
45
|
+
isPanelCollapsed: (id: string) => boolean;
|
|
46
|
+
getLayout: () => {
|
|
47
|
+
[x: string]: number;
|
|
48
|
+
};
|
|
49
|
+
setLayout: (next: import("./Resizable.types").ResizableLayout) => import("./Resizable.types").ResizableLayout;
|
|
50
|
+
}>;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
import type { ResizablePanelInstance } from "./Resizable.types";
|
|
3
|
+
declare const _default: (props: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "id" | "onResize"> & {
|
|
4
|
+
id?: string | number;
|
|
5
|
+
defaultSize?: import("./Resizable.types").ResizablePanelSize;
|
|
6
|
+
minSize?: import("./Resizable.types").ResizablePanelSize;
|
|
7
|
+
maxSize?: import("./Resizable.types").ResizablePanelSize;
|
|
8
|
+
collapsible?: boolean;
|
|
9
|
+
collapsedSize?: import("./Resizable.types").ResizablePanelSize;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onResize?: (size: import("./Resizable.types").ResizablePanelSizes, id: string, previous: import("./Resizable.types").ResizablePanelSizes | undefined) => void;
|
|
12
|
+
panelRef?: React.Ref<ResizablePanelInstance | null>;
|
|
3
13
|
className?: string;
|
|
4
14
|
} & React.RefAttributes<any>) => React.ReactNode;
|
|
5
15
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const _default: (props: Omit<
|
|
2
|
+
declare const _default: (props: Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
disabled?: boolean;
|
|
3
4
|
className?: string;
|
|
4
5
|
} & React.RefAttributes<any>) => React.ReactNode;
|
|
5
6
|
export default _default;
|
|
@@ -2,15 +2,30 @@ import ResizablePanel from "./ResizablePanel";
|
|
|
2
2
|
import ResizableResizeTrigger from "./ResizableResizeTrigger";
|
|
3
3
|
import ResizableResizeTriggerIndicator from "./ResizableResizeTriggerIndicator";
|
|
4
4
|
import ResizableResizeTriggerSeparator from "./ResizableResizeTriggerSeparator";
|
|
5
|
-
export declare const Resizable: ((props: Omit<import("react
|
|
5
|
+
export declare const Resizable: ((props: Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onResize"> & {
|
|
6
6
|
orientation?: import("./Resizable.types").ResizableOrientation;
|
|
7
|
-
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
disableCursor?: boolean;
|
|
9
|
+
defaultLayout?: import("./Resizable.types").ResizableLayout;
|
|
10
|
+
onLayoutChange?: (layout: import("./Resizable.types").ResizableLayout) => void;
|
|
11
|
+
onLayoutChanged?: (layout: import("./Resizable.types").ResizableLayout, details: import("./Resizable.types").ResizableLayoutChangeDetails) => void;
|
|
12
|
+
resizableRef?: React.Ref<import("./Resizable.types").ResizableInstance | null>;
|
|
8
13
|
className?: string;
|
|
9
14
|
} & import("react").RefAttributes<any>) => React.ReactNode) & {
|
|
10
|
-
Panel: (props: Omit<import("react
|
|
15
|
+
Panel: (props: Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "id" | "onResize"> & {
|
|
16
|
+
id?: string | number;
|
|
17
|
+
defaultSize?: import("./Resizable.types").ResizablePanelSize;
|
|
18
|
+
minSize?: import("./Resizable.types").ResizablePanelSize;
|
|
19
|
+
maxSize?: import("./Resizable.types").ResizablePanelSize;
|
|
20
|
+
collapsible?: boolean;
|
|
21
|
+
collapsedSize?: import("./Resizable.types").ResizablePanelSize;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
onResize?: (size: import("./Resizable.types").ResizablePanelSizes, id: string, previous: import("./Resizable.types").ResizablePanelSizes | undefined) => void;
|
|
24
|
+
panelRef?: React.Ref<import("./Resizable.types").ResizablePanelInstance | null>;
|
|
11
25
|
className?: string;
|
|
12
26
|
} & import("react").RefAttributes<any>) => React.ReactNode;
|
|
13
|
-
ResizeTrigger: (props: Omit<import("react
|
|
27
|
+
ResizeTrigger: (props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
28
|
+
disabled?: boolean;
|
|
14
29
|
className?: string;
|
|
15
30
|
} & import("react").RefAttributes<any>) => React.ReactNode;
|
|
16
31
|
ResizeTriggerSeparator: (props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
@@ -21,4 +36,6 @@ export declare const Resizable: ((props: Omit<import("react-resizable-panels").G
|
|
|
21
36
|
} & import("react").RefAttributes<any>) => React.ReactNode;
|
|
22
37
|
};
|
|
23
38
|
export { ResizablePanel, ResizableResizeTrigger, ResizableResizeTriggerSeparator, ResizableResizeTriggerIndicator, };
|
|
39
|
+
export { ResizableContext, useResizableContext } from "./ResizableContext";
|
|
40
|
+
export { useResizable } from "./useResizable";
|
|
24
41
|
export * from "./Resizable.types";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ResizableLayout, ResizablePanelSize } from "./Resizable.types";
|
|
2
|
+
export type ResizableSizeContext = {
|
|
3
|
+
availablePx: number;
|
|
4
|
+
remPx: number;
|
|
5
|
+
emPx: number;
|
|
6
|
+
vhPx: number;
|
|
7
|
+
vwPx: number;
|
|
8
|
+
};
|
|
9
|
+
export type ResizableConstraints = {
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
|
+
collapsedTo: number;
|
|
13
|
+
collapsible: boolean;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type ResizablePanelRecord = {
|
|
17
|
+
id: string;
|
|
18
|
+
defaultSize?: ResizablePanelSize;
|
|
19
|
+
minSize?: ResizablePanelSize;
|
|
20
|
+
maxSize?: ResizablePanelSize;
|
|
21
|
+
collapsedSize?: ResizablePanelSize;
|
|
22
|
+
collapsible?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare const clamp: (value: number, low: number, high: number) => number;
|
|
26
|
+
export declare const sum: (values: number[]) => number;
|
|
27
|
+
export declare const toPercentage: (size: ResizablePanelSize | undefined, context: ResizableSizeContext) => number | undefined;
|
|
28
|
+
export declare const constraintsOf: (panel: ResizablePanelRecord, context: ResizableSizeContext) => ResizableConstraints;
|
|
29
|
+
export declare const floorOf: (constraints: ResizableConstraints) => number;
|
|
30
|
+
export declare const isCollapsed: (size: number, constraints: ResizableConstraints) => boolean;
|
|
31
|
+
export declare const startingSizes: (panels: ResizablePanelRecord[], context: ResizableSizeContext, saved?: ResizableLayout) => number[];
|
|
32
|
+
export declare const settle: (sizes: number[], constraints: ResizableConstraints[]) => number[];
|
|
33
|
+
export declare const setSizeAt: (sizes: number[], constraints: ResizableConstraints[], index: number, target: number) => number[];
|
|
34
|
+
export declare const resizeAt: (sizes: number[], constraints: ResizableConstraints[], index: number, delta: number) => number[];
|
|
35
|
+
export declare const toLayout: (panels: ResizablePanelRecord[], sizes: number[]) => ResizableLayout;
|
|
36
|
+
export declare const sameLayout: (left: ResizableLayout, right: ResizableLayout) => boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ResizablePanelRecord } from "./resizableLayout";
|
|
3
|
+
import type { ResizableLayout, ResizableOrientation, ResizablePanelSize, ResizablePanelSizes, ResizableProps } from "./Resizable.types";
|
|
4
|
+
type PanelRegistration = ResizablePanelRecord & {
|
|
5
|
+
onResize?: (size: ResizablePanelSizes, id: string, previous: ResizablePanelSizes | undefined) => void;
|
|
6
|
+
};
|
|
7
|
+
export type UseResizableProps = Pick<ResizableProps, "orientation" | "disabled" | "disableCursor" | "defaultLayout" | "onLayoutChange" | "onLayoutChanged">;
|
|
8
|
+
export declare const useResizable: (props?: UseResizableProps) => {
|
|
9
|
+
groupRef: React.RefObject<HTMLDivElement | null>;
|
|
10
|
+
orientation: ResizableOrientation;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
layout: ResizableLayout;
|
|
13
|
+
registerPanel: (record: PanelRegistration) => () => void;
|
|
14
|
+
sizeOf: (id: string) => number;
|
|
15
|
+
startDrag: (trigger: HTMLElement, event: React.PointerEvent) => void;
|
|
16
|
+
moveDrag: (event: React.PointerEvent) => void;
|
|
17
|
+
endDrag: (trigger: HTMLElement, event: React.PointerEvent) => void;
|
|
18
|
+
handleTriggerKeyDown: (trigger: HTMLElement, event: React.KeyboardEvent) => void;
|
|
19
|
+
resetAt: (trigger: HTMLElement) => void;
|
|
20
|
+
collapsePanel: (id: string) => void;
|
|
21
|
+
expandPanel: (id: string) => void;
|
|
22
|
+
resizePanel: (id: string, size: ResizablePanelSize) => void;
|
|
23
|
+
panelSizes: (id: string) => ResizablePanelSizes;
|
|
24
|
+
isPanelCollapsed: (id: string) => boolean;
|
|
25
|
+
getLayout: () => {
|
|
26
|
+
[x: string]: number;
|
|
27
|
+
};
|
|
28
|
+
setLayout: (next: ResizableLayout) => ResizableLayout;
|
|
29
|
+
};
|
|
30
|
+
export type UseResizableReturn = ReturnType<typeof useResizable>;
|
|
31
|
+
export {};
|