@sheetxl/utils-react 0.7.27 → 0.7.28-beta.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/browser/cjs/C7jPCqFJNiWyD2pr.cjs +1 -0
- package/browser/cjs/CyWMySHsu-RvsIGs.cjs +1 -0
- package/browser/cjs/DZSvmqU8nRas1uz6.cjs +1 -0
- package/browser/cjs/index.cjs +5 -7
- package/browser/esm/7-_IBNtjW6k90P9e.mjs +390 -0
- package/browser/esm/BgV0nMxx2V13JMAV.mjs +2171 -0
- package/browser/esm/index.mjs +6128 -1806
- package/browser/esm/sLI7RooaRwVJN8R1.mjs +139 -0
- package/licenses/dependencies.txt +246 -39
- package/node/esm/DxhVj6bgjkjclg0J.mjs +139 -0
- package/node/esm/index.mjs +5141 -1774
- package/node/esm/k3zNlJ7uOn8Nfx4T.mjs +2171 -0
- package/package.json +8 -5
- package/types/index.d.ts +2 -2043
- package/types/src/animation/AnimationModeContext.d.ts +10 -0
- package/types/src/animation/index.d.ts +3 -0
- package/types/src/animation/useAnimatedMeasure.d.ts +39 -0
- package/types/src/command/ActivationTracker.d.ts +53 -0
- package/types/src/command/CommandAnchorProvider.d.ts +64 -0
- package/types/src/command/CommandButtonEntryLabel.d.ts +25 -0
- package/types/src/command/CommandButtonRegistry.d.ts +159 -0
- package/types/src/command/CommandButtonRegistryContext.d.ts +35 -0
- package/types/src/command/CommandCatalog.d.ts +155 -0
- package/types/src/command/CommandCatalogResource.d.ts +7 -0
- package/types/src/command/CommandCatalogService.d.ts +61 -0
- package/types/src/command/CommandChainContext.d.ts +32 -0
- package/types/src/command/CommandFallbackContext.d.ts +30 -0
- package/types/src/command/CommandFocusContext.d.ts +21 -0
- package/types/src/command/CommandRegistry.d.ts +164 -0
- package/types/src/command/CommandRegistryContext.d.ts +16 -0
- package/types/src/command/CommandResolver.d.ts +162 -0
- package/types/src/command/CommandScope.d.ts +343 -0
- package/types/src/command/CommandScopeContext.d.ts +205 -0
- package/types/src/command/FocusActivation.d.ts +140 -0
- package/types/src/command/ICommand.d.ts +31 -0
- package/types/src/command/ICommandDefinition.d.ts +82 -0
- package/types/src/command/KeyBindingDispatcher.d.ts +150 -0
- package/types/src/command/LayerActivation.d.ts +45 -0
- package/types/src/command/Types.d.ts +80 -0
- package/types/src/command/createResolvedCommand.d.ts +91 -0
- package/types/src/command/index.d.ts +26 -0
- package/types/src/command/reduceDefinitions.d.ts +33 -0
- package/types/src/command/useCommands.d.ts +22 -0
- package/types/src/command/useContributeCommands.d.ts +18 -0
- package/types/src/components/FocusKeyNavigation.d.ts +22 -0
- package/types/src/components/ITooltip.d.ts +38 -0
- package/types/src/components/RoundedTab.d.ts +26 -0
- package/types/src/components/index.d.ts +4 -0
- package/types/src/error/ErrorPanel.d.ts +14 -0
- package/types/src/error/ReactErrorBoundary.d.ts +7 -0
- package/types/src/error/UncaughtErrorBoundary.d.ts +5 -0
- package/types/src/error/index.d.ts +4 -0
- package/types/src/float/FloatPanel.d.ts +57 -0
- package/types/src/float/FloatPopper.d.ts +85 -0
- package/types/src/float/FloatPopup.d.ts +19 -0
- package/types/src/float/FloatProvider.d.ts +60 -0
- package/types/src/float/FloatStackContext.d.ts +25 -0
- package/types/src/float/FloatTooltip.d.ts +22 -0
- package/types/src/float/FloatUtils.d.ts +55 -0
- package/types/src/float/_FloatUtils.d.ts +51 -0
- package/types/src/float/index.d.ts +9 -0
- package/types/src/float/useFloatStack.d.ts +92 -0
- package/types/src/hooks/LanguageState.d.ts +15 -0
- package/types/src/hooks/index.d.ts +19 -0
- package/types/src/hooks/useBoundSyncExternalStore.d.ts +23 -0
- package/types/src/hooks/useCallbackRef.d.ts +11 -0
- package/types/src/hooks/useDevicePixelRatio.d.ts +37 -0
- package/types/src/hooks/useEditMode.d.ts +66 -0
- package/types/src/hooks/useGlobalClipboard.d.ts +7 -0
- package/types/src/hooks/useId.d.ts +9 -0
- package/types/src/hooks/useImperativeElement.d.ts +3 -0
- package/types/src/hooks/useLanguage.d.ts +13 -0
- package/types/src/hooks/useMouseDownAndHoldListener.d.ts +13 -0
- package/types/src/hooks/useNotifier.d.ts +330 -0
- package/types/src/hooks/useOnClickOrFocusAway.d.ts +8 -0
- package/types/src/hooks/useOptionalBoundSyncExternalStore.d.ts +20 -0
- package/types/src/hooks/useOptionalSyncExternalStore.d.ts +18 -0
- package/types/src/hooks/useSynchronizedPointerHandler.d.ts +54 -0
- package/types/src/hooks/useTextareaCaretRect.d.ts +85 -0
- package/types/src/hooks/useTraceUpdate.d.ts +2 -0
- package/types/src/hooks/useTranslator.d.ts +32 -0
- package/types/src/icons/DynamicIcon.d.ts +17 -0
- package/types/src/icons/DynamicIconService.d.ts +39 -0
- package/types/src/icons/ErrorIcon.d.ts +6 -0
- package/types/src/icons/Types.d.ts +81 -0
- package/types/src/icons/WalkingIcon.d.ts +27 -0
- package/types/src/icons/_Utils.d.ts +3 -0
- package/types/src/icons/index.d.ts +5 -0
- package/types/src/icons/packs/Base.d.ts +4 -0
- package/types/src/icons/packs/Conditional.d.ts +4 -0
- package/types/src/index.d.ts +18 -0
- package/types/src/loading/LoadingPanel.d.ts +31 -0
- package/types/src/loading/index.d.ts +2 -0
- package/types/src/persistence/InMemoryStore.d.ts +12 -0
- package/types/src/persistence/LocalStorageStore.d.ts +15 -0
- package/types/src/persistence/PersistenceStateProvider.d.ts +3 -0
- package/types/src/persistence/Types.d.ts +95 -0
- package/types/src/persistence/_Context.d.ts +9 -0
- package/types/src/persistence/index.d.ts +6 -0
- package/types/src/persistence/usePersistenceState.d.ts +33 -0
- package/types/src/react-resizable/Resizable.d.ts +30 -0
- package/types/src/react-resizable/ResizableBox.d.ts +18 -0
- package/types/src/react-resizable/index.d.ts +11 -0
- package/types/src/react-resizable/propTypes.d.ts +56 -0
- package/types/src/react-resizable/utils.d.ts +3 -0
- package/types/src/scroll/AxisViewport.d.ts +73 -0
- package/types/src/scroll/IScrollPane.d.ts +63 -0
- package/types/src/scroll/IScrollbar.d.ts +94 -0
- package/types/src/scroll/NativeScrollbar.d.ts +7 -0
- package/types/src/scroll/ScrollButton.d.ts +29 -0
- package/types/src/scroll/ScrollPane.d.ts +4 -0
- package/types/src/scroll/Scrollbar.d.ts +4 -0
- package/types/src/scroll/TouchThumbContext.d.ts +93 -0
- package/types/src/scroll/TouchThumbHandle.d.ts +64 -0
- package/types/src/scroll/TrackDrag.d.ts +107 -0
- package/types/src/scroll/Utils.d.ts +8 -0
- package/types/src/scroll/Viewport.d.ts +285 -0
- package/types/src/scroll/VirtualScrollbar.d.ts +49 -0
- package/types/src/scroll/index.d.ts +14 -0
- package/types/src/scroll/scrollbarTheming.d.ts +27 -0
- package/types/src/scroll/useWheelScroll.d.ts +27 -0
- package/types/src/scroller/Scroller.d.ts +260 -0
- package/types/src/scroller/animate.d.ts +30 -0
- package/types/src/scroller/index.d.ts +2 -0
- package/types/src/singletonHook/components/SingleItemContainer.d.ts +6 -0
- package/types/src/singletonHook/components/SingletonHooksContainer.d.ts +7 -0
- package/types/src/singletonHook/index.d.ts +11 -0
- package/types/src/singletonHook/singletonHook.d.ts +6 -0
- package/types/src/singletonHook/utils/env.d.ts +4 -0
- package/types/src/singletonHook/utils/env.native.d.ts +1 -0
- package/types/src/singletonHook/utils/warning.d.ts +2 -0
- package/types/src/splitPane/SplitPane.d.ts +91 -0
- package/types/src/splitPane/SplitPaneResizer.d.ts +11 -0
- package/types/src/splitPane/index.d.ts +3 -0
- package/types/src/theme/TokenTheme.d.ts +196 -0
- package/types/src/theme/TokenThemeProvider.d.ts +97 -0
- package/types/src/theme/buildThemeCSS.d.ts +54 -0
- package/types/src/theme/createThemeVars.d.ts +15 -0
- package/types/src/theme/defaultTheme.d.ts +15 -0
- package/types/src/theme/index.d.ts +9 -0
- package/types/src/theme/resolveTokens.d.ts +21 -0
- package/types/src/theme/themeAttrs.d.ts +32 -0
- package/types/src/theme/useResolvedThemeMode.d.ts +17 -0
- package/types/src/types/Types.d.ts +71 -0
- package/types/src/types/index.d.ts +2 -0
- package/types/src/utils/FullScreenPortal.d.ts +6 -0
- package/types/src/utils/PinchZoom.d.ts +3 -0
- package/types/src/utils/ReactUtils.d.ts +134 -0
- package/types/src/utils/index.d.ts +4 -0
- package/types/src/utils/useFullScreen.d.ts +47 -0
- package/browser/cjs/DJJQOl0dYYJgXfru.cjs +0 -6
- package/browser/esm/Bh0xih0ZamA4MXkt.mjs +0 -12
- package/node/assets/style.css +0 -1
- package/node/esm/DdwriRgF582bPBWP.mjs +0 -12
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FloatPopupPanelProps } from './FloatPopup';
|
|
3
|
+
import { FloatPanelProps } from './FloatPanel';
|
|
4
|
+
import { FloatPopperProps } from './FloatPopper';
|
|
5
|
+
/**
|
|
6
|
+
* Renders the floating panel for an open float.
|
|
7
|
+
*/
|
|
8
|
+
export type RenderFloatPanel = (props: FloatPanelProps) => React.ReactElement;
|
|
9
|
+
export interface FloatStackOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Whether the panel grabs focus when it opens. @defaultValue `true` (menus / dialogs / anything the
|
|
12
|
+
* user tabs through). Pass `false` for a **passive** popup — a tooltip or function/argument hint that
|
|
13
|
+
* must not steal focus from the field being typed in.
|
|
14
|
+
*/
|
|
15
|
+
autoFocus?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Suppress the light-dismiss (close on outside mousedown / touch / focus). @defaultValue `false`.
|
|
18
|
+
* - `true` — never light-dismiss; the caller drives visibility entirely (via `open`/`close`).
|
|
19
|
+
* - a **predicate** `(target) => boolean` — light-dismiss normally, EXCEPT when it returns `true` for the
|
|
20
|
+
* event target, which is then treated as "on the float" (no close). Use this to extend "not away" beyond
|
|
21
|
+
* the float + anchor — e.g. a caret-following formula hint keeps the click-away, but exempts clicks back
|
|
22
|
+
* into the editor it annotates (which the portaled float doesn't contain), so those don't close it.
|
|
23
|
+
*/
|
|
24
|
+
disableClickAway?: boolean | ((target: EventTarget | null) => boolean);
|
|
25
|
+
anchor?: React.ReactElement | any;
|
|
26
|
+
label?: string;
|
|
27
|
+
/**
|
|
28
|
+
* If nesting float stacks are being used pass this from parent
|
|
29
|
+
*/
|
|
30
|
+
parentFloat?: FloatReference;
|
|
31
|
+
onOpen?: () => void;
|
|
32
|
+
onClose?: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* If this returns `null` then will create a registered movable stacking.
|
|
35
|
+
* This is done for toolbars and other permanent visible components that are integrated into the movable stack.
|
|
36
|
+
*/
|
|
37
|
+
createPopupPanel?: (props: FloatPopupPanelProps) => any;
|
|
38
|
+
/**
|
|
39
|
+
* Passed to the underlying popup panel. `children` is excluded — content comes
|
|
40
|
+
* from `createPopupPanel`, and this keeps the option compatible with richer
|
|
41
|
+
* surface popper types (e.g. MUI's render-prop `children`).
|
|
42
|
+
*/
|
|
43
|
+
propsPopper?: Partial<Omit<FloatPopperProps, 'children' | 'ref'>>;
|
|
44
|
+
/**
|
|
45
|
+
* Render the floating panel surface. Defaults to {@link FloatPanel}.
|
|
46
|
+
* Provide this to inject a custom surface (e.g. a themed card).
|
|
47
|
+
*/
|
|
48
|
+
renderFloatPanel?: RenderFloatPanel;
|
|
49
|
+
}
|
|
50
|
+
export interface FloatReferenceKey {
|
|
51
|
+
label: string | null;
|
|
52
|
+
}
|
|
53
|
+
export interface FloatReference {
|
|
54
|
+
key: FloatReferenceKey;
|
|
55
|
+
isRoot: boolean;
|
|
56
|
+
parent: FloatReference | null;
|
|
57
|
+
open(delay?: number): void;
|
|
58
|
+
close: (delay?: number) => Promise<void> | null;
|
|
59
|
+
closeChild: (delay?: number) => Promise<void> | null;
|
|
60
|
+
onChildVisible: () => void;
|
|
61
|
+
onChildHidden: () => void;
|
|
62
|
+
closeAll: () => Promise<void> | null;
|
|
63
|
+
/** The root of this float's tree. */
|
|
64
|
+
getRoot: () => FloatReference;
|
|
65
|
+
floatElement: () => HTMLElement | null;
|
|
66
|
+
anchorElement: () => HTMLElement | any;
|
|
67
|
+
}
|
|
68
|
+
export interface FloatStack {
|
|
69
|
+
/**
|
|
70
|
+
* Float component to be injected
|
|
71
|
+
*/
|
|
72
|
+
component: React.ReactNode;
|
|
73
|
+
reference: FloatReference;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the float is currently open (reactive — re-renders the caller as it flips). Lets a caller that
|
|
76
|
+
* drives the float imperatively reconcile against its actual state — e.g. re-`open()` on a click only when
|
|
77
|
+
* it isn't already open, after a light-dismiss (click-away / Esc) closed it.
|
|
78
|
+
*/
|
|
79
|
+
isOpen: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* useFloatStack
|
|
83
|
+
*
|
|
84
|
+
* Keeps a list of stacked movable components. This acts like within but outside of the containment
|
|
85
|
+
* hierarchy.
|
|
86
|
+
*
|
|
87
|
+
* TODO - abstract out clickAway perhaps with a useFloatStack context
|
|
88
|
+
* TODO - abstract out FloatPanel factory into the same provider
|
|
89
|
+
*
|
|
90
|
+
*/
|
|
91
|
+
export declare const useFloatStack: (props?: FloatStackOptions) => FloatStack;
|
|
92
|
+
//# sourceMappingURL=useFloatStack.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistence key for the user's UI-language preference.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Owned via `usePersistenceState` against the surrounding `PersistenceStateProvider` (Studio, or a
|
|
6
|
+
* standalone host) — the mirror of `ThemeStateKey` in `@sheetxl/react`. A host that wants to read
|
|
7
|
+
* or seed it (e.g. the VS Code extension, whose store bridges to the extension host's state) does
|
|
8
|
+
* so with the same key, or by supplying its own provider/store. The value is a BCP 47 tag; absent
|
|
9
|
+
* means "no preference" and the pack service default stands.
|
|
10
|
+
*/
|
|
11
|
+
export declare const LanguageStateKey: {
|
|
12
|
+
/** The user's UI-language override (`null` = no preference). */
|
|
13
|
+
readonly Active: "language";
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=LanguageState.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from './useNotifier';
|
|
2
|
+
export * from './useCallbackRef';
|
|
3
|
+
export * from './useOptionalSyncExternalStore';
|
|
4
|
+
export * from './useBoundSyncExternalStore';
|
|
5
|
+
export * from './useOptionalBoundSyncExternalStore';
|
|
6
|
+
export * from './useDevicePixelRatio';
|
|
7
|
+
export * from './useOnClickOrFocusAway';
|
|
8
|
+
export * from './useMouseDownAndHoldListener';
|
|
9
|
+
export * from './useSynchronizedPointerHandler';
|
|
10
|
+
export * from './useEditMode';
|
|
11
|
+
export * from './LanguageState';
|
|
12
|
+
export * from './useLanguage';
|
|
13
|
+
export * from './useTranslator';
|
|
14
|
+
export * from './useTextareaCaretRect';
|
|
15
|
+
export * from './useGlobalClipboard';
|
|
16
|
+
export * from './useTraceUpdate';
|
|
17
|
+
export * from './useId';
|
|
18
|
+
export * from './useImperativeElement';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Like {@link useSyncExternalStore}, but for a store exposed as an **object with methods** rather than
|
|
3
|
+
* standalone functions. It calls `store.subscribe(...)` and the snapshot selector **on the instance**,
|
|
4
|
+
* so a normal `this`-centric class — whose methods are NOT pre-bound — works without the caller
|
|
5
|
+
* detaching its methods (which would strip `this`). The model stays a plain class; the one adaptation
|
|
6
|
+
* into `useSyncExternalStore`'s function-value contract lives here.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Pass the store instance and a selector that reads the snapshot off it (`s => s.getSelection()`).
|
|
10
|
+
* `subscribe` is memoized on the store identity so it stays a stable reference across renders (a
|
|
11
|
+
* changed `subscribe` would resubscribe); the snapshot selector may be an inline arrow. The selector
|
|
12
|
+
* doubles as the SSR snapshot.
|
|
13
|
+
*
|
|
14
|
+
* Contrast {@link useOptionalSyncExternalStore}, which takes pre-bound standalone functions and
|
|
15
|
+
* tolerates an absent (`null`) store.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam S - The store type; must expose a `subscribe(listener)` method.
|
|
18
|
+
* @typeParam T - The snapshot value type.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useBoundSyncExternalStore<S extends {
|
|
21
|
+
subscribe(onStoreChange: () => void): () => void;
|
|
22
|
+
}, T>(store: S, getSnapshot: (store: S) => T): T;
|
|
23
|
+
//# sourceMappingURL=useBoundSyncExternalStore.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DependencyList } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* This is a callback hook that is similar to useCallback except in
|
|
4
|
+
* one important way. When it's dependencies change it does
|
|
5
|
+
* NOT update the callback handler itself. Useful
|
|
6
|
+
* in the instance where you want to pass a callback and
|
|
7
|
+
* want to avoid have stale values do to closure but don't
|
|
8
|
+
* want a re-render to occur.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useCallbackRef: <T extends (...args: any[]) => any>(callback: T | null | undefined, deps: DependencyList) => T;
|
|
11
|
+
//# sourceMappingURL=useCallbackRef.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface DevicePixelRatioOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Default DPR to use if browser does not support the `devicePixelRatio`
|
|
4
|
+
* property, or when rendering on server
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue `1`
|
|
7
|
+
*/
|
|
8
|
+
defaultDpr?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Whether or not to round the number down to the closest integer
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue `true`
|
|
13
|
+
*/
|
|
14
|
+
round?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum DPR to return (set to `2` to only generate 1 and 2)
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue `3`
|
|
19
|
+
*/
|
|
20
|
+
maxDpr?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the device pixel ratio, potentially rounded and capped.
|
|
24
|
+
* Will emit new values if it changes.
|
|
25
|
+
*
|
|
26
|
+
* @param options
|
|
27
|
+
* @returns The current device pixel ratio, or the default if none can be resolved
|
|
28
|
+
*/
|
|
29
|
+
export declare function useDevicePixelRatio(options?: DevicePixelRatioOptions): number;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the current device pixel ratio (DPR) given the passed options
|
|
32
|
+
*
|
|
33
|
+
* @param options
|
|
34
|
+
* @returns current device pixel ratio
|
|
35
|
+
*/
|
|
36
|
+
export declare function getDevicePixelRatio(options?: DevicePixelRatioOptions): number;
|
|
37
|
+
//# sourceMappingURL=useDevicePixelRatio.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { EditModeHandler, SetEditMode } from '@sheetxl/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Publish (or clear) the active {@link EditMode} on the app-wide bus **without a hook** — the same
|
|
4
|
+
* write {@link useEditMode}'s `setMode` performs (fires the superseded mode's
|
|
5
|
+
* {@link EditMode.onModeChange}), callable from plain (non-React) code.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Exists so a non-component owner — e.g. the cell {@link IEditable} publishing its active session —
|
|
9
|
+
* can drive the bus from anywhere, not only where a hook happens to be mounted. Reads (and the React
|
|
10
|
+
* subscription) still go through {@link useEditMode}; this is write-only. Requires the bus singleton
|
|
11
|
+
* to be mounted (a `SingletonHooksContainer` in the tree), exactly like the hook.
|
|
12
|
+
*/
|
|
13
|
+
export declare const setEditMode: SetEditMode;
|
|
14
|
+
/**
|
|
15
|
+
* Access the application's **edit-mode bus** — the single, app-wide signal describing the
|
|
16
|
+
* interaction currently in effect.
|
|
17
|
+
*
|
|
18
|
+
* @returns An {@link EditModeHandler} exposing `getMode()` and `setMode()`.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* At any moment the application is in exactly one interaction mode, or none (idle). The bus holds a
|
|
22
|
+
* single {@link EditMode} (`{ key, description?, args?, cursor?, onModeChange? }`), and every part of
|
|
23
|
+
* the app reads from and writes to that one value.
|
|
24
|
+
*
|
|
25
|
+
* It exists so unrelated features can coordinate **without depending on one another**. A feature
|
|
26
|
+
* announces that its interaction has started by publishing a mode, and clears it when finished;
|
|
27
|
+
* other features react to the change. The bus is the decoupling layer between them.
|
|
28
|
+
*
|
|
29
|
+
* Typical **publishers** (set a mode while their interaction is active):
|
|
30
|
+
* - cell editing — a single `key: 'edit'`, exposing the live editor handle (`IEditable`) via
|
|
31
|
+
* {@link EditMode.args}`.editable`. The fine-grained enter-vs-edit distinction lives on that
|
|
32
|
+
* handle's session, not on the bus key (the status-bar label is carried in
|
|
33
|
+
* {@link EditMode.description}, refreshed by the publisher when it flips);
|
|
34
|
+
* - the copy / cut marquee — `key: 'copy'` / `'cut'`;
|
|
35
|
+
* - fill and drag-move/copy gestures — `key: 'fill'` / `'drag…'`, with a {@link EditMode.cursor};
|
|
36
|
+
* - the format painter.
|
|
37
|
+
*
|
|
38
|
+
* Typical **consumers** (read the active mode):
|
|
39
|
+
* - the status bar, which shows {@link EditMode.description} (and its idle label when there is none);
|
|
40
|
+
* - the grid, which applies {@link EditMode.cursor};
|
|
41
|
+
* - features that must defer to another interaction — e.g. fill is suppressed while a cell is being
|
|
42
|
+
* edited — by inspecting the active {@link EditMode.key}.
|
|
43
|
+
*
|
|
44
|
+
* Publishing a mode **replaces** the previous one and invokes its {@link EditMode.onModeChange}, so a
|
|
45
|
+
* mode can clean up when it is superseded (for instance, starting an edit supersedes a copy marquee,
|
|
46
|
+
* which then clears the clipboard).
|
|
47
|
+
*
|
|
48
|
+
* The bus is a singleton — one instance per application, reachable from anywhere without
|
|
49
|
+
* prop-threading. It is backed by `singletonHook`, so a `SingletonHooksContainer` must be mounted in
|
|
50
|
+
* the tree.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const editMode = useEditMode();
|
|
55
|
+
*
|
|
56
|
+
* // Publish a mode while an interaction is active, then clear it when done.
|
|
57
|
+
* editMode.setMode({ key: 'fill', description: 'Drag to fill', cursor: 'crosshair' });
|
|
58
|
+
* editMode.setMode(null);
|
|
59
|
+
*
|
|
60
|
+
* // React to the active mode.
|
|
61
|
+
* const mode = editMode.getMode();
|
|
62
|
+
* const isEditing = mode?.key === 'edit';
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare const useEditMode: () => EditModeHandler;
|
|
66
|
+
//# sourceMappingURL=useEditMode.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The app-wide clipboard singleton. Exposes the active {@link ReferenceableClipboard} (defaulting to
|
|
3
|
+
* `InternalClipboard.Global`) and the native copy/keystroke refs. Consumed by the clipboard
|
|
4
|
+
* contributor (copy writes references here; paste reads them) and the marching-ants view.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useGlobalClipboard: any;
|
|
7
|
+
//# sourceMappingURL=useGlobalClipboard.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uses React 18's built-in `useId()` when available, or falls back to a
|
|
3
|
+
* slightly less performant (requiring a double render) implementation for
|
|
4
|
+
* earlier React versions.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://movable-ui.com/docs/useId}
|
|
7
|
+
*/
|
|
8
|
+
export declare const useId: any;
|
|
9
|
+
//# sourceMappingURL=useId.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DependencyList } from 'react';
|
|
2
|
+
export declare function useImperativeElement<R extends T, A = any, T = HTMLElement & A>(refForwarded: React.Ref<R>, attributeFn?: () => Partial<A>, deps?: DependencyList): React.RefObject<R>;
|
|
3
|
+
//# sourceMappingURL=useImperativeElement.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LanguageTag } from '@sheetxl/utils';
|
|
2
|
+
/**
|
|
3
|
+
* The active UI language (BCP-47 tag), as a subscription — the component re-renders on a
|
|
4
|
+
* language switch.
|
|
5
|
+
*
|
|
6
|
+
* Use this when you need the **tag itself** (an `Intl` formatter, `<html lang>`, a locale-keyed
|
|
7
|
+
* asset). For call-site (`t()`) strings use {@link useTranslator} instead: calling this hook for
|
|
8
|
+
* its subscription alone and discarding the tag is the pattern that made a missed subscription
|
|
9
|
+
* invisible (see `useTranslator`'s note). Command surfaces re-render through resolution
|
|
10
|
+
* (`useCommands` re-emits) and need neither hook.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useLanguage(): LanguageTag;
|
|
13
|
+
//# sourceMappingURL=useLanguage.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface RepeatClickOptions {
|
|
3
|
+
timerInitial?: number;
|
|
4
|
+
timerContinuous?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Simple hook that calls onMouseDown at intervals until mouse is up.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Fires the original mouse down event so preventDefault should be ignored or treated accordingly.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useMouseDownAndHoldListener(onPointerDown: (event: React.PointerEvent<Element>) => boolean | void, options?: RepeatClickOptions): (event: React.PointerEvent<Element>) => void;
|
|
13
|
+
//# sourceMappingURL=useMouseDownAndHoldListener.d.ts.map
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DefaultNotifier, NotifierOptions, INotifier } from '@sheetxl/utils';
|
|
3
|
+
/**
|
|
4
|
+
* Indicates the type of notification.
|
|
5
|
+
*/
|
|
6
|
+
export declare const NotifierType: {
|
|
7
|
+
readonly Default: "default";
|
|
8
|
+
readonly Error: "error";
|
|
9
|
+
readonly Success: "success";
|
|
10
|
+
readonly Warning: "warning";
|
|
11
|
+
readonly Info: "info";
|
|
12
|
+
};
|
|
13
|
+
export type NotifierType = typeof NotifierType[keyof typeof NotifierType];
|
|
14
|
+
/**
|
|
15
|
+
* Configuration for non-blocking notifications.
|
|
16
|
+
*/
|
|
17
|
+
export interface EnqueueNotifierOptions extends NotifierOptions {
|
|
18
|
+
/**
|
|
19
|
+
* A hint for decorations of the message.
|
|
20
|
+
*/
|
|
21
|
+
type?: NotifierType;
|
|
22
|
+
/**
|
|
23
|
+
* Passed directly to the Snackbar component.
|
|
24
|
+
*/
|
|
25
|
+
enqueueProps?: Record<string, any>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One button in an options / input dialog. A bare `string` is shorthand for `{ label: string }` whose
|
|
29
|
+
* identity is that same string (back-compat).
|
|
30
|
+
*
|
|
31
|
+
* Identity and display are deliberately separate: `label` is what the user SEES — and may be a thunk so
|
|
32
|
+
* a language change while the dialog is open re-localizes it — while `id` is the language-free value the
|
|
33
|
+
* caller COMPARES (`results.option === 'insert'`) and never varies. Whether a button is the default
|
|
34
|
+
* (Enter) or the cancel (Esc) is NOT part of the option: that is contextual to the dialog and set by
|
|
35
|
+
* {@link ShowOptionsOptions.defaultOption} / {@link ShowOptionsOptions.cancelOption}.
|
|
36
|
+
*/
|
|
37
|
+
export interface InputOption {
|
|
38
|
+
/** Button label. A thunk resolves at render, so a mid-dialog language change re-localizes it. */
|
|
39
|
+
label: string | (() => string);
|
|
40
|
+
/**
|
|
41
|
+
* Stable, language-free identity returned as {@link InputResults.option} and compared by callers.
|
|
42
|
+
* Omit for a display-only button — then the option's own identity is returned (the `string` form, or
|
|
43
|
+
* this object by reference). NOT a thunk: an identity must not vary by language.
|
|
44
|
+
*/
|
|
45
|
+
id?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Refuses the option outright: the button renders disabled, and Enter does not activate it as the
|
|
48
|
+
* default. A thunk resolves at render, so a dialog can gate its action on live editor state.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* This is for an action that is not OFFERED — a form the user has not made valid yet. It is not
|
|
52
|
+
* {@link ShowOptionsOptions.onValidateOption}, which lets the click through and then refuses to
|
|
53
|
+
* close; use that when the reason only emerges from the attempt (a rejected password).
|
|
54
|
+
*/
|
|
55
|
+
disabled?: boolean | (() => boolean);
|
|
56
|
+
/** Per-option custom button render (replaces the former dialog-level `createOptionsButton`). */
|
|
57
|
+
renderButton?: (props: React.HTMLAttributes<HTMLButtonElement> & React.Attributes, isDefaultOption: boolean) => React.ReactNode;
|
|
58
|
+
}
|
|
59
|
+
/** A dialog option: a plain label/identity `string`, or a rich {@link InputOption}. */
|
|
60
|
+
export type OptionInput = string | InputOption;
|
|
61
|
+
/**
|
|
62
|
+
* Configuration for an options dialog.
|
|
63
|
+
*/
|
|
64
|
+
export interface ShowOptionsOptions<T = any, C = any> extends ShowWindowOptions<T, C> {
|
|
65
|
+
/**
|
|
66
|
+
* The dialog buttons: plain identity strings or rich {@link InputOption}s (mixable).
|
|
67
|
+
*/
|
|
68
|
+
options?: OptionInput[];
|
|
69
|
+
/**
|
|
70
|
+
* The title of the options panel
|
|
71
|
+
*/
|
|
72
|
+
title?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Display text information for the user to make a decision.
|
|
75
|
+
*/
|
|
76
|
+
description?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Display an icon next to the description for additional context
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* Not yet implemented
|
|
82
|
+
*/
|
|
83
|
+
icon?: React.ReactNode | string;
|
|
84
|
+
/**
|
|
85
|
+
* The option that is the default (Enter key), matched against the {@link options} by identity
|
|
86
|
+
* (a `string` matches an option's id/string form, an {@link InputOption} matches by reference).
|
|
87
|
+
* @defaultValue The first option
|
|
88
|
+
*/
|
|
89
|
+
defaultOption?: OptionInput;
|
|
90
|
+
/**
|
|
91
|
+
* The cancel option (Esc key), matched against the {@link options} by identity. Gets special styling.
|
|
92
|
+
* @defaultValue 'Cancel'
|
|
93
|
+
*/
|
|
94
|
+
cancelOption?: OptionInput;
|
|
95
|
+
/**
|
|
96
|
+
* Call when an option is selected. `option` is the selected option's IDENTITY (its `id` if provided,
|
|
97
|
+
* else the `string` form, else the {@link InputOption} object).
|
|
98
|
+
* @remarks
|
|
99
|
+
* It is possible that the option can be both a cancel and a default option.
|
|
100
|
+
*/
|
|
101
|
+
onOption?: (option: OptionInput, isCancel: boolean, isDefault: boolean) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Call when an option is selected. If false is returned, the dialog will not close. INotifier is not
|
|
104
|
+
* provided but can be supplied via the textFieldProps helperText property. `option` is the selected
|
|
105
|
+
* option's identity (see {@link onOption}).
|
|
106
|
+
*/
|
|
107
|
+
onValidateOption?: (option?: OptionInput) => boolean | Promise<boolean>;
|
|
108
|
+
}
|
|
109
|
+
export interface FocusWindowOptions extends FocusOptions {
|
|
110
|
+
/**
|
|
111
|
+
* Allows for a specific component to be selected.
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* If a string is provided this will be used as a querySelector to find the initial focusable component.
|
|
115
|
+
*/
|
|
116
|
+
selection?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface ShowWindowOptions<T = any, C = any> {
|
|
119
|
+
/**
|
|
120
|
+
* A value the window can use to display.
|
|
121
|
+
*/
|
|
122
|
+
initialValue?: T;
|
|
123
|
+
context?: () => C;
|
|
124
|
+
/**
|
|
125
|
+
* Query selector for the element to focus on show.
|
|
126
|
+
*/
|
|
127
|
+
autoFocus?: boolean | string | FocusWindowOptions;
|
|
128
|
+
/**
|
|
129
|
+
* Allow for tracking of key down events.
|
|
130
|
+
*
|
|
131
|
+
* @param e
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
134
|
+
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
135
|
+
/**
|
|
136
|
+
* If true show a backdrop.
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* Our movable menu achieves modality without a background by listens to global clicks (and focus)
|
|
140
|
+
* @defaultValue false
|
|
141
|
+
*/
|
|
142
|
+
isModal?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* If true the window will not be automatically destroyed when closed.
|
|
145
|
+
*/
|
|
146
|
+
disableAutoDestroy?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Mount the window hidden (do not reveal it) so a later real open is an instant reuse. Implies
|
|
149
|
+
* {@link disableAutoDestroy} (a prewarmed window must be kept alive). Use at idle to move the
|
|
150
|
+
* heavy first-mount cost off the user's open. A no-op if an instance already exists.
|
|
151
|
+
* @defaultValue false
|
|
152
|
+
*/
|
|
153
|
+
prewarm?: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface InputValidationResults {
|
|
156
|
+
valid: boolean;
|
|
157
|
+
message?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface InputResults {
|
|
160
|
+
input: string;
|
|
161
|
+
/** The selected option's identity (its `id` if provided, else the `string`, else the {@link InputOption}). */
|
|
162
|
+
option: OptionInput;
|
|
163
|
+
}
|
|
164
|
+
export interface ShowInputOptions<T = string, C = any> extends ShowOptionsOptions<T, C> {
|
|
165
|
+
/**
|
|
166
|
+
* Css style for input
|
|
167
|
+
*/
|
|
168
|
+
propsInput?: React.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement>;
|
|
169
|
+
inputLabel?: string;
|
|
170
|
+
inputType?: 'text' | 'password' | 'email' | 'number' | 'search' | 'tel' | 'url';
|
|
171
|
+
inputPlaceHolder?: string;
|
|
172
|
+
onInput?: (input?: T, option?: OptionInput) => void | Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Validates the current input. Returning `{ valid: false }` keeps the dialog **open** and shows
|
|
175
|
+
* `message` under the field.
|
|
176
|
+
*
|
|
177
|
+
* @remarks
|
|
178
|
+
* Called in two situations, told apart by `option`:
|
|
179
|
+
* - **`option` is `undefined`** — the user typed. Fires on every keystroke, so this path must stay
|
|
180
|
+
* cheap (a format/duplicate-name check).
|
|
181
|
+
* - **`option` is set** — the user submitted. This is where expensive work belongs (a network
|
|
182
|
+
* round-trip, a password derivation); it is awaited, and the activated button shows a spinner
|
|
183
|
+
* while it runs.
|
|
184
|
+
*
|
|
185
|
+
* An expensive validator MUST therefore branch on `option` — otherwise it runs once per keystroke.
|
|
186
|
+
*/
|
|
187
|
+
onValidateInput?: (input?: T, option?: OptionInput) => InputValidationResults | Promise<InputValidationResults>;
|
|
188
|
+
}
|
|
189
|
+
export interface ShowBusyOptions {
|
|
190
|
+
icon?: React.ReactNode;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The handle returned by {@link IReactNotifier.showBusy}.
|
|
194
|
+
*
|
|
195
|
+
* @remarks
|
|
196
|
+
* It is callable — calling it dismisses the busy indicator (the historical `hideBusy()` contract) —
|
|
197
|
+
* and also carries methods to update the indicator while it is showing. This keeps every existing
|
|
198
|
+
* `const hideBusy = await showBusy(...); hideBusy();` call working unchanged.
|
|
199
|
+
*/
|
|
200
|
+
export interface BusyHandle {
|
|
201
|
+
/**
|
|
202
|
+
* Dismiss the busy indicator.
|
|
203
|
+
*/
|
|
204
|
+
(): void;
|
|
205
|
+
/**
|
|
206
|
+
* Update the indicator to a determinate state. When `total` is known the indicator shows a
|
|
207
|
+
* percentage / progress bar; passing `total` as `undefined` (or `completed` as `undefined`)
|
|
208
|
+
* returns it to the indeterminate (spinner) state.
|
|
209
|
+
*
|
|
210
|
+
* @param completed The cumulative work done so far.
|
|
211
|
+
* @param total The total work, in the same units as `completed`.
|
|
212
|
+
*/
|
|
213
|
+
setProgress(completed?: number, total?: number): void;
|
|
214
|
+
/**
|
|
215
|
+
* Update the message shown beside the indicator.
|
|
216
|
+
*/
|
|
217
|
+
setMessage(message: string | React.ReactNode): void;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Builds a {@link BusyHandle} from a dismiss function (and optional updaters). Used to wrap the
|
|
221
|
+
* plain `hideBusy` callbacks that providers produce, and to supply inert no-op handles where no
|
|
222
|
+
* provider is present.
|
|
223
|
+
*/
|
|
224
|
+
export declare function createBusyHandle(dismiss?: () => void, setProgress?: (completed?: number, total?: number) => void, setMessage?: (message: string | React.ReactNode) => void): BusyHandle;
|
|
225
|
+
/**
|
|
226
|
+
* An inert {@link BusyHandle} whose methods do nothing. Returned when no busy provider is available.
|
|
227
|
+
*/
|
|
228
|
+
export declare function createNoopBusyHandle(): BusyHandle;
|
|
229
|
+
/**
|
|
230
|
+
* Interface that provides popups for the user.
|
|
231
|
+
*/
|
|
232
|
+
export interface IReactNotifier extends INotifier {
|
|
233
|
+
/**
|
|
234
|
+
* Useful when informing the user of something but are not expecting a response.
|
|
235
|
+
*/
|
|
236
|
+
showMessage: (message: string | React.ReactNode, options?: EnqueueNotifierOptions) => void;
|
|
237
|
+
/**
|
|
238
|
+
* Should return error object exception.
|
|
239
|
+
*
|
|
240
|
+
* @param error The error to show
|
|
241
|
+
*/
|
|
242
|
+
showError: (error: Error | string) => void;
|
|
243
|
+
/**
|
|
244
|
+
* Useful when performing a long running operation and you want to inform the user.
|
|
245
|
+
*
|
|
246
|
+
* Returns a {@link BusyHandle}: call it to dismiss the indicator, or use its `setProgress` /
|
|
247
|
+
* `setMessage` methods to update it while it shows. If multiple calls are made the consumer should
|
|
248
|
+
* continue to indicate blocked until all handles have been dismissed.
|
|
249
|
+
*/
|
|
250
|
+
showBusy: (message: string | React.ReactNode, options?: ShowBusyOptions) => (Promise<BusyHandle>) | BusyHandle;
|
|
251
|
+
/**
|
|
252
|
+
* Show a dialog for a given type.
|
|
253
|
+
*
|
|
254
|
+
* @param type
|
|
255
|
+
* @param options
|
|
256
|
+
*/
|
|
257
|
+
showWindow: (type: string, options?: ShowWindowOptions) => Promise<HTMLElement>;
|
|
258
|
+
/**
|
|
259
|
+
* Provide a user with a list of options to choose from.
|
|
260
|
+
* @param options
|
|
261
|
+
*/
|
|
262
|
+
showOptions: (options: ShowOptionsOptions) => Promise<OptionInput>;
|
|
263
|
+
/**
|
|
264
|
+
* Provider a user with a way to enter a text input.
|
|
265
|
+
* @param options
|
|
266
|
+
*/
|
|
267
|
+
showInput: (options: ShowInputOptions) => Promise<InputResults>;
|
|
268
|
+
}
|
|
269
|
+
export declare class DefaultReactNotifier extends DefaultNotifier implements IReactNotifier {
|
|
270
|
+
/** @inheritdoc IReactNotifier.setOverrides */
|
|
271
|
+
setOverrides(overrides: Partial<IReactNotifier> | null): void;
|
|
272
|
+
/** @inheritdoc IReactNotifier.getDelegate */
|
|
273
|
+
getDelegate(): Partial<IReactNotifier> | null;
|
|
274
|
+
/** @inheritdoc IReactNotifier.showMessage */
|
|
275
|
+
showMessage(message: string | React.ReactNode, options?: EnqueueNotifierOptions): void;
|
|
276
|
+
/** @inheritdoc IReactNotifier.showBusy */
|
|
277
|
+
showBusy(message: string | React.ReactNode, options?: ShowBusyOptions): (Promise<BusyHandle>) | BusyHandle;
|
|
278
|
+
/** @inheritdoc IReactNotifier.showWindow */
|
|
279
|
+
showWindow(type: string, options?: ShowWindowOptions): Promise<HTMLElement>;
|
|
280
|
+
/** @inheritdoc IReactNotifier.showError */
|
|
281
|
+
showError(error: any): void;
|
|
282
|
+
/** @inheritdoc IReactNotifier.showOptions */
|
|
283
|
+
showOptions(options: ShowOptionsOptions): Promise<OptionInput>;
|
|
284
|
+
/** @inheritdoc IReactNotifier.showInput */
|
|
285
|
+
showInput(options: ShowInputOptions): Promise<InputResults>;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Context provider for notifications. Allows custom notification implementations
|
|
289
|
+
* to be provided to components within the provider tree.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```tsx
|
|
293
|
+
* const customNotifier = {
|
|
294
|
+
* showMessage: (message) => toast(message),
|
|
295
|
+
* showError: (error) => toast.error(error),
|
|
296
|
+
* // ... other methods
|
|
297
|
+
* };
|
|
298
|
+
*
|
|
299
|
+
* <ReactNotifierProvider notifier={customNotifier}>
|
|
300
|
+
* <App />
|
|
301
|
+
* </ReactNotifierProvider>
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
export interface ReactNotifierProviderProps {
|
|
305
|
+
children: React.ReactNode;
|
|
306
|
+
notifier: IReactNotifier;
|
|
307
|
+
}
|
|
308
|
+
export declare const ReactNotifierProvider: React.FC<ReactNotifierProviderProps>;
|
|
309
|
+
/**
|
|
310
|
+
* Hook to access the notification system. Uses the notifier from the nearest
|
|
311
|
+
* NotifierProvider, or falls back to the default ReactNotifier singleton if
|
|
312
|
+
* no provider is found.
|
|
313
|
+
*
|
|
314
|
+
* @returns The notification interface
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```tsx
|
|
318
|
+
* function MyComponent() {
|
|
319
|
+
* const notifier = useNotifier();
|
|
320
|
+
*
|
|
321
|
+
* const handleClick = () => {
|
|
322
|
+
* notifier.showMessage('Hello World!', { type: NotifierType.Success });
|
|
323
|
+
* };
|
|
324
|
+
*
|
|
325
|
+
* return <button onClick={handleClick}>Show INotifier</button>;
|
|
326
|
+
* }
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
export declare const useNotifier: () => IReactNotifier;
|
|
330
|
+
//# sourceMappingURL=useNotifier.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ClickOrFocusAwayOptions {
|
|
3
|
+
mouseEvents?: boolean;
|
|
4
|
+
focusEvents?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export type ClickOrFocusAwayListener = (event: globalThis.MouseEvent | globalThis.KeyboardEvent) => void;
|
|
7
|
+
export declare function useOnClickOrFocusAway(ref: React.RefObject<any>, listenerArg: ClickOrFocusAwayListener, options?: ClickOrFocusAwayOptions): void;
|
|
8
|
+
//# sourceMappingURL=useOnClickOrFocusAway.d.ts.map
|