@vuu-ui/vuu-layout 0.8.4-debug → 0.8.5-debug
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/cjs/index.js +3439 -507
- package/cjs/index.js.map +4 -4
- package/esm/index.js +3379 -404
- package/esm/index.js.map +4 -4
- package/index.css +418 -0
- package/index.css.map +3 -3
- package/package.json +3 -3
- package/types/flexbox/flexboxTypes.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/layout-reducer/layoutTypes.d.ts +8 -1
- package/types/layout-reducer/move-layout-element.d.ts +3 -0
- package/types/overflow-container/OverflowContainer.d.ts +10 -0
- package/types/overflow-container/index.d.ts +2 -0
- package/types/overflow-container/overflow-utils.d.ts +47 -0
- package/types/overflow-container/useOverflowContainer.d.ts +11 -0
- package/types/responsive/useResizeObserver.d.ts +1 -0
- package/types/stack/stackTypes.d.ts +3 -4
- package/types/utils/index.d.ts +1 -0
- package/types/utils/react-utils.d.ts +4 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from "react";
|
|
2
|
+
import "./OverflowContainer.css";
|
|
3
|
+
import { OverflowItem } from "./overflow-utils";
|
|
4
|
+
export interface OverflowContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
debugId?: string;
|
|
6
|
+
height: number;
|
|
7
|
+
onSwitchWrappedItemIntoView?: (overflowItem: OverflowItem) => void;
|
|
8
|
+
overflowIcon?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const OverflowContainer: React.ForwardRefExoticComponent<OverflowContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type OverflowItem = {
|
|
2
|
+
index: string;
|
|
3
|
+
label: string;
|
|
4
|
+
overflowPriority: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const sortByScreenOrder: (elements: HTMLElement[]) => HTMLElement[];
|
|
7
|
+
export declare const NO_WRAPPED_ITEMS: OverflowItem[];
|
|
8
|
+
/**
|
|
9
|
+
Identify wrapped items by comparing position of each item. Any item
|
|
10
|
+
not to the right of preceeding item has wrapped. Note: on-screen
|
|
11
|
+
position of items does not necessarily match document position, due
|
|
12
|
+
to use of css order. This is taken into account by sorting.
|
|
13
|
+
TODO support Vertical orientation
|
|
14
|
+
*/
|
|
15
|
+
export declare const getNonWrappedAndWrappedItems: (container: HTMLElement) => [OverflowItem[], OverflowItem[]];
|
|
16
|
+
export declare const applyOverflowClassToWrappedItems: (container: HTMLElement, overflowedItems: OverflowItem[]) => void;
|
|
17
|
+
export declare const overflowIndicatorHasWrappedButShouldNotHave: (wrappedItems: OverflowItem[]) => boolean;
|
|
18
|
+
export declare const highPriorityItemsHaveWrappedButShouldNotHave: (nonWrappedItems: OverflowItem[], wrappedItems: OverflowItem[]) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
An edge case that may occur when reducing width from unwrapped to
|
|
21
|
+
wrapped, or on first render.
|
|
22
|
+
We overflow one or more items. Then, when the overflowIndicator assumes
|
|
23
|
+
full width, it may itself overflow.
|
|
24
|
+
*/
|
|
25
|
+
export declare const correctForWrappedOverflowIndicator: (container: HTMLElement, overflowedItems: OverflowItem[]) => Promise<OverflowItem[]>;
|
|
26
|
+
/**
|
|
27
|
+
An edge case that may occur when reducing width from unwrapped to
|
|
28
|
+
wrapped, or on first render.
|
|
29
|
+
We overflow one or more items. Then, when the overflowIndicator assumes
|
|
30
|
+
full width, it may itself overflow.
|
|
31
|
+
*/
|
|
32
|
+
export declare const correctForWrappedHighPriorityItems: (container: HTMLElement, nonWrapped: OverflowItem[], wrapped: OverflowItem[]) => Promise<[OverflowItem[], OverflowItem[]]>;
|
|
33
|
+
export declare const markElementAsWrapped: (container: HTMLElement, item: OverflowItem) => void;
|
|
34
|
+
export declare const getElementsMarkedAsWrapped: (container: HTMLElement) => HTMLElement[];
|
|
35
|
+
export declare const unmarkItemsWhichAreNoLongerWrapped: (container: HTMLElement, wrappedItems: OverflowItem[]) => void;
|
|
36
|
+
/**
|
|
37
|
+
An edge case. If container has grown but we still have one
|
|
38
|
+
wrapped item - could the wrapped item return to the fold if the overflow
|
|
39
|
+
indicaor were removed ?
|
|
40
|
+
*/
|
|
41
|
+
export declare const removeOverflowIndicatorIfNoLongerNeeded: (container: HTMLElement) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* This is used both when an overflow menu is used to select an overflowed item
|
|
44
|
+
* and when a high priority item has overflowed, whilst lower priority items
|
|
45
|
+
* remain in view.
|
|
46
|
+
*/
|
|
47
|
+
export declare const switchWrappedItemIntoView: (container: HTMLElement, overflowItem: OverflowItem) => [OverflowItem[], OverflowItem[]];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MenuActionHandler, MenuBuilder } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import { OverflowItem } from "./overflow-utils";
|
|
3
|
+
export interface OverflowContainerHookProps {
|
|
4
|
+
itemCount: number;
|
|
5
|
+
onSwitchWrappedItemIntoView?: (overflowItem: OverflowItem) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const useOverflowContainer: ({ itemCount, onSwitchWrappedItemIntoView, }: OverflowContainerHookProps) => {
|
|
8
|
+
menuActionHandler: MenuActionHandler;
|
|
9
|
+
menuBuilder: MenuBuilder<string, unknown>;
|
|
10
|
+
rootRef: (el: HTMLDivElement | null) => void;
|
|
11
|
+
};
|
|
@@ -9,4 +9,5 @@ export type measurements<T = string | number> = {
|
|
|
9
9
|
width?: T;
|
|
10
10
|
};
|
|
11
11
|
export type ResizeHandler = (measurements: measurements<number>) => void;
|
|
12
|
+
export declare const resizeObserver: ResizeObserver;
|
|
12
13
|
export declare function useResizeObserver(ref: RefObject<Element | HTMLElement | null>, dimensions: string[], onResize: ResizeHandler, reportInitialSize?: boolean): void;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { TabstripProps } from "@
|
|
1
|
+
import { TabstripProps } from "@vuu-ui/vuu-ui-controls";
|
|
2
2
|
import { HTMLAttributes, MouseEvent, ReactElement, ReactNode } from "react";
|
|
3
3
|
export interface StackProps extends Omit<HTMLAttributes<HTMLDivElement>, "onMouseDown"> {
|
|
4
4
|
active?: number;
|
|
5
5
|
createNewChild?: (index: number) => ReactElement;
|
|
6
|
-
enableAddTab?: boolean;
|
|
7
|
-
enableCloseTabs?: boolean;
|
|
8
6
|
getTabIcon?: (component: ReactElement, index: number) => string | undefined;
|
|
9
7
|
getTabLabel?: (component: ReactElement, index: number) => string | undefined;
|
|
10
8
|
keyBoardActivation?: "automatic" | "manual";
|
|
9
|
+
onAddTab?: () => void;
|
|
10
|
+
onMoveTab?: (fromIndex: number, toIndex: number) => void;
|
|
11
11
|
onMouseDown?: (e: MouseEvent, tabIndex: number) => void;
|
|
12
|
-
onTabAdd?: (tabIndex: number) => void;
|
|
13
12
|
onTabClose?: (tabIndex: number) => void;
|
|
14
13
|
onTabEdit?: (tabIndex: number, label: string) => void;
|
|
15
14
|
onTabSelectionChanged?: (nextIndex: number) => void;
|
package/types/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DependencyList, EffectCallback, ReactElement, ReactNode } from "react";
|
|
2
|
+
export declare const asReactElements: (children: ReactNode) => ReactElement[];
|
|
3
|
+
export declare const useLayoutEffectSkipFirst: (func: EffectCallback, deps: DependencyList) => void;
|
|
4
|
+
export declare const useId: (id?: string) => string;
|