@enonic/ui 1.0.0-beta.5 → 1.0.0-beta.7

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.
@@ -58,4 +58,4 @@ import { SetStateAction } from 'react';
58
58
  * }
59
59
  * ```
60
60
  */
61
- export declare function useControlledState<T>(controlledValue: T | undefined, defaultValue: T, onChange?: (value: T) => void): [T, (action: SetStateAction<T>) => void];
61
+ export declare function useControlledState<T>(controlledValue: T | undefined, defaultValue: T, onChange?: (value: T) => void, isControlled?: boolean): [T, (action: SetStateAction<T>) => void];
@@ -26,6 +26,17 @@ export type UseItemRegistryReturn = {
26
26
  * @returns True if the item is disabled
27
27
  */
28
28
  isItemDisabled: (id: string) => boolean;
29
+ /**
30
+ * Returns the registered DOM element for an item.
31
+ *
32
+ * Resolves through the in-memory registry so it works inside Shadow DOM
33
+ * (where `document.getElementById` does not pierce shadow root boundaries).
34
+ *
35
+ * @param id - Item ID to look up
36
+ * @returns The element passed to `registerItem`, or `null` if the item is
37
+ * unregistered or was registered without an element reference
38
+ */
39
+ getItemElement: (id: string) => HTMLElement | null;
29
40
  /**
30
41
  * Version counter that increments when items are registered or unregistered.
31
42
  * Use as a dependency in useEffect to react to item changes.
@@ -13,6 +13,7 @@ export type ContextMenuContentContextValue = {
13
13
  unregisterItem: (id: string) => void;
14
14
  getItems: () => string[];
15
15
  isItemDisabled: (id: string) => boolean;
16
+ getItemElement: (id: string) => HTMLElement | null;
16
17
  /**
17
18
  * Safe-triangle check registered by a currently-open child `Sub`. When non-null,
18
19
  * the Content's pointer-move capture handler consults it to decide whether to
@@ -9,6 +9,7 @@ export type MenuContextValue = {
9
9
  unregisterItem: (id: string) => void;
10
10
  getItems: () => string[];
11
11
  isItemDisabled: (id: string) => boolean;
12
+ getItemElement: (id: string) => HTMLElement | null;
12
13
  triggerRef: RefObject<HTMLButtonElement> | null;
13
14
  };
14
15
  export type MenuProviderProps = {
@@ -21,6 +21,7 @@ export type MenubarContextValue = {
21
21
  unregisterItem: (id: string) => void;
22
22
  getItems: () => string[];
23
23
  isItemDisabled: (id: string) => boolean;
24
+ getItemElement: (id: string) => HTMLElement | null;
24
25
  /**
25
26
  * ID of the currently open menu (if any).
26
27
  * Tracks which menu is expanded in the menubar for conditional hover behavior.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic/ui",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.7",
4
4
  "description": "Enonic UI Component Library",
5
5
  "author": "Enonic",
6
6
  "license": "MIT",