@linzjs/step-ag-grid 12.1.0 → 12.1.2
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/dist/src/components/GridCell.d.ts +2 -2
- package/dist/src/components/GridCellMultiEditor.d.ts +4 -4
- package/dist/src/components/gridFilter/GridFilterButtons.d.ts +3 -3
- package/dist/src/components/gridFilter/index.d.ts +3 -0
- package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +1 -1
- package/dist/src/components/gridForm/index.d.ts +9 -0
- package/dist/src/components/gridHeader/index.d.ts +1 -0
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +1 -1
- package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +1 -1
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +1 -1
- package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +1 -1
- package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +1 -1
- package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +1 -1
- package/dist/src/components/gridPopoverEdit/index.d.ts +8 -0
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +1 -1
- package/dist/src/components/gridRender/index.d.ts +2 -0
- package/dist/src/components/index.d.ts +16 -0
- package/dist/src/contexts/GridPopoverContextProvider.d.ts +1 -1
- package/dist/src/index.d.ts +6 -38
- package/dist/src/lui/ActionButton.d.ts +2 -2
- package/dist/src/lui/TextInputFormatted.d.ts +1 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +1 -1
- package/dist/src/react-menu3/components/Menu.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +1 -1
- package/dist/src/react-menu3/utils/utils.d.ts +1 -1
- package/dist/step-ag-grid.esm.js +7248 -7238
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Grid.tsx +8 -7
- package/src/components/GridCell.tsx +8 -7
- package/src/components/GridCellMultiEditor.tsx +5 -4
- package/src/components/GridFilter.ts +1 -0
- package/src/components/GridIcon.tsx +1 -0
- package/src/components/GridLoadableCell.tsx +1 -0
- package/src/components/GridPopoverHook.tsx +3 -2
- package/src/components/PostSortRowsHook.ts +4 -3
- package/src/components/gridFilter/GridFilterButtons.tsx +4 -2
- package/src/components/gridFilter/GridFilterQuick.tsx +1 -0
- package/src/components/gridFilter/index.ts +3 -0
- package/src/components/gridForm/GridFormDropDown.tsx +10 -9
- package/src/components/gridForm/GridFormEditBearing.tsx +4 -3
- package/src/components/gridForm/GridFormMessage.tsx +3 -2
- package/src/components/gridForm/GridFormMultiSelect.tsx +15 -13
- package/src/components/gridForm/GridFormPopoverMenu.tsx +7 -6
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +3 -2
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +2 -1
- package/src/components/gridForm/GridFormTextArea.tsx +4 -3
- package/src/components/gridForm/GridFormTextInput.tsx +4 -3
- package/src/components/gridForm/index.ts +9 -0
- package/src/components/gridHeader/GridHeaderSelect.tsx +1 -1
- package/src/components/gridHeader/index.ts +1 -0
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +1 -1
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +3 -2
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +1 -1
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +1 -1
- package/src/components/gridPopoverEdit/GridPopoverMessage.ts +1 -1
- package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +1 -1
- package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +1 -1
- package/src/components/gridPopoverEdit/index.ts +8 -0
- package/src/components/gridRender/GridRenderGenericCell.tsx +3 -2
- package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +2 -0
- package/src/components/gridRender/index.ts +2 -0
- package/src/components/index.ts +16 -0
- package/src/contexts/GridContext.tsx +2 -1
- package/src/contexts/GridContextProvider.tsx +5 -4
- package/src/contexts/GridPopoverContext.tsx +2 -1
- package/src/contexts/GridPopoverContextProvider.tsx +4 -3
- package/src/contexts/GridUpdatingContextProvider.tsx +2 -1
- package/src/index.ts +7 -45
- package/src/lui/ActionButton.tsx +5 -4
- package/src/lui/TextAreaInput.tsx +3 -2
- package/src/lui/TextInputFormatted.tsx +3 -4
- package/src/lui/reactUtils.test.tsx +4 -3
- package/src/lui/stateDeferredHook.tsx +1 -0
- package/src/lui/timeoutHook.test.tsx +2 -1
- package/src/react-menu3/components/ControlledMenu.tsx +7 -6
- package/src/react-menu3/components/FocusableItem.tsx +3 -2
- package/src/react-menu3/components/Menu.tsx +8 -7
- package/src/react-menu3/components/MenuButton.tsx +3 -2
- package/src/react-menu3/components/MenuDivider.tsx +3 -2
- package/src/react-menu3/components/MenuGroup.tsx +5 -4
- package/src/react-menu3/components/MenuHeader.tsx +3 -2
- package/src/react-menu3/components/MenuItem.tsx +5 -4
- package/src/react-menu3/components/MenuList.tsx +11 -10
- package/src/react-menu3/components/MenuRadioGroup.tsx +4 -3
- package/src/react-menu3/components/SubMenu.tsx +26 -25
- package/src/react-menu3/contexts/EventHandlersContext.ts +1 -0
- package/src/react-menu3/contexts/MenuListContext.ts +2 -1
- package/src/react-menu3/contexts/MenuListItemContext.ts +2 -1
- package/src/react-menu3/contexts/RadioGroupContext.ts +1 -0
- package/src/react-menu3/contexts/SettingsContext.ts +2 -1
- package/src/react-menu3/hooks/useBEM.ts +1 -0
- package/src/react-menu3/hooks/useCombinedRef.ts +1 -1
- package/src/react-menu3/hooks/useItemEffect.ts +1 -0
- package/src/react-menu3/hooks/useItemState.ts +4 -3
- package/src/react-menu3/hooks/useItems.ts +3 -2
- package/src/react-menu3/hooks/useMenuChange.ts +3 -2
- package/src/react-menu3/hooks/useMenuState.ts +2 -1
- package/src/react-menu3/hooks/useMenuStateAndFocus.ts +2 -1
- package/src/react-menu3/positionUtils/getPositionHelpers.ts +2 -1
- package/src/react-menu3/positionUtils/placeLeftorRight.ts +3 -2
- package/src/react-menu3/positionUtils/placeToporBottom.ts +3 -2
- package/src/react-menu3/positionUtils/positionContextMenu.ts +1 -1
- package/src/react-menu3/positionUtils/positionMenu.ts +4 -3
- package/src/react-menu3/style-utils/index.ts +4 -4
- package/src/react-menu3/utils/propTypes2.ts +1 -1
- package/src/react-menu3/utils/utils.ts +3 -2
- package/src/react-menu3/utils/withHovering.tsx +2 -1
- package/src/stories/components/ActionButton.stories.tsx +4 -3
- package/src/stories/grid/FormTest.tsx +4 -7
- package/src/stories/grid/GridFilterButtons.stories.tsx +110 -0
- package/src/stories/grid/GridKeyboardInteractions.stories.tsx +23 -18
- package/src/stories/grid/GridNonEditableRow.stories.tsx +22 -17
- package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +7 -9
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +25 -18
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +14 -11
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +22 -15
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +20 -15
- package/src/stories/grid/GridReadOnly.stories.tsx +25 -21
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +10 -9
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +7 -8
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +7 -8
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +11 -10
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +12 -11
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +7 -7
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +7 -7
- package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +5 -6
- package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +10 -6
- package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +10 -6
- package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +5 -5
- package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +5 -6
- package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +8 -7
- package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +5 -6
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +5 -6
- package/src/stories/react-menu/ReactMenu.stories.tsx +3 -2
- package/src/utils/testQuick.ts +1 -0
- package/src/utils/testUtil.ts +2 -1
- package/src/utils/textValidator.test.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./react-menu3/types";
|
|
1
|
+
export * from "./components";
|
|
3
2
|
|
|
4
3
|
export * from "./contexts/GridContext";
|
|
5
4
|
export * from "./contexts/GridContextProvider";
|
|
@@ -9,50 +8,13 @@ export * from "./contexts/GridPopoverContext";
|
|
|
9
8
|
export * from "./contexts/GridPopoverContextProvider";
|
|
10
9
|
export * from "./contexts/GridSubComponentContext";
|
|
11
10
|
|
|
12
|
-
export type { GridBaseRow } from "./components/Grid";
|
|
13
|
-
export { Grid } from "./components/Grid";
|
|
14
|
-
export * from "./components/GridCell";
|
|
15
|
-
export * from "./components/GridCellMultiEditor";
|
|
16
|
-
|
|
17
|
-
export { GridIcon } from "./components/GridIcon";
|
|
18
|
-
export { ComponentLoadingWrapper } from "./components/ComponentLoadingWrapper";
|
|
19
|
-
export { GridCellMultiSelectClassRules } from "./components/GridCellMultiSelectClassRules";
|
|
20
|
-
export { GridLoadableCell } from "./components/GridLoadableCell";
|
|
21
|
-
export { useGridPopoverHook } from "./components/GridPopoverHook";
|
|
22
|
-
export { usePostSortRowsHook } from "./components/PostSortRowsHook";
|
|
23
|
-
|
|
24
|
-
export * from "./components/gridRender/GridRenderGenericCell";
|
|
25
|
-
export { GridRenderPopoutMenuCell } from "./components/gridRender/GridRenderPopoutMenuCell";
|
|
26
|
-
|
|
27
|
-
export { GridPopoutEditMultiSelect } from "./components/gridPopoverEdit/GridPopoutEditMultiSelect";
|
|
28
|
-
export { GridPopoverMenu } from "./components/gridPopoverEdit/GridPopoverMenu";
|
|
29
|
-
export { GridPopoverEditBearing } from "./components/gridPopoverEdit/GridPopoverEditBearing";
|
|
30
|
-
export { GridPopoverEditBearingCorrection } from "./components/gridPopoverEdit/GridPopoverEditBearing";
|
|
31
|
-
export { GridPopoverEditDropDown } from "./components/gridPopoverEdit/GridPopoverEditDropDown";
|
|
32
|
-
export { GridPopoverMessage } from "./components/gridPopoverEdit/GridPopoverMessage";
|
|
33
|
-
export { GridPopoverTextArea } from "./components/gridPopoverEdit/GridPopoverTextArea";
|
|
34
|
-
export { GridPopoverTextInput } from "./components/gridPopoverEdit/GridPopoverTextInput";
|
|
35
|
-
export { GridFormSubComponentTextInput } from "./components/gridForm/GridFormSubComponentTextInput";
|
|
36
|
-
export * from "./components/gridForm/GridFormDropDown";
|
|
37
|
-
export * from "./components/gridForm/GridFormMultiSelect";
|
|
38
|
-
export * from "./components/gridForm/GridFormPopoverMenu";
|
|
39
|
-
export * from "./components/gridForm/GridFormTextInput";
|
|
40
|
-
export * from "./components/gridForm/GridFormTextArea";
|
|
41
|
-
export * from "./components/gridForm/GridFormMessage";
|
|
42
|
-
export * from "./components/gridForm/GridFormEditBearing";
|
|
43
|
-
|
|
44
|
-
export { useGridFilter } from "./components/GridFilter";
|
|
45
|
-
export * from "./components/gridFilter/GridFilterQuick";
|
|
46
|
-
export * from "./components/gridFilter/GridFilters";
|
|
47
|
-
export * from "./components/GridWrapper";
|
|
48
|
-
|
|
49
|
-
export { GridHeaderSelect } from "./components/gridHeader/GridHeaderSelect";
|
|
50
|
-
|
|
51
|
-
export { TextAreaInput } from "./lui/TextAreaInput";
|
|
52
|
-
export { TextInputFormatted } from "./lui/TextInputFormatted";
|
|
53
|
-
export { GridFormSubComponentTextArea } from "./components/gridForm/GridFormSubComponentTextArea";
|
|
54
|
-
|
|
55
11
|
export * from "./lui/ActionButton";
|
|
12
|
+
export * from "./lui/FormError";
|
|
13
|
+
export * from "./lui/TextAreaInput";
|
|
14
|
+
export * from "./lui/TextInputFormatted";
|
|
15
|
+
|
|
16
|
+
export * from "./react-menu3/index";
|
|
17
|
+
export * from "./react-menu3/types";
|
|
56
18
|
|
|
57
19
|
export * from "./utils/bearing";
|
|
58
20
|
export * from "./utils/util";
|
package/src/lui/ActionButton.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import "./ActionButton.scss";
|
|
2
|
-
|
|
3
1
|
import clsx from "clsx";
|
|
4
|
-
import { useEffect, useState
|
|
2
|
+
import { CSSProperties, useEffect, useState } from "react";
|
|
3
|
+
|
|
5
4
|
import { LuiButton, LuiIcon, LuiMiniSpinner } from "@linzjs/lui";
|
|
5
|
+
import { LuiButtonProps } from "@linzjs/lui/dist/components/LuiButton/LuiButton";
|
|
6
6
|
import { IconName } from "@linzjs/lui/dist/components/LuiIcon/LuiIcon";
|
|
7
|
+
|
|
8
|
+
import "./ActionButton.scss";
|
|
7
9
|
import { usePrevious } from "./reactUtils";
|
|
8
10
|
import { useStateDeferred } from "./stateDeferredHook";
|
|
9
|
-
import { LuiButtonProps } from "@linzjs/lui/dist/components/LuiButton/LuiButton";
|
|
10
11
|
|
|
11
12
|
export interface ActionButtonProps {
|
|
12
13
|
icon: IconName;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { InputHTMLAttributes, useState } from "react";
|
|
2
1
|
import clsx from "clsx";
|
|
3
|
-
import { v4 as uuidVersion4 } from "uuid";
|
|
4
2
|
import { omit } from "lodash-es";
|
|
3
|
+
import { InputHTMLAttributes, useState } from "react";
|
|
4
|
+
import { v4 as uuidVersion4 } from "uuid";
|
|
5
|
+
|
|
5
6
|
import { FormError } from "./FormError";
|
|
6
7
|
|
|
7
8
|
export const useGenerateOrDefaultId = (idFromProps?: string) => {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import "./TextInputFormatted.scss";
|
|
2
|
-
|
|
3
|
-
import { DetailedHTMLProps, InputHTMLAttributes } from "react";
|
|
4
|
-
|
|
5
1
|
import clsx from "clsx";
|
|
6
2
|
import { omit } from "lodash-es";
|
|
3
|
+
import { DetailedHTMLProps, InputHTMLAttributes } from "react";
|
|
4
|
+
|
|
7
5
|
import { FormError } from "./FormError";
|
|
6
|
+
import "./TextInputFormatted.scss";
|
|
8
7
|
|
|
9
8
|
export interface LuiTextInputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
10
9
|
// overrides value in base class to be string type only
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { usePrevious } from "./reactUtils";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { act, render } from "@testing-library/react";
|
|
4
1
|
import { screen } from "@testing-library/dom";
|
|
2
|
+
import { act, render } from "@testing-library/react";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
|
|
5
|
+
import { usePrevious } from "./reactUtils";
|
|
5
6
|
|
|
6
7
|
interface WrapperProps {
|
|
7
8
|
value: boolean;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FocusEvent, ForwardedRef, MutableRefObject, forwardRef, useCallback, useEffect, useMemo, useRef } from "react";
|
|
2
2
|
import { createPortal } from "react-dom";
|
|
3
|
-
|
|
4
|
-
import { useBEM } from "../hooks";
|
|
5
|
-
import { menuContainerClass, mergeProps, safeCall, isMenuOpen, getTransition, CloseReason, Keys } from "../utils";
|
|
3
|
+
|
|
6
4
|
import { hasParentClass } from "../../utils/util";
|
|
7
|
-
import {
|
|
5
|
+
import { EventHandlersContext, EventHandlersContextType } from "../contexts/EventHandlersContext";
|
|
8
6
|
import { ItemSettingsContext } from "../contexts/ItemSettingsContext";
|
|
9
7
|
import { SettingsContext } from "../contexts/SettingsContext";
|
|
10
|
-
import {
|
|
8
|
+
import { useBEM } from "../hooks";
|
|
9
|
+
import { ControlledMenuProps, PortalFieldType, RadioChangeEvent } from "../types";
|
|
10
|
+
import { CloseReason, Keys, getTransition, isMenuOpen, menuContainerClass, mergeProps, safeCall } from "../utils";
|
|
11
|
+
import { MenuList } from "./MenuList";
|
|
11
12
|
|
|
12
13
|
export const ControlledMenuFr = (
|
|
13
14
|
{
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { LegacyRef, useContext, useMemo, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import { EventHandlersContext } from "../contexts/EventHandlersContext";
|
|
2
4
|
import { useBEM, useCombinedRef, useItemState } from "../hooks";
|
|
3
|
-
import { mergeProps, commonProps, safeCall, menuClass, menuItemClass, withHovering } from "../utils";
|
|
4
5
|
import { BaseProps } from "../types";
|
|
6
|
+
import { commonProps, menuClass, menuItemClass, mergeProps, safeCall, withHovering } from "../utils";
|
|
5
7
|
import { withHoveringResultProps } from "../utils/withHovering";
|
|
6
|
-
import { EventHandlersContext } from "../contexts/EventHandlersContext";
|
|
7
8
|
|
|
8
9
|
export interface FocusableItemProps extends BaseProps, withHoveringResultProps {
|
|
9
10
|
disabled?: boolean;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ForwardedRef,
|
|
3
3
|
Fragment,
|
|
4
|
+
ReactElement,
|
|
5
|
+
cloneElement,
|
|
4
6
|
forwardRef,
|
|
5
|
-
useRef,
|
|
6
7
|
useCallback,
|
|
7
8
|
useImperativeHandle,
|
|
8
|
-
|
|
9
|
-
ForwardedRef,
|
|
9
|
+
useRef,
|
|
10
10
|
} from "react";
|
|
11
|
-
|
|
12
|
-
import { useMenuChange, useMenuStateAndFocus
|
|
13
|
-
import { getName, mergeProps, safeCall, isMenuOpen, Keys, FocusPositions } from "../utils";
|
|
11
|
+
|
|
12
|
+
import { useCombinedRef, useMenuChange, useMenuStateAndFocus } from "../hooks";
|
|
14
13
|
import { MenuButtonModifiers, RenderProp, RootMenuProps, UncontrolledMenuProps } from "../types";
|
|
14
|
+
import { FocusPositions, Keys, getName, isMenuOpen, mergeProps, safeCall } from "../utils";
|
|
15
|
+
import { ControlledMenu } from "./ControlledMenu";
|
|
15
16
|
|
|
16
17
|
//
|
|
17
18
|
// Menu
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LegacyRef, ReactNode, forwardRef, useMemo } from "react";
|
|
2
|
+
|
|
2
3
|
import { useBEM } from "../hooks";
|
|
3
|
-
import { menuButtonClass } from "../utils";
|
|
4
4
|
import { BaseProps, MenuButtonModifiers } from "../types";
|
|
5
|
+
import { menuButtonClass } from "../utils";
|
|
5
6
|
|
|
6
7
|
export interface MenuButtonProps extends BaseProps<MenuButtonModifiers> {
|
|
7
8
|
disabled?: boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LegacyRef, forwardRef, memo } from "react";
|
|
2
|
+
|
|
2
3
|
import { useBEM } from "../hooks";
|
|
3
|
-
import { menuClass, menuDividerClass } from "../utils";
|
|
4
4
|
import { BaseProps } from "../types";
|
|
5
|
+
import { menuClass, menuDividerClass } from "../utils";
|
|
5
6
|
|
|
6
7
|
const MenuDividerFr = ({ className, ...restProps }: BaseProps, externalRef: LegacyRef<HTMLLIElement>) => {
|
|
7
8
|
return (
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ForwardedRef,
|
|
2
|
-
|
|
3
|
-
import { menuClass, menuGroupClass } from "../utils";
|
|
4
|
-
import { BaseProps, MenuOverflow } from "../types";
|
|
1
|
+
import { ForwardedRef, ReactNode, forwardRef, useContext, useRef, useState } from "react";
|
|
2
|
+
|
|
5
3
|
import { MenuListContext } from "../contexts/MenuListContext";
|
|
4
|
+
import { useBEM, useCombinedRef, useLayoutEffect } from "../hooks";
|
|
5
|
+
import { BaseProps, MenuOverflow } from "../types";
|
|
6
|
+
import { menuClass, menuGroupClass } from "../utils";
|
|
6
7
|
|
|
7
8
|
export interface MenuGroupProps extends BaseProps {
|
|
8
9
|
children?: ReactNode;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ForwardedRef, forwardRef, memo } from "react";
|
|
2
|
+
|
|
2
3
|
import { useBEM } from "../hooks";
|
|
3
|
-
import { menuClass, menuHeaderClass } from "../utils";
|
|
4
4
|
import { BasePropsWithChildren } from "../types";
|
|
5
|
+
import { menuClass, menuHeaderClass } from "../utils";
|
|
5
6
|
|
|
6
7
|
export const MenuHeaderFr = (
|
|
7
8
|
{ className, ...restProps }: BasePropsWithChildren,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { KeyboardEvent, Ref, useContext, useMemo } from "react";
|
|
2
|
-
|
|
3
|
-
import { mergeProps, commonProps, safeCall, menuClass, menuItemClass, withHovering, Keys, RMEvent } from "../utils";
|
|
4
|
-
import { BaseProps, ClickEvent, EventHandler, Hoverable, MenuItemTypeProp, RenderProp } from "../types";
|
|
5
|
-
import { withHoveringResultProps } from "../utils/withHovering";
|
|
2
|
+
|
|
6
3
|
import { EventHandlersContext } from "../contexts/EventHandlersContext";
|
|
7
4
|
import { RadioGroupContext } from "../contexts/RadioGroupContext";
|
|
5
|
+
import { useBEM, useCombinedRef, useItemState } from "../hooks";
|
|
6
|
+
import { BaseProps, ClickEvent, EventHandler, Hoverable, MenuItemTypeProp, RenderProp } from "../types";
|
|
7
|
+
import { Keys, RMEvent, commonProps, menuClass, menuItemClass, mergeProps, safeCall, withHovering } from "../utils";
|
|
8
|
+
import { withHoveringResultProps } from "../utils/withHovering";
|
|
8
9
|
|
|
9
10
|
//
|
|
10
11
|
// MenuItem
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
+
import { debounce } from "lodash-es";
|
|
1
2
|
import { useCallback, useContext, useEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
2
3
|
import { flushSync } from "react-dom";
|
|
4
|
+
|
|
5
|
+
import { HoverItemContext } from "../contexts/HoverItemContext";
|
|
6
|
+
import { MenuListContext } from "../contexts/MenuListContext";
|
|
7
|
+
import { MenuListItemContext } from "../contexts/MenuListItemContext";
|
|
8
|
+
import { SettingsContext } from "../contexts/SettingsContext";
|
|
3
9
|
import { useBEM, useCombinedRef, useItems, useLayoutEffect } from "../hooks";
|
|
4
10
|
import { getPositionHelpers, positionContextMenu, positionMenu } from "../positionUtils";
|
|
11
|
+
import { ControlledMenuProps, MenuDirection } from "../types";
|
|
5
12
|
import {
|
|
6
|
-
batchedUpdates,
|
|
7
13
|
CloseReason,
|
|
14
|
+
FocusPositions,
|
|
15
|
+
HoverActionTypes,
|
|
16
|
+
Keys,
|
|
17
|
+
batchedUpdates,
|
|
8
18
|
commonProps,
|
|
9
19
|
floatEqual,
|
|
10
20
|
focusFirstInput,
|
|
11
|
-
FocusPositions,
|
|
12
21
|
getScrollAncestor,
|
|
13
22
|
getTransition,
|
|
14
|
-
HoverActionTypes,
|
|
15
23
|
isMenuOpen,
|
|
16
|
-
Keys,
|
|
17
24
|
menuArrowClass,
|
|
18
25
|
menuClass,
|
|
19
26
|
mergeProps,
|
|
20
27
|
safeCall,
|
|
21
28
|
} from "../utils";
|
|
22
|
-
import { ControlledMenuProps, MenuDirection } from "../types";
|
|
23
|
-
import { MenuListItemContext } from "../contexts/MenuListItemContext";
|
|
24
|
-
import { HoverItemContext } from "../contexts/HoverItemContext";
|
|
25
|
-
import { MenuListContext } from "../contexts/MenuListContext";
|
|
26
|
-
import { SettingsContext } from "../contexts/SettingsContext";
|
|
27
|
-
import { debounce } from "lodash-es";
|
|
28
29
|
|
|
29
30
|
export const MenuList = ({
|
|
30
31
|
ariaLabel,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ForwardedRef,
|
|
1
|
+
import { ForwardedRef, ReactNode, forwardRef, useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import { RadioGroupContext } from "../contexts/RadioGroupContext";
|
|
2
4
|
import { useBEM } from "../hooks";
|
|
3
|
-
import { menuClass, radioGroupClass } from "../utils";
|
|
4
5
|
import { BaseProps, EventHandler, RadioChangeEvent } from "../types";
|
|
5
|
-
import {
|
|
6
|
+
import { menuClass, radioGroupClass } from "../utils";
|
|
6
7
|
|
|
7
8
|
//
|
|
8
9
|
// MenuRadioGroup
|
|
@@ -1,30 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
CSSProperties,
|
|
3
|
+
KeyboardEvent,
|
|
4
|
+
ReactNode,
|
|
3
5
|
useContext,
|
|
4
6
|
useEffect,
|
|
5
|
-
useMemo,
|
|
6
7
|
useImperativeHandle,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
KeyboardEvent,
|
|
8
|
+
useMemo,
|
|
9
|
+
useRef,
|
|
10
10
|
} from "react";
|
|
11
11
|
import { createPortal } from "react-dom";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
safeCall,
|
|
19
|
-
menuClass,
|
|
20
|
-
subMenuClass,
|
|
21
|
-
menuItemClass,
|
|
22
|
-
isMenuOpen,
|
|
23
|
-
withHovering,
|
|
24
|
-
Keys,
|
|
25
|
-
HoverActionTypes,
|
|
26
|
-
FocusPositions,
|
|
27
|
-
} from "../utils";
|
|
12
|
+
|
|
13
|
+
import { ItemSettingsContext } from "../contexts/ItemSettingsContext";
|
|
14
|
+
import { MenuListContext } from "../contexts/MenuListContext";
|
|
15
|
+
import { MenuListItemContext } from "../contexts/MenuListItemContext";
|
|
16
|
+
import { SettingsContext } from "../contexts/SettingsContext";
|
|
17
|
+
import { useBEM, useCombinedRef, useItemEffect, useMenuChange, useMenuStateAndFocus } from "../hooks";
|
|
28
18
|
import {
|
|
29
19
|
BaseProps,
|
|
30
20
|
ClassNameProp,
|
|
@@ -38,11 +28,22 @@ import {
|
|
|
38
28
|
RenderProp,
|
|
39
29
|
UncontrolledMenuProps,
|
|
40
30
|
} from "../types";
|
|
31
|
+
import {
|
|
32
|
+
FocusPositions,
|
|
33
|
+
HoverActionTypes,
|
|
34
|
+
Keys,
|
|
35
|
+
batchedUpdates,
|
|
36
|
+
commonProps,
|
|
37
|
+
isMenuOpen,
|
|
38
|
+
menuClass,
|
|
39
|
+
menuItemClass,
|
|
40
|
+
mergeProps,
|
|
41
|
+
safeCall,
|
|
42
|
+
subMenuClass,
|
|
43
|
+
withHovering,
|
|
44
|
+
} from "../utils";
|
|
41
45
|
import { withHoveringResultProps } from "../utils/withHovering";
|
|
42
|
-
import {
|
|
43
|
-
import { MenuListContext } from "../contexts/MenuListContext";
|
|
44
|
-
import { SettingsContext } from "../contexts/SettingsContext";
|
|
45
|
-
import { ItemSettingsContext } from "../contexts/ItemSettingsContext";
|
|
46
|
+
import { MenuList } from "./MenuList";
|
|
46
47
|
|
|
47
48
|
//
|
|
48
49
|
// SubMenu
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MutableRefObject, RefObject, createContext } from "react";
|
|
2
|
+
|
|
2
3
|
import { ControlledMenuProps, MenuReposition, MenuViewScroll, RectElement, TransitionFieldType } from "../types";
|
|
3
4
|
|
|
4
5
|
interface SettingsContextType extends ControlledMenuProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ForwardedRef, LegacyRef, useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
// Adapted from material-ui
|
|
4
4
|
// https://github.com/mui-org/material-ui/blob/f996027d00e7e4bff3fc040786c1706f9c6c3f82/packages/material-ui-utils/src/useForkRef.ts
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FocusEvent, MutableRefObject, useContext, useEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import { ItemSettingsContext } from "../contexts/ItemSettingsContext";
|
|
4
|
+
import { MenuListItemContext } from "../contexts/MenuListItemContext";
|
|
2
5
|
import { HoverActionTypes } from "../utils";
|
|
3
6
|
import { useItemEffect } from "./useItemEffect";
|
|
4
|
-
import { MenuListItemContext } from "../contexts/MenuListItemContext";
|
|
5
|
-
import { ItemSettingsContext } from "../contexts/ItemSettingsContext";
|
|
6
7
|
|
|
7
8
|
// This hook includes some common stateful logic in MenuItem and FocusableItem
|
|
8
9
|
export const useItemState = (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { MutableRefObject, useCallback, useRef, useState } from "react";
|
|
2
|
+
|
|
3
3
|
import { FocusPosition } from "../types";
|
|
4
|
+
import { HoverActionTypes, focusFirstInput, indexOfNode } from "../utils";
|
|
4
5
|
|
|
5
6
|
export const useItems = (menuRef: MutableRefObject<any>, focusRef: MutableRefObject<any> | undefined) => {
|
|
6
7
|
const [hoverItem, setHoverItem] = useState<any>();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
|
|
3
3
|
import { EventHandler, MenuChangeEvent } from "../types";
|
|
4
|
+
import { safeCall } from "../utils";
|
|
4
5
|
|
|
5
6
|
export const useMenuChange = (onMenuChange?: EventHandler<MenuChangeEvent>, isOpen?: boolean) => {
|
|
6
7
|
const prevOpen = useRef(isOpen);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useTransition } from "react-transition-state";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { MenuState, MenuStateOptions } from "../types";
|
|
4
|
+
import { MenuStateMap, getTransition } from "../utils";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* A custom Hook which helps manage the states of `ControlledMenu`.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { ControlledMenuProps, FocusPosition, MenuStateOptions } from "../types";
|
|
4
|
+
import { useMenuState } from "./useMenuState";
|
|
4
5
|
|
|
5
6
|
export const useMenuStateAndFocus = (
|
|
6
7
|
options: MenuStateOptions,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { parsePadding } from "../utils";
|
|
2
1
|
import { MutableRefObject } from "react";
|
|
3
2
|
|
|
3
|
+
import { parsePadding } from "../utils";
|
|
4
|
+
|
|
4
5
|
export const getPositionHelpers = (
|
|
5
6
|
containerRef: MutableRefObject<HTMLElement | undefined>,
|
|
6
7
|
menuRef: MutableRefObject<HTMLElement>,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { placeArrowVertical } from "./placeArrowVertical";
|
|
2
|
-
import { getPositionHelpers } from "./getPositionHelpers";
|
|
3
1
|
import { MutableRefObject } from "react";
|
|
2
|
+
|
|
4
3
|
import { MenuDirection } from "../types";
|
|
4
|
+
import { getPositionHelpers } from "./getPositionHelpers";
|
|
5
|
+
import { placeArrowVertical } from "./placeArrowVertical";
|
|
5
6
|
|
|
6
7
|
export interface placeLeftorRightParams {
|
|
7
8
|
anchorRect: DOMRect;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { placeArrowHorizontal } from "./placeArrowHorizontal";
|
|
2
|
-
import { getPositionHelpers } from "./getPositionHelpers";
|
|
3
1
|
import { MutableRefObject } from "react";
|
|
2
|
+
|
|
4
3
|
import { MenuDirection } from "../types";
|
|
4
|
+
import { getPositionHelpers } from "./getPositionHelpers";
|
|
5
|
+
import { placeArrowHorizontal } from "./placeArrowHorizontal";
|
|
5
6
|
|
|
6
7
|
export interface placeToporBottomParams {
|
|
7
8
|
anchorRect: DOMRect;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { placeLeftorRight } from "./placeLeftorRight";
|
|
2
|
-
import { placeToporBottom } from "./placeToporBottom";
|
|
3
1
|
import { MutableRefObject } from "react";
|
|
4
|
-
|
|
2
|
+
|
|
5
3
|
import { MenuDirection } from "../types";
|
|
4
|
+
import { getPositionHelpers } from "./getPositionHelpers";
|
|
5
|
+
import { placeLeftorRight } from "./placeLeftorRight";
|
|
6
|
+
import { placeToporBottom } from "./placeToporBottom";
|
|
6
7
|
|
|
7
8
|
interface positionMenuProps {
|
|
8
9
|
offsetX: number;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
menuArrowClass,
|
|
3
3
|
menuButtonClass,
|
|
4
4
|
menuClass,
|
|
5
|
-
|
|
6
|
-
menuItemClass,
|
|
5
|
+
menuContainerClass,
|
|
7
6
|
menuDividerClass,
|
|
8
|
-
menuHeaderClass,
|
|
9
7
|
menuGroupClass,
|
|
8
|
+
menuHeaderClass,
|
|
9
|
+
menuItemClass,
|
|
10
10
|
radioGroupClass,
|
|
11
11
|
subMenuClass,
|
|
12
12
|
} from "../utils";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bool, exact, func, number, object, oneOf, oneOfType, string } from "prop-types";
|
|
2
2
|
|
|
3
3
|
export const stylePropTypes = (name?: string) => ({
|
|
4
4
|
[name ? `${name}ClassName` : "className"]: oneOfType([string, func]),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { findIndex } from "lodash-es";
|
|
1
2
|
import { unstable_batchedUpdates } from "react-dom";
|
|
2
|
-
|
|
3
|
+
|
|
3
4
|
import { MenuButtonProps } from "../components/MenuButton";
|
|
4
|
-
import {
|
|
5
|
+
import { MenuState, MenuStateOptions } from "../types";
|
|
5
6
|
|
|
6
7
|
export const isMenuOpen = (state?: MenuState) => !!state && state[0] === "o";
|
|
7
8
|
export const batchedUpdates = unstable_batchedUpdates || ((callback: () => any) => callback());
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MutableRefObject, PropsWithRef, forwardRef, memo, useContext, useRef } from "react";
|
|
2
|
+
|
|
2
3
|
import { HoverItemContext } from "../contexts/HoverItemContext";
|
|
3
4
|
|
|
4
5
|
export interface withHoveringResultProps {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "@
|
|
1
|
+
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
|
|
2
4
|
import "@linzjs/lui/dist/fonts";
|
|
5
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
3
6
|
|
|
4
|
-
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
5
7
|
import { ActionButton } from "../../lui/ActionButton";
|
|
6
|
-
import { useCallback } from "react";
|
|
7
8
|
import { wait } from "../../utils/util";
|
|
8
9
|
|
|
9
10
|
export default {
|