@linzjs/step-ag-grid 1.5.4 → 2.0.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.
Files changed (128) hide show
  1. package/README.md +117 -2
  2. package/{src/components → dist}/GridTheme.scss +37 -23
  3. package/dist/index.css +351 -0
  4. package/dist/index.js +625 -332
  5. package/dist/index.js.map +1 -1
  6. package/dist/src/components/ComponentLoadingWrapper.d.ts +1 -0
  7. package/dist/src/components/Grid.d.ts +0 -2
  8. package/dist/src/components/GridCell.d.ts +21 -27
  9. package/dist/src/components/GridPopoverHook.d.ts +5 -2
  10. package/dist/src/components/gridForm/GridFormDropDown.d.ts +10 -4
  11. package/dist/src/components/gridForm/GridFormEditBearing.d.ts +5 -5
  12. package/dist/src/components/gridForm/GridFormMessage.d.ts +4 -5
  13. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +5 -4
  14. package/dist/src/components/gridForm/GridFormPopoutMenu.d.ts +3 -3
  15. package/dist/src/components/gridForm/GridFormTextArea.d.ts +3 -3
  16. package/dist/src/components/gridForm/GridFormTextInput.d.ts +3 -3
  17. package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +3 -2
  18. package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +5 -270
  19. package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +3 -2
  20. package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +3 -4
  21. package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +3 -2
  22. package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +3 -2
  23. package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +3 -2
  24. package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +4 -5
  25. package/dist/src/contexts/GridContext.d.ts +1 -1
  26. package/dist/src/contexts/GridPopoverContext.d.ts +17 -0
  27. package/dist/src/contexts/GridPopoverContextProvider.d.ts +6 -0
  28. package/dist/src/contexts/{UpdatingContext.d.ts → GridUpdatingContext.d.ts} +2 -2
  29. package/dist/src/contexts/GridUpdatingContextProvider.d.ts +7 -0
  30. package/dist/src/index.d.ts +31 -0
  31. package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -21
  32. package/dist/src/react-menu3/contexts/EventHandlersContext.d.ts +7 -0
  33. package/dist/src/react-menu3/contexts/HoverItemContext.d.ts +2 -0
  34. package/dist/src/react-menu3/contexts/ItemSettingsContext.d.ts +5 -0
  35. package/dist/src/react-menu3/contexts/MenuListContext.d.ts +9 -0
  36. package/dist/src/react-menu3/contexts/MenuListItemContext.d.ts +11 -0
  37. package/dist/src/react-menu3/contexts/RadioGroupContext.d.ts +7 -0
  38. package/dist/src/react-menu3/contexts/SettingsContext.d.ts +20 -0
  39. package/dist/src/react-menu3/index.d.ts +0 -1
  40. package/dist/src/react-menu3/utils/constants.d.ts +1 -50
  41. package/dist/step-ag-grid.esm.js +622 -312
  42. package/dist/step-ag-grid.esm.js.map +1 -1
  43. package/package.json +39 -26
  44. package/src/components/ComponentLoadingWrapper.tsx +2 -1
  45. package/src/components/Grid.tsx +3 -8
  46. package/src/components/GridCell.tsx +62 -79
  47. package/src/components/GridLoadableCell.tsx +0 -1
  48. package/src/components/GridPopoverHook.tsx +18 -16
  49. package/src/components/gridForm/GridFormDropDown.tsx +47 -32
  50. package/src/components/gridForm/GridFormEditBearing.tsx +14 -14
  51. package/src/components/gridForm/GridFormMessage.tsx +11 -17
  52. package/src/components/gridForm/GridFormMultiSelect.tsx +89 -79
  53. package/src/components/gridForm/GridFormPopoutMenu.tsx +10 -11
  54. package/src/components/gridForm/GridFormTextArea.tsx +16 -17
  55. package/src/components/gridForm/GridFormTextInput.tsx +17 -17
  56. package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +20 -15
  57. package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +53 -45
  58. package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +21 -15
  59. package/src/components/gridPopoverEdit/GridPopoverMenu.scss +4 -4
  60. package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +21 -23
  61. package/src/components/gridPopoverEdit/GridPopoverMessage.ts +18 -16
  62. package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +12 -16
  63. package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +15 -15
  64. package/src/components/gridRender/GridRenderGenericCell.tsx +5 -6
  65. package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +2 -2
  66. package/src/contexts/GridContext.tsx +1 -1
  67. package/src/contexts/GridContextProvider.tsx +3 -5
  68. package/src/contexts/GridPopoverContext.tsx +26 -0
  69. package/src/contexts/GridPopoverContextProvider.tsx +54 -0
  70. package/src/contexts/{UpdatingContext.tsx → GridUpdatingContext.tsx} +2 -2
  71. package/src/contexts/{UpdatingContextProvider.tsx → GridUpdatingContextProvider.tsx} +8 -6
  72. package/src/index.ts +38 -0
  73. package/src/lui/TextInputFormatted.scss +1 -1
  74. package/src/react-menu3/README.md +66 -0
  75. package/src/react-menu3/components/ControlledMenu.tsx +9 -17
  76. package/src/react-menu3/components/FocusableItem.tsx +2 -9
  77. package/src/react-menu3/components/MenuGroup.tsx +2 -1
  78. package/src/react-menu3/components/MenuItem.tsx +3 -12
  79. package/src/react-menu3/components/MenuList.tsx +4 -4
  80. package/src/react-menu3/components/MenuRadioGroup.tsx +3 -22
  81. package/src/react-menu3/components/SubMenu.tsx +4 -4
  82. package/src/react-menu3/contexts/EventHandlersContext.ts +11 -0
  83. package/src/react-menu3/contexts/HoverItemContext.ts +3 -0
  84. package/src/react-menu3/contexts/ItemSettingsContext.ts +6 -0
  85. package/src/react-menu3/contexts/MenuListContext.ts +10 -0
  86. package/src/react-menu3/contexts/MenuListItemContext.ts +16 -0
  87. package/src/react-menu3/contexts/RadioGroupContext.ts +8 -0
  88. package/src/react-menu3/contexts/SettingsContext.ts +20 -0
  89. package/src/react-menu3/hooks/useItemState.ts +3 -1
  90. package/src/react-menu3/index.ts +0 -1
  91. package/src/react-menu3/styles/_var.scss +4 -4
  92. package/src/react-menu3/styles/core.scss +6 -6
  93. package/src/react-menu3/styles/index.scss +10 -7
  94. package/src/react-menu3/styles/theme-dark.scss +4 -2
  95. package/src/react-menu3/styles/transitions/slide.scss +8 -8
  96. package/src/react-menu3/utils/constants.ts +1 -74
  97. package/src/react-menu3/utils/withHovering.tsx +1 -1
  98. package/src/stories/components/FormTest.scss +1 -2
  99. package/src/stories/components/FormTest.tsx +4 -3
  100. package/src/stories/components/GridPopoutBearing.stories.tsx +30 -26
  101. package/src/stories/components/GridPopoutEditDropDown.stories.tsx +94 -51
  102. package/src/stories/components/GridPopoutEditGeneric.stories.tsx +18 -14
  103. package/src/stories/components/GridPopoutEditGenericTextArea.stories.tsx +78 -62
  104. package/src/stories/components/GridPopoutEditMultiSelect.stories.tsx +60 -52
  105. package/src/stories/components/GridReadOnly.stories.tsx +77 -64
  106. package/src/stories/components/ReactMenu.stories.tsx +0 -4
  107. package/src/{components → styles}/Grid.scss +9 -6
  108. package/src/styles/GridFormDropDown.scss +18 -0
  109. package/src/{components/gridForm → styles}/GridFormEditBearing.scss +0 -0
  110. package/src/styles/GridFormMultiSelect.scss +18 -0
  111. package/src/styles/GridRenderGenericCell.scss +15 -0
  112. package/src/styles/GridTheme.scss +108 -0
  113. package/src/styles/index.scss +2 -0
  114. package/src/styles/lui-overrides.scss +49 -0
  115. package/src/styles/react-menu-customisations.scss +135 -0
  116. package/dist/index.d.ts +0 -38
  117. package/dist/src/contexts/UpdatingContextProvider.d.ts +0 -7
  118. package/dist/src/stories/components/FormTest.d.ts +0 -13
  119. package/dist/src/stories/components/GridPopoutBearing.stories.d.ts +0 -9
  120. package/dist/src/stories/components/GridPopoutEditDropDown.stories.d.ts +0 -9
  121. package/dist/src/stories/components/GridPopoutEditGeneric.stories.d.ts +0 -9
  122. package/dist/src/stories/components/GridPopoutEditGenericTextArea.stories.d.ts +0 -9
  123. package/dist/src/stories/components/GridPopoutEditMultiSelect.stories.d.ts +0 -9
  124. package/dist/src/stories/components/GridReadOnly.stories.d.ts +0 -9
  125. package/dist/src/stories/components/ReactMenu.stories.d.ts +0 -8
  126. package/src/components/gridRender/GridRenderGenericCell.scss +0 -15
  127. package/src/lui-overrides.scss +0 -163
  128. package/src/react-menu3/style-utils.d.ts +0 -110
@@ -0,0 +1,66 @@
1
+ # React-Menu
2
+
3
+ > This is a fork of @szhsin/react-menu. v3.2.0
4
+
5
+ > An accessible and keyboard-friendly React menu library.
6
+
7
+ **[Live examples and docs](https://szhsin.github.io/react-menu/)**
8
+
9
+ ## Features
10
+
11
+ - React menu components for easy and fast web development.
12
+ - Unlimited levels of submenu.
13
+ - Supports dropdown or context menu.
14
+ - Supports radio and checkbox menu items.
15
+ - Flexible menu positioning.
16
+ - Comprehensive keyboard interactions.
17
+ - Unstyled components and easy [customisation](https://szhsin.github.io/react-menu/#styling).
18
+ - [Optimal level support](https://github.com/reactwg/react-18/discussions/70) (level 3) of **React 18** concurrent rendering.
19
+ - Works in major browsers without polyfills.
20
+ - [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/menu/) compliant.
21
+
22
+ ## Install
23
+
24
+ with npm
25
+
26
+ ```bash
27
+ npm install @szhsin/react-menu
28
+ ```
29
+
30
+ or with Yarn
31
+
32
+ ```bash
33
+ yarn add @szhsin/react-menu
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```jsx
39
+ import { Menu, MenuItem, MenuButton, SubMenu } from "@szhsin/react-menu";
40
+
41
+ export default function App() {
42
+ return (
43
+ <Menu menuButton={<MenuButton>Open menu</MenuButton>}>
44
+ <MenuItem>New File</MenuItem>
45
+ <MenuItem>Save</MenuItem>
46
+ <SubMenu label="Edit">
47
+ <MenuItem>Cut</MenuItem>
48
+ <MenuItem>Copy</MenuItem>
49
+ <MenuItem>Paste</MenuItem>
50
+ </SubMenu>
51
+ <MenuItem>Print...</MenuItem>
52
+ </Menu>
53
+ );
54
+ }
55
+ ```
56
+
57
+ **[Edit on CodeSandbox](https://codesandbox.io/s/react-menu-starter-3ez3c)**<br>
58
+ **[Visit more examples and docs](https://szhsin.github.io/react-menu/)**<br><br>
59
+ [Migration from v2 to v3](https://github.com/szhsin/react-menu/wiki/Migration-from-v2-to-v3)<br>
60
+ [Migration from v1 to v2](https://github.com/szhsin/react-menu/wiki/Migration-from-v1-to-v2)
61
+
62
+ _Please note that React-Menu v3 requires React 16.14.0 or higher. If you are not able to upgrade React, you could install v2/v1 which requires React 16.8.0._
63
+
64
+ ## License
65
+
66
+ [MIT](https://github.com/szhsin/react-menu/blob/master/LICENSE) Licensed.
@@ -12,20 +12,12 @@ import {
12
12
  import { createPortal } from "react-dom";
13
13
  import { MenuList } from "./MenuList";
14
14
  import { useBEM } from "../hooks";
15
- import {
16
- menuContainerClass,
17
- mergeProps,
18
- safeCall,
19
- isMenuOpen,
20
- getTransition,
21
- CloseReason,
22
- Keys,
23
- EventHandlersContext,
24
- SettingsContext,
25
- ItemSettingsContext,
26
- } from "../utils";
15
+ import { menuContainerClass, mergeProps, safeCall, isMenuOpen, getTransition, CloseReason, Keys } from "../utils";
27
16
  import { hasParentClass } from "@utils/util";
28
17
  import { ControlledMenuProps, PortalFieldType, RadioChangeEvent } from "../types";
18
+ import { ItemSettingsContext } from "../contexts/ItemSettingsContext";
19
+ import { SettingsContext } from "../contexts/SettingsContext";
20
+ import { EventHandlersContext, EventHandlersContextType } from "../contexts/EventHandlersContext";
29
21
 
30
22
  export const ControlledMenuFr = (
31
23
  {
@@ -128,13 +120,13 @@ export const ControlledMenuFr = (
128
120
  useEffect(() => {
129
121
  if (isMenuOpen(state)) {
130
122
  const thisDocument = anchorRef?.current ? anchorRef?.current.ownerDocument : document;
131
- thisDocument.addEventListener("mousedown", handleScreenEventForCancel, true);
132
- thisDocument.addEventListener("mouseup", handleScreenEventForSave, true);
123
+ thisDocument.addEventListener("mousedown", handleScreenEventForSave, true);
124
+ thisDocument.addEventListener("mouseup", handleScreenEventForCancel, true);
133
125
  thisDocument.addEventListener("click", handleScreenEventForCancel, true);
134
126
  thisDocument.addEventListener("dblclick", handleScreenEventForCancel, true);
135
127
  return () => {
136
- thisDocument.removeEventListener("mousedown", handleScreenEventForCancel, true);
137
- thisDocument.removeEventListener("mouseup", handleScreenEventForSave, true);
128
+ thisDocument.removeEventListener("mousedown", handleScreenEventForSave, true);
129
+ thisDocument.removeEventListener("mouseup", handleScreenEventForCancel, true);
138
130
  thisDocument.removeEventListener("click", handleScreenEventForCancel, true);
139
131
  thisDocument.removeEventListener("dblclick", handleScreenEventForCancel, true);
140
132
  };
@@ -151,7 +143,7 @@ export const ControlledMenuFr = (
151
143
  );
152
144
 
153
145
  const eventHandlers = useMemo(
154
- () => ({
146
+ (): EventHandlersContextType => ({
155
147
  handleClick(event: RadioChangeEvent, isCheckOrRadio: boolean) {
156
148
  if (!event.stopPropagation) safeCall(onItemClick, event);
157
149
 
@@ -1,16 +1,9 @@
1
1
  import { LegacyRef, useContext, useMemo, useRef } from "react";
2
2
  import { useBEM, useCombinedRef, useItemState } from "../hooks";
3
- import {
4
- mergeProps,
5
- commonProps,
6
- safeCall,
7
- menuClass,
8
- menuItemClass,
9
- withHovering,
10
- EventHandlersContext,
11
- } from "../utils";
3
+ import { mergeProps, commonProps, safeCall, menuClass, menuItemClass, withHovering } from "../utils";
12
4
  import { BaseProps } from "../types";
13
5
  import { withHoveringResultProps } from "../utils/withHovering";
6
+ import { EventHandlersContext } from "../contexts/EventHandlersContext";
14
7
 
15
8
  export interface FocusableItemProps extends BaseProps, withHoveringResultProps {
16
9
  disabled?: boolean;
@@ -1,7 +1,8 @@
1
1
  import { ForwardedRef, forwardRef, ReactNode, useContext, useRef, useState } from "react";
2
2
  import { useBEM, useLayoutEffect, useCombinedRef } from "../hooks";
3
- import { menuClass, menuGroupClass, MenuListContext } from "../utils";
3
+ import { menuClass, menuGroupClass } from "../utils";
4
4
  import { BaseProps, MenuOverflow } from "../types";
5
+ import { MenuListContext } from "../contexts/MenuListContext";
5
6
 
6
7
  export interface MenuGroupProps extends BaseProps {
7
8
  children?: ReactNode;
@@ -1,19 +1,10 @@
1
1
  import { Ref, useContext, useMemo } from "react";
2
2
  import { useBEM, useItemState, useCombinedRef } from "../hooks";
3
- import {
4
- mergeProps,
5
- commonProps,
6
- safeCall,
7
- menuClass,
8
- menuItemClass,
9
- withHovering,
10
- EventHandlersContext,
11
- RadioGroupContext,
12
- Keys,
13
- RMEvent,
14
- } from "../utils";
3
+ import { mergeProps, commonProps, safeCall, menuClass, menuItemClass, withHovering, Keys, RMEvent } from "../utils";
15
4
  import { BaseProps, ClickEvent, EventHandler, Hoverable, MenuItemTypeProp, RenderProp } from "../types";
16
5
  import { withHoveringResultProps } from "../utils/withHovering";
6
+ import { EventHandlersContext } from "../contexts/EventHandlersContext";
7
+ import { RadioGroupContext } from "../contexts/RadioGroupContext";
17
8
 
18
9
  //
19
10
  // MenuItem
@@ -17,12 +17,12 @@ import {
17
17
  Keys,
18
18
  FocusPositions,
19
19
  HoverActionTypes,
20
- SettingsContext,
21
- MenuListContext,
22
- MenuListItemContext,
23
- HoverItemContext,
24
20
  } from "../utils";
25
21
  import { ControlledMenuProps, MenuDirection } from "../types";
22
+ import { MenuListItemContext } from "../contexts/MenuListItemContext";
23
+ import { HoverItemContext } from "../contexts/HoverItemContext";
24
+ import { MenuListContext } from "../contexts/MenuListContext";
25
+ import { SettingsContext } from "../contexts/SettingsContext";
26
26
 
27
27
  export const MenuList = ({
28
28
  ariaLabel,
@@ -1,27 +1,8 @@
1
1
  import { ForwardedRef, forwardRef, ReactNode, useMemo } from "react";
2
2
  import { useBEM } from "../hooks";
3
- import { menuClass, radioGroupClass, RadioGroupContext } from "../utils";
4
- import { BaseProps, Event, EventHandler } from "../types";
5
-
6
- export interface RadioChangeEvent extends Event {
7
- /**
8
- * The `name` prop passed to the `MenuRadioGroup` when the menu item is in a radio group.
9
- */
10
- name?: string;
11
- /**
12
- * Set this property on event object to control whether to keep menu open after menu item is activated.
13
- * Leaving it `undefined` will behave in accordance with WAI-ARIA Authoring Practices.
14
- */
15
- keepOpen?: boolean;
16
- /**
17
- * Setting this property on event object to `true` will skip `onItemClick` event on root menu component.
18
- */
19
- stopPropagation?: boolean;
20
- /**
21
- * DOM event object (React synthetic event)
22
- */
23
- syntheticEvent: MouseEvent | KeyboardEvent;
24
- }
3
+ import { menuClass, radioGroupClass } from "../utils";
4
+ import { BaseProps, EventHandler, RadioChangeEvent } from "../types";
5
+ import { RadioGroupContext } from "../contexts/RadioGroupContext";
25
6
 
26
7
  //
27
8
  // MenuRadioGroup
@@ -21,10 +21,6 @@ import {
21
21
  menuItemClass,
22
22
  isMenuOpen,
23
23
  withHovering,
24
- SettingsContext,
25
- ItemSettingsContext,
26
- MenuListContext,
27
- MenuListItemContext,
28
24
  Keys,
29
25
  HoverActionTypes,
30
26
  FocusPositions,
@@ -43,6 +39,10 @@ import {
43
39
  UncontrolledMenuProps,
44
40
  } from "../types";
45
41
  import { withHoveringResultProps } from "../utils/withHovering";
42
+ import { MenuListItemContext } from "../contexts/MenuListItemContext";
43
+ import { MenuListContext } from "../contexts/MenuListContext";
44
+ import { SettingsContext } from "../contexts/SettingsContext";
45
+ import { ItemSettingsContext } from "../contexts/ItemSettingsContext";
46
46
 
47
47
  //
48
48
  // SubMenu
@@ -0,0 +1,11 @@
1
+ import { createContext } from "react";
2
+ import { RMEvent } from "../utils";
3
+
4
+ export interface EventHandlersContextType {
5
+ handleClose?: () => void;
6
+ handleClick: (event: RMEvent, checked: boolean) => void;
7
+ }
8
+
9
+ export const EventHandlersContext = createContext<EventHandlersContextType>({
10
+ handleClick: () => {},
11
+ });
@@ -0,0 +1,3 @@
1
+ import { createContext } from "react";
2
+
3
+ export const HoverItemContext = createContext(undefined);
@@ -0,0 +1,6 @@
1
+ import { createContext } from "react";
2
+
3
+ export const ItemSettingsContext = createContext<{ submenuCloseDelay: number; submenuOpenDelay: number }>({
4
+ submenuOpenDelay: 0,
5
+ submenuCloseDelay: 0,
6
+ });
@@ -0,0 +1,10 @@
1
+ import { createContext, MutableRefObject } from "react";
2
+ import { MenuDirection, MenuOverflow } from "../types";
3
+
4
+ export const MenuListContext = createContext<{
5
+ overflow?: MenuOverflow;
6
+ overflowAmt?: number;
7
+ parentMenuRef?: MutableRefObject<any>;
8
+ parentDir?: MenuDirection;
9
+ reposSubmenu?: boolean;
10
+ }>({});
@@ -0,0 +1,16 @@
1
+ import { FocusPosition } from "../types";
2
+ import { createContext } from "react";
3
+
4
+ interface MenuListItemContextType {
5
+ isParentOpen?: boolean;
6
+ isSubmenuOpen?: boolean;
7
+ dispatch: (actionType: number, item: any, nextIndex: FocusPosition) => void;
8
+ updateItems: (item: any, isMounted?: boolean) => void;
9
+ setOpenSubmenuCount: (fn: (count: number) => number) => void;
10
+ }
11
+
12
+ export const MenuListItemContext = createContext<MenuListItemContextType>({
13
+ dispatch: () => {},
14
+ updateItems: () => {},
15
+ setOpenSubmenuCount: () => 0,
16
+ });
@@ -0,0 +1,8 @@
1
+ import { createContext } from "react";
2
+ import { EventHandler, RadioChangeEvent } from "../types";
3
+
4
+ export const RadioGroupContext = createContext<{
5
+ value?: any;
6
+ name?: string;
7
+ onRadioChange?: EventHandler<RadioChangeEvent>;
8
+ }>({});
@@ -0,0 +1,20 @@
1
+ // FIXME hacking a default context in here is probably bad
2
+ import { createContext, MutableRefObject, RefObject } from "react";
3
+ import { ControlledMenuProps, MenuReposition, MenuViewScroll, RectElement, TransitionFieldType } from "../types";
4
+
5
+ interface SettingsContextType extends ControlledMenuProps {
6
+ rootMenuRef?: MutableRefObject<any>;
7
+ rootAnchorRef?: MutableRefObject<any>;
8
+ scrollNodesRef: MutableRefObject<{ anchors?: Element[]; menu?: any }>;
9
+
10
+ initialMounted?: boolean;
11
+ unmountOnClose?: boolean;
12
+ transition?: TransitionFieldType;
13
+ transitionTimeout?: number;
14
+ boundingBoxRef?: RefObject<Element | RectElement>;
15
+ boundingBoxPadding?: string;
16
+ reposition?: MenuReposition;
17
+ viewScroll?: MenuViewScroll;
18
+ }
19
+
20
+ export const SettingsContext = createContext<SettingsContextType>({} as SettingsContextType);
@@ -1,6 +1,8 @@
1
1
  import { useRef, useContext, useEffect, FocusEvent, MutableRefObject } from "react";
2
- import { ItemSettingsContext, MenuListItemContext, HoverActionTypes } from "../utils";
2
+ import { HoverActionTypes } from "../utils";
3
3
  import { useItemEffect } from "./useItemEffect";
4
+ import { MenuListItemContext } from "../contexts/MenuListItemContext";
5
+ import { ItemSettingsContext } from "../contexts/ItemSettingsContext";
4
6
 
5
7
  // This hook includes some common stateful logic in MenuItem and FocusableItem
6
8
  export const useItemState = (
@@ -9,4 +9,3 @@ export { MenuDivider } from "./components/MenuDivider";
9
9
  export { MenuHeader } from "./components/MenuHeader";
10
10
  export { MenuGroup } from "./components/MenuGroup";
11
11
  export { MenuRadioGroup } from "./components/MenuRadioGroup";
12
- export { ClickEvent } from "./types";
@@ -1,4 +1,4 @@
1
- @use 'sass:math';
1
+ @use "sass:math";
2
2
 
3
3
  $color: #212529;
4
4
  $color-dark: #cad1d8;
@@ -6,9 +6,9 @@ $color-disabled: #aaa;
6
6
  $color-disabled-dark: #666;
7
7
 
8
8
  $header-color: #888;
9
- $divider-color: rgba(0, 0, 0, 0.12);
9
+ $divider-color: rgb(0 0 0 / 12%);
10
10
  $divider-color-dark: #3a3a3a;
11
- $border-color: rgba(0, 0, 0, 0.1);
11
+ $border-color: rgb(0 0 0 / 10%);
12
12
  $border-color-dark: #333;
13
13
 
14
14
  $background-color: #fff;
@@ -17,4 +17,4 @@ $background-color-hover: #ebebeb;
17
17
  $background-color-hover-dark: #31363c;
18
18
 
19
19
  $arrow-size: 0.75rem;
20
- $arrow-pos: -(math.div($arrow-size, 2));
20
+ $arrow-pos: (math.div($arrow-size, 2));
@@ -1,9 +1,9 @@
1
- @use 'var';
2
- @use 'mixins';
1
+ @use "var";
2
+ @use "mixins";
3
3
 
4
4
  .szh-menu {
5
- @include mixins.reset-list;
6
- @include mixins.remove-focus;
5
+ @include mixins.reset-list ();
6
+ @include mixins.remove-focus ();
7
7
  box-sizing: border-box;
8
8
  width: max-content;
9
9
  z-index: 100;
@@ -42,7 +42,7 @@
42
42
  }
43
43
 
44
44
  &__item {
45
- @include mixins.remove-focus;
45
+ @include mixins.remove-focus ();
46
46
  cursor: pointer;
47
47
 
48
48
  &--hover {
@@ -65,7 +65,7 @@
65
65
  }
66
66
 
67
67
  &__radio-group {
68
- @include mixins.reset-list;
68
+ @include mixins.reset-list ();
69
69
  }
70
70
 
71
71
  &__divider {
@@ -1,12 +1,12 @@
1
- @use 'var';
2
- @use 'core';
1
+ @use "var";
2
+ @use "core";
3
3
 
4
4
  .szh-menu {
5
5
  user-select: none;
6
6
  color: var.$color;
7
7
  border: none;
8
8
  border-radius: 0.25rem;
9
- box-shadow: 0 3px 7px rgba(0, 0, 0, 0.133), 0 0.6px 2px rgba(0, 0, 0, 0.1);
9
+ box-shadow: 0 3px 7px rgb(0 0 0 / 13.3%), 0 0.6px 2px rgb(0 0 0 / 10%);
10
10
  min-width: 10rem;
11
11
  padding: 0.5rem 0;
12
12
 
@@ -26,8 +26,9 @@
26
26
 
27
27
  &--type-radio {
28
28
  padding-left: 2.2rem;
29
+
29
30
  &::before {
30
- content: '\25cb';
31
+ content: "\25cb";
31
32
  position: absolute;
32
33
  left: 0.8rem;
33
34
  top: 0.55rem;
@@ -36,11 +37,12 @@
36
37
  }
37
38
 
38
39
  &--type-radio#{&}--checked::before {
39
- content: '\25cf';
40
+ content: "\25cf";
40
41
  }
41
42
 
42
43
  &--type-checkbox {
43
44
  padding-left: 2.2rem;
45
+
44
46
  &::before {
45
47
  position: absolute;
46
48
  left: 0.8rem;
@@ -48,14 +50,15 @@
48
50
  }
49
51
 
50
52
  &--type-checkbox#{&}--checked::before {
51
- content: '\2714';
53
+ content: "\2714";
52
54
  }
53
55
  }
54
56
 
55
57
  &__submenu > .szh-menu__item {
56
58
  padding-right: 2.5rem;
59
+
57
60
  &::after {
58
- content: '\276f';
61
+ content: "\276f";
59
62
  position: absolute;
60
63
  right: 1rem;
61
64
  }
@@ -1,10 +1,10 @@
1
- @use 'var';
1
+ @use "var";
2
2
 
3
3
  .szh-menu-container--theme-dark .szh-menu {
4
4
  color: var.$color-dark;
5
5
  background-color: var.$background-color-dark;
6
6
  border: 1px solid var.$border-color-dark;
7
- box-shadow: 0 2px 9px 3px rgba(0, 0, 0, 0.25);
7
+ box-shadow: 0 2px 9px 3px rgb(0 0 0 / 25%);
8
8
 
9
9
  &__arrow {
10
10
  background-color: var.$background-color-dark;
@@ -16,9 +16,11 @@
16
16
  &--hover {
17
17
  background-color: var.$background-color-hover-dark;
18
18
  }
19
+
19
20
  &--focusable {
20
21
  background-color: inherit;
21
22
  }
23
+
22
24
  &--disabled {
23
25
  color: var.$color-disabled-dark;
24
26
  }
@@ -1,13 +1,13 @@
1
- @use 'sass:list';
2
- @use 'sass:map';
1
+ @use "sass:list";
2
+ @use "sass:map";
3
3
 
4
- $menu: 'szh-menu';
4
+ $menu: "szh-menu";
5
5
  $duration: 0.15s;
6
6
  $directions: (
7
- 'left': 'X' 1,
8
- 'right': 'X' -1,
9
- 'top': 'Y' 1,
10
- 'bottom': 'Y' -1
7
+ "left": "X" 1,
8
+ "right": "X" -1,
9
+ "top": "Y" 1,
10
+ "bottom": "Y" -1,
11
11
  );
12
12
 
13
13
  @mixin animation($name, $dir) {
@@ -43,5 +43,5 @@ $directions: (
43
43
  }
44
44
 
45
45
  @each $dir in map.keys($directions) {
46
- @include animation('slide', $dir);
46
+ @include animation("slide", $dir);
47
47
  }
@@ -1,17 +1,4 @@
1
- import { createContext, MutableRefObject, RefObject } from "react";
2
- import {
3
- ControlledMenuProps,
4
- EventHandler,
5
- FocusPosition,
6
- MenuDirection,
7
- MenuOverflow,
8
- MenuReposition,
9
- MenuState,
10
- MenuViewScroll,
11
- RectElement,
12
- TransitionFieldType,
13
- } from "../types";
14
- import { RadioChangeEvent } from "../components/MenuRadioGroup";
1
+ import { MenuState } from "../types";
15
2
 
16
3
  export const menuContainerClass = "szh-menu-container";
17
4
  export const menuClass = "szh-menu";
@@ -24,30 +11,6 @@ export const menuGroupClass = "group";
24
11
  export const subMenuClass = "submenu";
25
12
  export const radioGroupClass = "radio-group";
26
13
 
27
- export const HoverItemContext = createContext(undefined);
28
-
29
- interface MenuListItemContextType {
30
- isParentOpen?: boolean;
31
- isSubmenuOpen?: boolean;
32
- dispatch: (actionType: number, item: any, nextIndex: FocusPosition) => void;
33
- updateItems: (item: any, isMounted?: boolean) => void;
34
- setOpenSubmenuCount: (fn: (count: number) => number) => void;
35
- }
36
-
37
- export const MenuListItemContext = createContext<MenuListItemContextType>({
38
- dispatch: () => {},
39
- updateItems: () => {},
40
- setOpenSubmenuCount: () => 0,
41
- });
42
-
43
- export const MenuListContext = createContext<{
44
- overflow?: MenuOverflow;
45
- overflowAmt?: number;
46
- parentMenuRef?: MutableRefObject<any>;
47
- parentDir?: MenuDirection;
48
- reposSubmenu?: boolean;
49
- }>({});
50
-
51
14
  export interface RMEvent {
52
15
  value: any;
53
16
  syntheticEvent: any;
@@ -56,42 +19,6 @@ export interface RMEvent {
56
19
  key?: string;
57
20
  }
58
21
 
59
- export const EventHandlersContext = createContext<{
60
- handleClose?: () => void;
61
- handleClick: (event: RMEvent, checked: boolean) => void;
62
- }>({
63
- handleClick: () => {},
64
- });
65
-
66
- export const RadioGroupContext = createContext<{
67
- value?: any;
68
- name?: string;
69
- onRadioChange?: EventHandler<RadioChangeEvent>;
70
- }>({});
71
-
72
- interface SettingsContextType extends ControlledMenuProps {
73
- rootMenuRef?: MutableRefObject<any>;
74
- rootAnchorRef?: MutableRefObject<any>;
75
- scrollNodesRef: MutableRefObject<{ anchors?: Element[]; menu?: any }>;
76
-
77
- initialMounted?: boolean;
78
- unmountOnClose?: boolean;
79
- transition?: TransitionFieldType;
80
- transitionTimeout?: number;
81
- boundingBoxRef?: RefObject<Element | RectElement>;
82
- boundingBoxPadding?: string;
83
- reposition?: MenuReposition;
84
- viewScroll?: MenuViewScroll;
85
- }
86
-
87
- // FIXME hacking a default context in here is probably bad
88
- export const SettingsContext = createContext<SettingsContextType>({} as SettingsContextType);
89
-
90
- export const ItemSettingsContext = createContext<{ submenuCloseDelay: number; submenuOpenDelay: number }>({
91
- submenuOpenDelay: 0,
92
- submenuCloseDelay: 0,
93
- });
94
-
95
22
  export const Keys = Object.freeze({
96
23
  ENTER: "Enter",
97
24
  ESC: "Escape",
@@ -1,5 +1,5 @@
1
1
  import { memo, forwardRef, useContext, useRef, MutableRefObject } from "react";
2
- import { HoverItemContext } from "./constants";
2
+ import { HoverItemContext } from "../contexts/HoverItemContext";
3
3
 
4
4
  export interface withHoveringResultProps {
5
5
  isHovering?: boolean;
@@ -1,4 +1,3 @@
1
-
2
1
  .FormTest {
3
2
  display: inline-flex;
4
3
  flex-wrap: nowrap;
@@ -7,4 +6,4 @@
7
6
 
8
7
  .FormTest-textInput {
9
8
  width: 100px;
10
- }
9
+ }
@@ -3,7 +3,7 @@ import "./FormTest.scss";
3
3
  import { useCallback, useState } from "react";
4
4
  import { LuiTextInput } from "@linzjs/lui";
5
5
  import { wait } from "@utils/util";
6
- import { GridFormProps } from "@components/GridCell";
6
+ import { CellEditorCommon, CellParams } from "@components/GridCell";
7
7
  import { useGridPopoverHook } from "@components/GridPopoverHook";
8
8
  import { GridBaseRow } from "@components/Grid";
9
9
 
@@ -16,7 +16,8 @@ export interface IFormTestRow {
16
16
  distance: number | null;
17
17
  }
18
18
 
19
- export const FormTest = <RowType extends GridBaseRow>(props: GridFormProps<RowType>): JSX.Element => {
19
+ export const FormTest = <RowType extends GridBaseRow>(_props: CellEditorCommon): JSX.Element => {
20
+ const props = _props as CellParams<RowType>;
20
21
  const [v1, v2, ...v3] = props.value.split(" ");
21
22
 
22
23
  const [nameType, setNameType] = useState(v1);
@@ -34,7 +35,7 @@ export const FormTest = <RowType extends GridBaseRow>(props: GridFormProps<RowTy
34
35
  // Close form
35
36
  return true;
36
37
  }, [nameType, numba, plan, props.selectedRows]);
37
- const { popoverWrapper } = useGridPopoverHook(props, save);
38
+ const { popoverWrapper } = useGridPopoverHook({ className: _props.className, save });
38
39
 
39
40
  return popoverWrapper(
40
41
  <div style={{ display: "flex", flexDirection: "row" }} className={"FormTest Grid-popoverContainer"}>