@linzjs/step-ag-grid 1.4.4 → 1.4.6

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 (102) hide show
  1. package/dist/index.js +1631 -3040
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/components/GridLoadableCell.d.ts +2 -0
  4. package/dist/src/components/gridForm/GridFormDropDown.d.ts +1 -1
  5. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +1 -1
  6. package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +1 -1
  7. package/dist/src/react-menu3/components/ControlledMenu.d.ts +2 -0
  8. package/dist/src/react-menu3/components/FocusableItem.d.ts +9 -0
  9. package/dist/src/react-menu3/components/Menu.d.ts +16 -0
  10. package/dist/src/react-menu3/components/MenuButton.d.ts +8 -0
  11. package/dist/src/react-menu3/components/MenuDivider.d.ts +3 -0
  12. package/dist/src/react-menu3/components/MenuGroup.d.ts +12 -0
  13. package/dist/src/react-menu3/components/MenuHeader.d.ts +4 -0
  14. package/dist/src/react-menu3/components/MenuItem.d.ts +59 -0
  15. package/dist/src/react-menu3/components/MenuList.d.ts +57 -0
  16. package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +44 -0
  17. package/dist/src/react-menu3/components/SubMenu.d.ts +110 -0
  18. package/dist/src/react-menu3/hooks/index.d.ts +9 -0
  19. package/dist/src/react-menu3/hooks/useBEM.d.ts +10 -0
  20. package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +2 -0
  21. package/dist/src/react-menu3/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
  22. package/dist/src/react-menu3/hooks/useItemEffect.d.ts +2 -0
  23. package/dist/src/react-menu3/hooks/useItemState.d.ts +7 -0
  24. package/dist/src/react-menu3/hooks/useItems.d.ts +7 -0
  25. package/dist/src/react-menu3/hooks/useMenuChange.d.ts +2 -0
  26. package/dist/src/react-menu3/hooks/useMenuState.d.ts +14 -0
  27. package/dist/src/react-menu3/hooks/useMenuStateAndFocus.d.ts +2 -0
  28. package/dist/src/react-menu3/index.d.ts +402 -0
  29. package/dist/src/react-menu3/positionUtils/getPositionHelpers.d.ts +11 -0
  30. package/dist/src/react-menu3/positionUtils/index.d.ts +3 -0
  31. package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +8 -0
  32. package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +8 -0
  33. package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +19 -0
  34. package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +19 -0
  35. package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +13 -0
  36. package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +26 -0
  37. package/dist/src/react-menu3/style-utils/index.d.ts +11 -0
  38. package/dist/src/react-menu3/utils/constants.d.ts +92 -0
  39. package/dist/src/react-menu3/utils/index.d.ts +4 -0
  40. package/dist/src/react-menu3/utils/propTypes.d.ts +56 -0
  41. package/dist/src/react-menu3/utils/utils.d.ts +36 -0
  42. package/dist/src/react-menu3/utils/withHovering.d.ts +7 -0
  43. package/dist/src/stories/components/ReactMenu.stories.d.ts +8 -0
  44. package/dist/step-ag-grid.esm.js +1543 -2951
  45. package/dist/step-ag-grid.esm.js.map +1 -1
  46. package/package.json +22 -13
  47. package/src/components/GridLoadableCell.scss +4 -0
  48. package/src/components/GridLoadableCell.tsx +5 -1
  49. package/src/components/GridPopoverHook.tsx +4 -50
  50. package/src/components/gridForm/GridFormDropDown.tsx +3 -3
  51. package/src/components/gridForm/GridFormMultiSelect.tsx +12 -6
  52. package/src/components/gridForm/GridFormPopoutMenu.tsx +1 -1
  53. package/src/components/gridPopoverEdit/GridPopoverMenu.scss +6 -2
  54. package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +1 -1
  55. package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +7 -9
  56. package/src/react-menu3/components/ControlledMenu.tsx +261 -0
  57. package/src/react-menu3/components/FocusableItem.tsx +75 -0
  58. package/src/react-menu3/components/Menu.tsx +108 -0
  59. package/src/react-menu3/components/MenuButton.tsx +34 -0
  60. package/src/react-menu3/components/MenuDivider.tsx +17 -0
  61. package/src/react-menu3/components/MenuGroup.tsx +47 -0
  62. package/src/react-menu3/components/MenuHeader.tsx +17 -0
  63. package/src/react-menu3/components/MenuItem.tsx +183 -0
  64. package/src/react-menu3/components/MenuList.tsx +502 -0
  65. package/src/react-menu3/components/MenuRadioGroup.tsx +72 -0
  66. package/src/react-menu3/components/SubMenu.tsx +349 -0
  67. package/src/react-menu3/hooks/index.ts +9 -0
  68. package/src/react-menu3/hooks/useBEM.ts +33 -0
  69. package/src/react-menu3/hooks/useCombinedRef.ts +24 -0
  70. package/src/react-menu3/hooks/useIsomorphicLayoutEffect.ts +15 -0
  71. package/src/react-menu3/hooks/useItemEffect.ts +23 -0
  72. package/src/react-menu3/hooks/useItemState.ts +67 -0
  73. package/src/react-menu3/hooks/useItems.ts +111 -0
  74. package/src/react-menu3/hooks/useMenuChange.ts +12 -0
  75. package/src/react-menu3/hooks/useMenuState.ts +42 -0
  76. package/src/react-menu3/hooks/useMenuStateAndFocus.ts +17 -0
  77. package/src/react-menu3/index.d.ts +683 -0
  78. package/src/react-menu3/index.ts +442 -0
  79. package/src/react-menu3/positionUtils/getPositionHelpers.ts +83 -0
  80. package/src/react-menu3/positionUtils/index.ts +3 -0
  81. package/src/react-menu3/positionUtils/placeArrowHorizontal.ts +15 -0
  82. package/src/react-menu3/positionUtils/placeArrowVertical.ts +15 -0
  83. package/src/react-menu3/positionUtils/placeLeftorRight.ts +92 -0
  84. package/src/react-menu3/positionUtils/placeToporBottom.ts +93 -0
  85. package/src/react-menu3/positionUtils/positionContextMenu.ts +61 -0
  86. package/src/react-menu3/positionUtils/positionMenu.ts +80 -0
  87. package/src/react-menu3/style-utils/index.ts +83 -0
  88. package/src/react-menu3/style-utils.d.ts +110 -0
  89. package/src/react-menu3/styles/_mixins.scss +11 -0
  90. package/src/react-menu3/styles/_var.scss +20 -0
  91. package/src/react-menu3/styles/core.scss +80 -0
  92. package/src/react-menu3/styles/index.scss +70 -0
  93. package/src/react-menu3/styles/theme-dark.scss +30 -0
  94. package/src/react-menu3/styles/transitions/slide.scss +47 -0
  95. package/src/react-menu3/utils/constants.ts +116 -0
  96. package/src/react-menu3/utils/index.ts +4 -0
  97. package/src/react-menu3/utils/propTypes.ts +63 -0
  98. package/src/react-menu3/utils/utils.ts +88 -0
  99. package/src/react-menu3/utils/withHovering.tsx +27 -0
  100. package/src/stories/components/GridPopoutEditDropDown.stories.tsx +1 -3
  101. package/src/stories/components/ReactMenu.stories.tsx +37 -0
  102. package/src/utils/util.ts +2 -1
@@ -0,0 +1,402 @@
1
+ /// <reference types="react" />
2
+ export { useMenuState } from "./hooks";
3
+ export { MenuButton } from "./components/MenuButton";
4
+ export { Menu } from "./components/Menu";
5
+ export { ControlledMenu } from "./components/ControlledMenu";
6
+ export { SubMenu } from "./components/SubMenu";
7
+ export { MenuItem } from "./components/MenuItem";
8
+ export { FocusableItem } from "./components/FocusableItem";
9
+ export { MenuDivider } from "./components/MenuDivider";
10
+ export { MenuHeader } from "./components/MenuHeader";
11
+ export { MenuGroup } from "./components/MenuGroup";
12
+ export { MenuRadioGroup } from "./components/MenuRadioGroup";
13
+ export declare type MenuState = "opening" | "open" | "closing" | "closed";
14
+ export declare type MenuAlign = "start" | "center" | "end";
15
+ export declare type MenuDirection = "left" | "right" | "top" | "bottom";
16
+ export declare type MenuPosition = "auto" | "anchor" | "initial";
17
+ export declare type MenuOverflow = "auto" | "visible" | "hidden";
18
+ export declare type MenuReposition = "auto" | "initial";
19
+ export declare type MenuViewScroll = "auto" | "close" | "initial";
20
+ export declare type MenuItemTypeProp = "checkbox" | "radio";
21
+ export declare type CloseReason = "click" | "cancel" | "blur" | "scroll";
22
+ /**
23
+ * - `'first'` focus the first item in the menu.
24
+ * - `'last'` focus the last item in the menu.
25
+ * - `number` focus item at the specific position (zero-based).
26
+ */
27
+ export declare type FocusPosition = "first" | "last" | number;
28
+ export declare type ClassNameProp<M = undefined> = string | ((modifiers: M) => string);
29
+ export declare type RenderProp<M, R = React.ReactNode> = R | ((modifiers: M) => R);
30
+ export interface BaseProps<M = undefined> extends Omit<React.HTMLAttributes<HTMLElement>, "className" | "children"> {
31
+ ref?: React.Ref<any>;
32
+ /**
33
+ * Can be a string or a function which receives a modifier object and returns a CSS `class` string.
34
+ */
35
+ className?: ClassNameProp<M>;
36
+ }
37
+ export interface Event {
38
+ /**
39
+ * The `value` prop passed to the `MenuItem` being clicked.
40
+ * It's useful for identifying which menu item is clicked.
41
+ */
42
+ value?: any;
43
+ /**
44
+ * Indicates the key if the event is triggered by keyboard. Can be 'Enter', ' '(Space) or 'Escape'.
45
+ */
46
+ key?: string;
47
+ }
48
+ export interface MenuCloseEvent extends Event {
49
+ /**
50
+ * The reason that causes the close event.
51
+ */
52
+ reason: CloseReason;
53
+ }
54
+ export interface MenuChangeEvent {
55
+ /**
56
+ * Indicates if the menu is open or closed.
57
+ */
58
+ open: boolean;
59
+ }
60
+ export interface EventHandler<E> {
61
+ (event: E): void;
62
+ }
63
+ export interface RectElement {
64
+ getBoundingClientRect(): {
65
+ left: number;
66
+ right: number;
67
+ top: number;
68
+ bottom: number;
69
+ width: number;
70
+ height: number;
71
+ };
72
+ }
73
+ export declare type MenuModifiers = Readonly<{
74
+ /**
75
+ * Indicates the state of menu.
76
+ */
77
+ state: MenuState;
78
+ /**
79
+ * Computed direction in which the menu expands.
80
+ */
81
+ dir: MenuDirection;
82
+ }>;
83
+ export declare type MenuArrowModifiers = Readonly<{
84
+ /**
85
+ * Computed direction in which the menu expands.
86
+ *
87
+ * *Please note arrow points to the opposite direction of this value.*
88
+ */
89
+ dir: MenuDirection;
90
+ }>;
91
+ export interface MenuStateOptions {
92
+ /**
93
+ * By default menu isn't mounted into DOM until it's opened for the first time.
94
+ * Setting the prop to `true` will change this behaviour,
95
+ * which also enables menu and its items to be server rendered.
96
+ */
97
+ initialMounted?: boolean;
98
+ /**
99
+ * By default menu remains in DOM when it's closed.
100
+ * Setting the prop to `true` will change this behaviour.
101
+ */
102
+ unmountOnClose?: boolean;
103
+ /**
104
+ * Enable or disable transition effects in `Menu`, `MenuItem`, and any descendent `SubMenu`.
105
+ *
106
+ * You can set 'open', 'close' and 'item' at the same time with one boolean value or separately with an object.
107
+ *
108
+ * *If you enable transition on menu, make sure to add your own animation styles,
109
+ * or import `'@szhsin/react-menu/dist/transitions/slide.css'`,
110
+ * otherwise menu cannot be closed or have visible delay when closed.*
111
+ *
112
+ * @example [CodeSandbox Demo](https://codesandbox.io/s/react-menu-sass-i1wxo)
113
+ */
114
+ transition?: boolean | {
115
+ open?: boolean;
116
+ close?: boolean;
117
+ item?: boolean;
118
+ };
119
+ /**
120
+ * A fallback timeout in `ms` to stop transition if `onAnimationEnd` events are not fired.
121
+ *
122
+ * *Note: this value should be greater than or equal to the duration of
123
+ * transition animation applied on menu.*
124
+ *
125
+ * @default 500
126
+ */
127
+ transitionTimeout?: number;
128
+ }
129
+ export interface Hoverable {
130
+ disabled?: boolean;
131
+ index?: number;
132
+ }
133
+ /**
134
+ * Common props for `Menu`, `SubMenu` and `ControlledMenu`
135
+ */
136
+ interface BaseMenuProps extends Omit<BaseProps, "style"> {
137
+ /**
138
+ * Can be a string or a function which receives a modifier object and returns a CSS `class` string.
139
+ */
140
+ menuClassName?: ClassNameProp<MenuModifiers>;
141
+ /**
142
+ * This prop is forwarded to the `style` prop of menu DOM element.
143
+ */
144
+ menuStyle?: React.CSSProperties;
145
+ /**
146
+ * Can be a string or a function which receives a modifier object and returns a CSS `class` string.
147
+ */
148
+ arrowClassName?: ClassNameProp<MenuArrowModifiers>;
149
+ /**
150
+ * This prop is forwarded to the `style` prop of menu arrow DOM element.
151
+ */
152
+ arrowStyle?: React.CSSProperties;
153
+ /**
154
+ * Set `true` to display an arrow pointing to its anchor element.
155
+ */
156
+ arrow?: boolean;
157
+ /**
158
+ * Set the horizontal distance (in pixels) between menu and its anchor element.
159
+ * The value can be negative.
160
+ * @default 0
161
+ */
162
+ offsetX?: number;
163
+ /**
164
+ * Set the vertical distance (in pixels) between menu and its anchor element.
165
+ * The value can be negative.
166
+ * @default 0
167
+ */
168
+ offsetY?: number;
169
+ /**
170
+ * Set alignment of menu with anchor element.
171
+ * @default 'start'
172
+ */
173
+ align?: MenuAlign;
174
+ /**
175
+ * Set direction in which menu expands against anchor element.
176
+ * @default 'bottom'
177
+ */
178
+ direction?: MenuDirection;
179
+ /**
180
+ * Set the position of menu related to its anchor element:
181
+ *
182
+ * - 'auto' menu position is adjusted to have it contained within the viewport,
183
+ * even if it will be detached from the anchor element.
184
+ * This option allows to display menu in the viewport as much as possible.
185
+ *
186
+ * - 'anchor' menu position is adjusted to have it contained within the viewport,
187
+ * but it will be kept attached to the edges of anchor element.
188
+ *
189
+ * - 'initial' menu always stays at its initial position.
190
+ * @default 'auto'
191
+ */
192
+ position?: MenuPosition;
193
+ /**
194
+ * Make the menu list scrollable or hidden when there is not enough viewport space to
195
+ * display all menu items. The prop is similar to the CSS `overflow` property.
196
+ * @default 'visible'
197
+ */
198
+ overflow?: MenuOverflow;
199
+ /**
200
+ * Set computed overflow amount down to a child `MenuGroup`.
201
+ * The `MenuGroup` should have `takeOverflow` prop set as `true` accordingly.
202
+ */
203
+ setDownOverflow?: boolean;
204
+ children?: React.ReactNode;
205
+ }
206
+ export declare type MenuButtonModifiers = Readonly<{
207
+ /**
208
+ * Indicates if the associated menu is open.
209
+ */
210
+ open: boolean;
211
+ }>;
212
+ export interface MenuInstance {
213
+ /**
214
+ * Open menu and optionally request which menu item will be hovered.
215
+ */
216
+ openMenu: (position?: FocusPosition, alwaysUpdate?: boolean) => void;
217
+ /**
218
+ * Close menu
219
+ */
220
+ closeMenu: () => void;
221
+ }
222
+ /**
223
+ * Common props for `Menu` and `SubMenu`
224
+ */
225
+ export interface UncontrolledMenuProps {
226
+ /**
227
+ * Menu component ref which can be used to programmatically open or close menu.
228
+ */
229
+ instanceRef?: React.Ref<MenuInstance>;
230
+ /**
231
+ * Event fired after menu is open or closed.
232
+ */
233
+ onMenuChange?: EventHandler<MenuChangeEvent>;
234
+ }
235
+ export interface RadioChangeEvent extends Event {
236
+ /**
237
+ * The `name` prop passed to the `MenuRadioGroup` when the menu item is in a radio group.
238
+ */
239
+ name?: string;
240
+ /**
241
+ * Set this property on event object to control whether to keep menu open after menu item is activated.
242
+ * Leaving it `undefined` will behave in accordance with WAI-ARIA Authoring Practices.
243
+ */
244
+ keepOpen?: boolean;
245
+ /**
246
+ * Setting this property on event object to `true` will skip `onItemClick` event on root menu component.
247
+ */
248
+ stopPropagation?: boolean;
249
+ /**
250
+ * DOM event object (React synthetic event)
251
+ */
252
+ syntheticEvent: MouseEvent | KeyboardEvent;
253
+ }
254
+ export interface ClickEvent extends RadioChangeEvent {
255
+ /**
256
+ * Indicates if the menu item is checked, only for `MenuItem` type="checkbox".
257
+ */
258
+ checked?: boolean;
259
+ }
260
+ /**
261
+ * Common props for `Menu` and `ControlledMenu`
262
+ */
263
+ export interface RootMenuProps extends BaseMenuProps, MenuStateOptions {
264
+ /**
265
+ * Properties of this object are spread to the root DOM element containing the menu.
266
+ */
267
+ containerProps?: Omit<React.HTMLAttributes<HTMLElement>, "className">;
268
+ /**
269
+ * A ref object attached to a DOM element within which menu will be positioned.
270
+ * If not provided, the nearest ancestor which has CSS `overflow` set to a value
271
+ * other than 'visible' or the browser viewport will serve as the bounding box.
272
+ */
273
+ boundingBoxRef?: React.RefObject<Element | RectElement>;
274
+ /**
275
+ * Specify bounding box padding in pixels. Use a syntax similar to the CSS
276
+ * `padding` property but sizing units are discarded.
277
+ * @example '10', '5 10', '1 2 4', or '2 5 3 1'
278
+ */
279
+ boundingBoxPadding?: string;
280
+ /**
281
+ * Set the behaviour of menu and any of its descendent submenus when window is scrolling:
282
+ * - 'initial' The window scroll event is ignored and has no effect on menu.
283
+ * - 'auto' Menu will reposition itself based on the value of `position` prop when window is scrolling.
284
+ * - 'close' menu will be closed when window is scrolled.
285
+ * @default 'initial'
286
+ */
287
+ viewScroll?: MenuViewScroll;
288
+ /**
289
+ * - If `true`, menu is rendered as a direct child of `document.body`,
290
+ * - or you can specify a target element in the DOM as menu container.
291
+ *
292
+ * Portal allows menu to visually “break out” of its container. Typical use cases may include:
293
+ * - An ancestor container is positioned and CSS `overflow` is set to a value other than `visible`.
294
+ * - You have a DOM structure that creates a complex hierarchy of stacking contexts,
295
+ * and menu is overlapped regardless of `z-index` value.
296
+ */
297
+ portal?: boolean | {
298
+ /**
299
+ * A DOM node under which menu will be rendered.
300
+ */
301
+ target?: Element | null;
302
+ /**
303
+ * When `target` is null, setting this value `true` prevents menu from rendering into the DOM hierarchy of its parent component.
304
+ */
305
+ stablePosition?: boolean;
306
+ };
307
+ /**
308
+ * Specify when menu is repositioned:
309
+ * - 'initial' Don't automatically reposition menu. Set to this value when you want
310
+ * to explicitly reposition menu using the `repositionFlag` prop.
311
+ * - 'auto' Reposition menu whenever its size has changed, using the `ResizeObserver` API.
312
+ * @default 'auto'
313
+ */
314
+ reposition?: MenuReposition;
315
+ /**
316
+ * Use this prop to explicitly reposition menu. Whenever the prop has a new value,
317
+ * menu position will be recalculated and updated.
318
+ * You might use a counter and increase it every time.
319
+ *
320
+ * *Warning: don't update this prop in rapid succession,
321
+ * which is inefficient and might cause infinite rendering of component.
322
+ * E.g., don't change the value of this prop in `window` scroll event.*
323
+ */
324
+ repositionFlag?: number | string;
325
+ /**
326
+ * Set a delay in `ms` before opening a submenu when mouse moves over it.
327
+ * @default 300
328
+ */
329
+ submenuOpenDelay?: number;
330
+ /**
331
+ * Set a delay in `ms` before closing a submenu when it's open and mouse is
332
+ * moving over other items in the parent menu list.
333
+ * @default 150
334
+ */
335
+ submenuCloseDelay?: number;
336
+ /**
337
+ * Set a CSS `class` on the container element of menu for theming purpose.
338
+ */
339
+ theming?: string;
340
+ /**
341
+ * Event fired when descendent menu items are clicked.
342
+ */
343
+ onItemClick?: EventHandler<ClickEvent>;
344
+ }
345
+ export interface MenuProps extends RootMenuProps, UncontrolledMenuProps {
346
+ /**
347
+ * Can be a `MenuButton`, a `button` element, or a React component.
348
+ * It also can be a render function that returns one.
349
+ *
350
+ * If a React component is provided, it needs to implement the following contracts:
351
+ * - Accepts a `ref` prop that is forwarded to an element to which menu will be positioned.
352
+ * The element should be able to receive focus.
353
+ * - Accepts `onClick` and `onKeyDown` event props.
354
+ */
355
+ menuButton: RenderProp<MenuButtonModifiers, React.ReactElement>;
356
+ }
357
+ export interface ControlledMenuProps extends RootMenuProps {
358
+ /**
359
+ * Viewport coordinates to which context menu will be positioned.
360
+ *
361
+ * *Use this prop only for context menu*
362
+ */
363
+ anchorPoint?: {
364
+ x: number;
365
+ y: number;
366
+ };
367
+ /**
368
+ * A ref object attached to a DOM element to which menu will be positioned.
369
+ *
370
+ * *Don't set this prop for context menu*
371
+ */
372
+ anchorRef?: React.RefObject<Element | RectElement>;
373
+ skipOpen?: React.RefObject<boolean>;
374
+ /**
375
+ * If `true`, the menu list element will gain focus after menu is open.
376
+ * @default true
377
+ */
378
+ captureFocus?: boolean;
379
+ /**
380
+ * Controls the state of menu. When the prop is `undefined`, menu will be unmounted from DOM.
381
+ */
382
+ state?: MenuState;
383
+ /**
384
+ * Sets which menu item receives focus (hover) when menu opens.
385
+ * You will usually set this prop when the menu is opened by keyboard events.
386
+ *
387
+ * *Note: If you don't intend to update focus (hover) position,
388
+ * it's important to keep this prop's identity stable when your component re-renders.*
389
+ */
390
+ menuItemFocus?: {
391
+ position?: FocusPosition;
392
+ alwaysUpdate?: boolean;
393
+ };
394
+ /**
395
+ * Set the return value of `useMenuState` to this prop.
396
+ */
397
+ endTransition?: () => void;
398
+ /**
399
+ * Event fired when menu is about to close.
400
+ */
401
+ onClose?: EventHandler<MenuCloseEvent>;
402
+ }
@@ -0,0 +1,11 @@
1
+ import { MutableRefObject } from "react";
2
+ export declare const getPositionHelpers: (containerRef: MutableRefObject<HTMLElement>, menuRef: MutableRefObject<HTMLElement>, menuScroll: Window | Element, boundingBoxPadding: string | undefined) => {
3
+ menuRect: DOMRect;
4
+ containerRect: DOMRect;
5
+ getLeftOverflow: (x: number) => number;
6
+ getRightOverflow: (x: number) => number;
7
+ getTopOverflow: (y: number) => number;
8
+ getBottomOverflow: (y: number) => number;
9
+ confineHorizontally: (x: number) => number;
10
+ confineVertically: (y: number) => number;
11
+ };
@@ -0,0 +1,3 @@
1
+ export { getPositionHelpers } from "./getPositionHelpers";
2
+ export { positionContextMenu } from "./positionContextMenu";
3
+ export { positionMenu } from "./positionMenu";
@@ -0,0 +1,8 @@
1
+ import { MutableRefObject } from "react";
2
+ export declare const placeArrowHorizontal: (p: {
3
+ arrowRef: MutableRefObject<HTMLElement | null>;
4
+ menuX: number;
5
+ anchorRect: DOMRect;
6
+ containerRect: DOMRect;
7
+ menuRect: DOMRect;
8
+ }) => number;
@@ -0,0 +1,8 @@
1
+ import { MutableRefObject } from "react";
2
+ export declare const placeArrowVertical: (p: {
3
+ arrowRef: MutableRefObject<HTMLElement | null>;
4
+ menuY: number;
5
+ anchorRect: DOMRect;
6
+ containerRect: DOMRect;
7
+ menuRect: DOMRect;
8
+ }) => number;
@@ -0,0 +1,19 @@
1
+ import { getPositionHelpers } from "./getPositionHelpers";
2
+ import { MutableRefObject } from "react";
3
+ import { MenuDirection } from "../index";
4
+ export interface placeLeftorRightParams {
5
+ anchorRect: DOMRect;
6
+ placeLeftorRightY: number;
7
+ placeLeftX: number;
8
+ placeRightX: number;
9
+ arrowRef: MutableRefObject<HTMLElement | null>;
10
+ arrow?: boolean;
11
+ direction: MenuDirection;
12
+ position: "auto" | "anchor" | "initial";
13
+ }
14
+ export declare const placeLeftorRight: (props: ReturnType<typeof getPositionHelpers> & placeLeftorRightParams) => {
15
+ arrowY: number | undefined;
16
+ x: number;
17
+ y: number;
18
+ computedDirection: MenuDirection;
19
+ };
@@ -0,0 +1,19 @@
1
+ import { getPositionHelpers } from "./getPositionHelpers";
2
+ import { MutableRefObject } from "react";
3
+ import { MenuDirection } from "../index";
4
+ export interface placeToporBottomParams {
5
+ anchorRect: DOMRect;
6
+ placeToporBottomX: number;
7
+ placeTopY: number;
8
+ placeBottomY: number;
9
+ arrowRef: MutableRefObject<HTMLElement | null>;
10
+ arrow?: boolean;
11
+ direction: "left" | "right" | "top" | "bottom";
12
+ position: "auto" | "anchor" | "initial";
13
+ }
14
+ export declare const placeToporBottom: (props: ReturnType<typeof getPositionHelpers> & placeToporBottomParams) => {
15
+ arrowX?: number | undefined;
16
+ x: number;
17
+ y: number;
18
+ computedDirection: MenuDirection;
19
+ };
@@ -0,0 +1,13 @@
1
+ import { getPositionHelpers } from "./getPositionHelpers";
2
+ import { MenuDirection } from "../index";
3
+ export declare const positionContextMenu: ({ positionHelpers, anchorPoint, }: {
4
+ positionHelpers: ReturnType<typeof getPositionHelpers>;
5
+ anchorPoint: {
6
+ x: number;
7
+ y: number;
8
+ };
9
+ }) => {
10
+ x: number;
11
+ y: number;
12
+ computedDirection: MenuDirection;
13
+ };
@@ -0,0 +1,26 @@
1
+ import { MutableRefObject } from "react";
2
+ import { getPositionHelpers } from "./getPositionHelpers";
3
+ import { MenuDirection } from "../index";
4
+ interface positionMenuProps {
5
+ offsetX: number;
6
+ offsetY: number;
7
+ arrowRef: MutableRefObject<HTMLDivElement | null>;
8
+ anchorRef: MutableRefObject<HTMLElement | null>;
9
+ arrow?: boolean;
10
+ direction: MenuDirection;
11
+ position: "auto" | "anchor" | "initial";
12
+ align: "start" | "center" | "end";
13
+ positionHelpers: ReturnType<typeof getPositionHelpers>;
14
+ }
15
+ export declare const positionMenu: (props: positionMenuProps) => {
16
+ arrowY: number | undefined;
17
+ x: number;
18
+ y: number;
19
+ computedDirection: MenuDirection;
20
+ } | {
21
+ arrowX?: number | undefined;
22
+ x: number;
23
+ y: number;
24
+ computedDirection: MenuDirection;
25
+ };
26
+ export {};
@@ -0,0 +1,11 @@
1
+ declare const menuSelector: {};
2
+ declare const menuArrowSelector: {};
3
+ declare const menuItemSelector: {};
4
+ declare const menuDividerSelector: {};
5
+ declare const menuHeaderSelector: {};
6
+ declare const menuGroupSelector: {};
7
+ declare const radioGroupSelector: {};
8
+ declare const submenuSelector: {};
9
+ declare const menuContainerSelector: {};
10
+ declare const menuButtonSelector: {};
11
+ export { menuContainerSelector, menuButtonSelector, menuSelector, menuArrowSelector, menuItemSelector, menuDividerSelector, menuHeaderSelector, menuGroupSelector, radioGroupSelector, submenuSelector, };
@@ -0,0 +1,92 @@
1
+ import { MutableRefObject } from "react";
2
+ import { EventHandler, FocusPosition, MenuDirection, MenuOverflow, MenuState } from "../index";
3
+ import { RadioChangeEvent } from "../components/MenuRadioGroup";
4
+ import { ControlledMenuProps } from "../components/MenuList";
5
+ export declare const menuContainerClass = "szh-menu-container";
6
+ export declare const menuClass = "szh-menu";
7
+ export declare const menuButtonClass = "szh-menu-button";
8
+ export declare const menuArrowClass = "arrow";
9
+ export declare const menuItemClass = "item";
10
+ export declare const menuDividerClass = "divider";
11
+ export declare const menuHeaderClass = "header";
12
+ export declare const menuGroupClass = "group";
13
+ export declare const subMenuClass = "submenu";
14
+ export declare const radioGroupClass = "radio-group";
15
+ export declare const HoverItemContext: import("react").Context<undefined>;
16
+ interface MenuListItemContextType {
17
+ isParentOpen?: boolean;
18
+ isSubmenuOpen?: boolean;
19
+ dispatch: (actionType: number, item: any, nextIndex: FocusPosition) => void;
20
+ updateItems: (item: any, isMounted?: boolean) => void;
21
+ setOpenSubmenuCount: (fn: (count: number) => number) => void;
22
+ }
23
+ export declare const MenuListItemContext: import("react").Context<MenuListItemContextType>;
24
+ export declare const MenuListContext: import("react").Context<{
25
+ overflow?: MenuOverflow | undefined;
26
+ overflowAmt?: number | undefined;
27
+ parentMenuRef?: MutableRefObject<any> | undefined;
28
+ parentDir?: MenuDirection | undefined;
29
+ reposSubmenu?: boolean | undefined;
30
+ }>;
31
+ export interface RMEvent {
32
+ value: any;
33
+ syntheticEvent: any;
34
+ checked?: boolean;
35
+ name?: string;
36
+ key?: string;
37
+ }
38
+ export declare const EventHandlersContext: import("react").Context<{
39
+ handleClose?: (() => void) | undefined;
40
+ handleClick: (event: RMEvent, checked: boolean) => void;
41
+ }>;
42
+ export declare const RadioGroupContext: import("react").Context<{
43
+ value?: any;
44
+ name?: string | undefined;
45
+ onRadioChange?: EventHandler<RadioChangeEvent> | undefined;
46
+ }>;
47
+ interface SettingsContextType extends ControlledMenuProps, MenuListItemContextType {
48
+ rootMenuRef?: MutableRefObject<any>;
49
+ rootAnchorRef?: MutableRefObject<any>;
50
+ scrollNodesRef: MutableRefObject<{
51
+ anchors?: Element[];
52
+ menu: any;
53
+ }>;
54
+ }
55
+ export declare const SettingsContext: import("react").Context<SettingsContextType>;
56
+ export declare const ItemSettingsContext: import("react").Context<{
57
+ submenuCloseDelay: number;
58
+ submenuOpenDelay: number;
59
+ }>;
60
+ export declare const Keys: Readonly<{
61
+ ENTER: "Enter";
62
+ ESC: "Escape";
63
+ SPACE: " ";
64
+ HOME: "Home";
65
+ END: "End";
66
+ LEFT: "ArrowLeft";
67
+ RIGHT: "ArrowRight";
68
+ UP: "ArrowUp";
69
+ DOWN: "ArrowDown";
70
+ }>;
71
+ export declare const HoverActionTypes: Readonly<{
72
+ RESET: 0;
73
+ SET: 1;
74
+ UNSET: 2;
75
+ INCREASE: 3;
76
+ DECREASE: 4;
77
+ FIRST: 5;
78
+ LAST: 6;
79
+ SET_INDEX: 7;
80
+ }>;
81
+ export declare const CloseReason: Readonly<{
82
+ CLICK: "click";
83
+ CANCEL: "cancel";
84
+ BLUR: "blur";
85
+ SCROLL: "scroll";
86
+ }>;
87
+ export declare const FocusPositions: Readonly<{
88
+ FIRST: "first";
89
+ LAST: "last";
90
+ }>;
91
+ export declare const MenuStateMap: Record<string, MenuState>;
92
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from "./constants";
2
+ export * from "./utils";
3
+ export * from "./propTypes";
4
+ export { withHovering } from "./withHovering";