@sheetxl/utils-react 0.7.27 → 0.7.28-beta.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.
- 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/CD4Q4NRTfHSJirLz.mjs +139 -0
- package/browser/esm/DAwEWkKjQCR-nguL.mjs +2171 -0
- package/browser/esm/DUF3Ugd4Z1SDNXPb.mjs +390 -0
- package/browser/esm/index.mjs +6128 -1806
- package/licenses/dependencies.txt +246 -39
- package/node/esm/DA8vLJ8AED3TYoSo.mjs +2171 -0
- package/node/esm/DKS7p6NraAuZKdCC.mjs +139 -0
- package/node/esm/index.mjs +5141 -1774
- 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,33 @@
|
|
|
1
|
+
import { ICommandDefinition } from './ICommandDefinition';
|
|
2
|
+
/**
|
|
3
|
+
* The result of reducing an ordered (**least → most specific**) list of
|
|
4
|
+
* {@link ICommandDefinition} for a single key.
|
|
5
|
+
*
|
|
6
|
+
* Merge rule: **override** for every property (the most-specific contribution wins),
|
|
7
|
+
* **except the {@link ACCUMULATE} fields** (`disabledReasons`, `tags`) which **accumulate**
|
|
8
|
+
* — concatenated, most-specific first — so reasons/tags from different scopes stack instead
|
|
9
|
+
* of clobbering. (Atomic handling of `shortcut` is still a deferred cleanup; see
|
|
10
|
+
* design/COMMAND-DESIGN.md.)
|
|
11
|
+
*
|
|
12
|
+
* `contributedBy` records which contribution index supplied each property — the cascade
|
|
13
|
+
* **introspection** hook (the "CSS devtools" requirement) that keeps the cascade debuggable.
|
|
14
|
+
*/
|
|
15
|
+
/** Fields that **accumulate** (concat) across the chain instead of overriding. */
|
|
16
|
+
export declare const ACCUMULATE: ReadonlySet<string>;
|
|
17
|
+
export interface ReducedDefinition<STATE = any, CONTEXT = any, ARGS = void> {
|
|
18
|
+
key: string;
|
|
19
|
+
/** The winning (most-specific) value for each contributed property. */
|
|
20
|
+
props: Partial<ICommandDefinition<STATE, CONTEXT, ARGS>>;
|
|
21
|
+
/** property name → index (in `defs`) of the contribution that supplied it. */
|
|
22
|
+
contributedBy: Record<string, number>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Reduce all contributions for ONE command key into a {@link ReducedDefinition}.
|
|
26
|
+
* The heart of "reduce up the chain": the registry calls this with the contributions
|
|
27
|
+
* gathered along the active scope chain, ordered **least → most specific**.
|
|
28
|
+
*
|
|
29
|
+
* Cross-scope reduction lives here; within-scope merging (successive `updateCommand` calls
|
|
30
|
+
* on one provider) happens before this, so each `defs` entry is one scope's merged value.
|
|
31
|
+
*/
|
|
32
|
+
export declare function reduceDefinitions<STATE = any, CONTEXT = any, ARGS = void>(key: string, defs: readonly ICommandDefinition<STATE, CONTEXT, ARGS>[]): ReducedDefinition<STATE, CONTEXT, ARGS>;
|
|
33
|
+
//# sourceMappingURL=reduceDefinitions.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ResolvedCommand, ExecuteHook } from './createResolvedCommand';
|
|
2
|
+
/**
|
|
3
|
+
* Per-key execute observation (ripple/close). `onExecute` fires for every dispatch of the
|
|
4
|
+
* command — `cmd.execute()`, a sibling, or a keystroke.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseCommandsListener<STATE = any, CONTEXT = any, ARGS = any> extends ExecuteHook<STATE, CONTEXT, ARGS> {
|
|
7
|
+
/**
|
|
8
|
+
* Not invoked. The resolver already re-renders subscribers on any command property change
|
|
9
|
+
* (via its version); this member is retained for source compatibility only.
|
|
10
|
+
* @deprecated Rely on the re-render instead.
|
|
11
|
+
*/
|
|
12
|
+
onChange?(command: ResolvedCommand<STATE, CONTEXT, ARGS>): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Subscribe to one or more commands by key, resolved by the nearest container's
|
|
16
|
+
* {@link CommandResolver} (its anchor + cadence — set by {@link CommandAnchorProvider}, not
|
|
17
|
+
* here). Returns the **resolved** commands (re-rendering when the resolver re-emits), and
|
|
18
|
+
* wires `listener` for per-key execute observation (ripple/close), which fires **immediately**
|
|
19
|
+
* for every dispatch path. A button just calls `cmd.execute()`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useCommands<STATE = any, CONTEXT = any, ARGS = any>(commandIds: string | readonly string[], listener?: UseCommandsListener<STATE, CONTEXT, ARGS>): Array<ResolvedCommand<STATE, CONTEXT, ARGS> | undefined>;
|
|
22
|
+
//# sourceMappingURL=useCommands.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ICommandDefinition } from './ICommandDefinition';
|
|
2
|
+
/**
|
|
3
|
+
* Contribute a set of command definitions onto the **current (ambient) scope** for the lifetime of
|
|
4
|
+
* the calling component, removing them on unmount. The generic "drop a contributor" primitive (the
|
|
5
|
+
* model→scope adapter, design/COMMAND-DESIGN.md): a feature builds its definitions — chrome +
|
|
6
|
+
* callbacks bound to its live model — and hands them here; the **placement rule** decides which
|
|
7
|
+
* scope is ambient (e.g. a grid pane scope provided by `wrapPane`).
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Decoupled from any visual layer: a contributor is a **sibling that writes** to the shared scope,
|
|
11
|
+
* not a wrapper. Pass a **stable** `definitions` reference (memoize on the model) — a fresh array
|
|
12
|
+
* each render re-contributes. No-ops when there is no ambient scope (graceful when the grid isn't
|
|
13
|
+
* running commands).
|
|
14
|
+
*
|
|
15
|
+
* @param definitions The (callback-bearing) definitions to contribute. Memoize by the model.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useContributeCommands(definitions: readonly ICommandDefinition[]): void;
|
|
18
|
+
//# sourceMappingURL=useContributeCommands.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Direction } from '@sheetxl/utils';
|
|
3
|
+
export interface FocusKeyNavigationProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
refFocusStart?: React.RefObject<HTMLElement>;
|
|
5
|
+
/**
|
|
6
|
+
* If tab and all tabIndices are the same which direction should the tab scan. Note - shift tab will go the opposite direction
|
|
7
|
+
*/
|
|
8
|
+
tabForward?: Direction;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Wrap around a div to allow. This will navigate through enabled divs with tabindex (but only one level deep)
|
|
12
|
+
* It uses the current layout to determine navigation
|
|
13
|
+
* TODO - we need to find an
|
|
14
|
+
* tab/shift-tab navigation
|
|
15
|
+
* arrow key navigation
|
|
16
|
+
*
|
|
17
|
+
* another option is to use rowindex/columnIndex attributes?
|
|
18
|
+
*
|
|
19
|
+
* default direction (for tab)
|
|
20
|
+
*/
|
|
21
|
+
export declare const FocusKeyNavigation: React.FC<FocusKeyNavigationProps>;
|
|
22
|
+
//# sourceMappingURL=FocusKeyNavigation.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const ToolTipPlacement: {
|
|
3
|
+
readonly BottomEnd: "bottom-end";
|
|
4
|
+
readonly BottomStart: "bottom-start";
|
|
5
|
+
readonly Bottom: "bottom";
|
|
6
|
+
readonly LeftEnd: "left-end";
|
|
7
|
+
readonly LeftStart: "left-start";
|
|
8
|
+
readonly Left: "left";
|
|
9
|
+
readonly RightEnd: "right-end";
|
|
10
|
+
readonly RightStart: "right-start";
|
|
11
|
+
readonly Right: "right";
|
|
12
|
+
readonly TopEnd: "top-end";
|
|
13
|
+
readonly TopStart: "top-start";
|
|
14
|
+
readonly Top: "top";
|
|
15
|
+
};
|
|
16
|
+
export type ToolTipPlacement = typeof ToolTipPlacement[keyof typeof ToolTipPlacement];
|
|
17
|
+
export interface IShowToolTipProperties {
|
|
18
|
+
/**
|
|
19
|
+
* The anchor for the tooltip. x,y are required
|
|
20
|
+
* but width and height can also be provided.
|
|
21
|
+
*/
|
|
22
|
+
anchor: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
width?: number;
|
|
26
|
+
height?: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The value to display. This is either a string or a react element
|
|
30
|
+
*/
|
|
31
|
+
display?: string | React.ReactElement;
|
|
32
|
+
/**
|
|
33
|
+
* Purely suggestion only
|
|
34
|
+
* If not specified then the consumer will determine
|
|
35
|
+
*/
|
|
36
|
+
placement?: ToolTipPlacement;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=ITooltip.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface RoundedTabProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
|
+
radius?: number;
|
|
4
|
+
strokeWidth?: number;
|
|
5
|
+
strokeColor?: string;
|
|
6
|
+
/**
|
|
7
|
+
* The clip applied to the child (which also shapes any ripple drawn inside it).
|
|
8
|
+
* - `'tab'` — the inverted, open-top tab outline (Excel/Chrome style).
|
|
9
|
+
* - `'rounded'` — a plain rounded rectangle, optionally inset via {@link clipInset}
|
|
10
|
+
* so it can match an inset "pill" background.
|
|
11
|
+
* @defaultValue 'tab'
|
|
12
|
+
*/
|
|
13
|
+
variant?: 'tab' | 'rounded';
|
|
14
|
+
/**
|
|
15
|
+
* Inset (px) of the `'rounded'` clip from each edge of the container. Lets the clip
|
|
16
|
+
* line up with an inset pill so a ripple stays within the pill.
|
|
17
|
+
*/
|
|
18
|
+
clipInset?: {
|
|
19
|
+
top?: number;
|
|
20
|
+
right?: number;
|
|
21
|
+
bottom?: number;
|
|
22
|
+
left?: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare const RoundedTab: React.FC<RoundedTabProps>;
|
|
26
|
+
//# sourceMappingURL=RoundedTab.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for an Error Panel
|
|
3
|
+
*/
|
|
4
|
+
export interface ErrorPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* The error to show
|
|
7
|
+
*/
|
|
8
|
+
error: any;
|
|
9
|
+
/**
|
|
10
|
+
* Ref to the element.
|
|
11
|
+
*/
|
|
12
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ErrorPanel.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const ReactErrorBoundary: React.FC<{
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/** Rendered while the children are throwing. @defaultValue `null` */
|
|
5
|
+
fallback?: React.ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=ReactErrorBoundary.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FloatPopperProps, FloatPopperPosition, FloatPopperAnchor } from './FloatPopper';
|
|
3
|
+
import { FloatPopupPanelProps } from './FloatPopup';
|
|
4
|
+
import { FloatReference } from './useFloatStack';
|
|
5
|
+
/**
|
|
6
|
+
* Props for {@link FloatPanel}.
|
|
7
|
+
*/
|
|
8
|
+
export interface FloatPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
9
|
+
open: boolean;
|
|
10
|
+
floatReference?: FloatReference;
|
|
11
|
+
anchorEl?: FloatPopperAnchor;
|
|
12
|
+
anchorPosition?: FloatPopperPosition;
|
|
13
|
+
label?: string;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
createPopupPanel?: (props: FloatPopupPanelProps) => React.ReactElement | null;
|
|
16
|
+
propsPopper?: Partial<FloatPopperProps>;
|
|
17
|
+
onClosing?: () => void;
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
onMount?: (element: HTMLDivElement, instance: any) => void;
|
|
20
|
+
onOpening?: () => void;
|
|
21
|
+
onOpen?: () => void;
|
|
22
|
+
ref?: React.Ref<any>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A floating, anchored surface for transient content such as menus, dropdowns,
|
|
26
|
+
* popovers and context menus.
|
|
27
|
+
*
|
|
28
|
+
* `FloatPanel` pairs a {@link FloatPopper} (which positions content next to an
|
|
29
|
+
* anchor element or point, renders it in a portal, flips it to stay on screen
|
|
30
|
+
* and animates it in) with a styled, scrollable "card" surface. The content of
|
|
31
|
+
* that card is supplied by {@link FloatPanelProps.createPopupPanel}.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Most consumers do not render `FloatPanel` directly — {@link useFloatStack}
|
|
35
|
+
* manages instances for you, adding open/close timing, nested stacking, focus
|
|
36
|
+
* handling and click-away dismissal. Reach for `FloatPanel` directly only when
|
|
37
|
+
* you need a single, self-managed floating surface.
|
|
38
|
+
*
|
|
39
|
+
* When to use which:
|
|
40
|
+
* - {@link FloatPopper} — you only need raw positioning + portal (no card chrome).
|
|
41
|
+
* - {@link FloatTooltip} — a small, controlled hint anchored to a point.
|
|
42
|
+
* - `FloatPanel` / {@link useFloatStack} — interactive floating content (menus, popovers).
|
|
43
|
+
*
|
|
44
|
+
* The surface is theme-aware via CSS variables (e.g. `--sxl-color-base-100`),
|
|
45
|
+
* so it adopts the surrounding theme without a UI-framework dependency.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <FloatPanel
|
|
50
|
+
* open={open}
|
|
51
|
+
* anchorEl={anchorRef.current}
|
|
52
|
+
* createPopupPanel={() => <MyMenu />}
|
|
53
|
+
* />
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare const FloatPanel: React.NamedExoticComponent<Omit<FloatPanelProps, "ref"> & React.RefAttributes<any>>;
|
|
57
|
+
//# sourceMappingURL=FloatPanel.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Placement } from '@floating-ui/react-dom';
|
|
3
|
+
export interface FloatPopperPosition {
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Minimal imperative handle to the underlying Floating UI positioner.
|
|
9
|
+
*
|
|
10
|
+
* Historically this returned a popper.js `Instance`; nothing actually consumed
|
|
11
|
+
* it, so it is reduced to the one operation that is meaningful — forcing a
|
|
12
|
+
* reposition.
|
|
13
|
+
*/
|
|
14
|
+
export interface FloatPopperInstance {
|
|
15
|
+
/** Force the floating element to recompute its position. */
|
|
16
|
+
update: () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface FloatPopperRef {
|
|
19
|
+
instance: () => FloatPopperInstance | null;
|
|
20
|
+
element: () => HTMLElement | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Virtual or real element used to anchor the popper.
|
|
24
|
+
*/
|
|
25
|
+
export type FloatPopperAnchor = HTMLElement | {
|
|
26
|
+
getBoundingClientRect: () => DOMRect;
|
|
27
|
+
} | (() => HTMLElement) | (() => {
|
|
28
|
+
getBoundingClientRect: () => DOMRect;
|
|
29
|
+
});
|
|
30
|
+
export interface FloatPopperProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
31
|
+
/**
|
|
32
|
+
* Whether the popper should be shown (drives the enter/exit transition).
|
|
33
|
+
*/
|
|
34
|
+
open: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The element (or virtual element) the popper is positioned against.
|
|
37
|
+
*/
|
|
38
|
+
anchorEl?: FloatPopperAnchor;
|
|
39
|
+
/**
|
|
40
|
+
* Explicit position. Takes precedence over `anchorEl`.
|
|
41
|
+
*/
|
|
42
|
+
anchorPosition?: FloatPopperPosition;
|
|
43
|
+
/**
|
|
44
|
+
* @defaultValue 'bottom-start'
|
|
45
|
+
*/
|
|
46
|
+
placement?: Placement;
|
|
47
|
+
/**
|
|
48
|
+
* `[skidding, distance]` offset (popper.js convention, preserved for
|
|
49
|
+
* compatibility). `skidding` shifts along the anchor edge, `distance` pushes
|
|
50
|
+
* away from it.
|
|
51
|
+
* @defaultValue [0, 2]
|
|
52
|
+
*/
|
|
53
|
+
offsets?: number[];
|
|
54
|
+
/**
|
|
55
|
+
* If the panel can resize on overflow. Otherwise it will try to fit.
|
|
56
|
+
* @defaultValue true
|
|
57
|
+
*/
|
|
58
|
+
resizeOnOverflow?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Poll the anchor's position every animation frame while open (Floating UI
|
|
61
|
+
* `autoUpdate({ animationFrame: true })`). Needed when the anchor is a VIRTUAL element that MOVES with no
|
|
62
|
+
* scroll/resize event to observe — e.g. a caret-following formula hint whose rect changes as the caret
|
|
63
|
+
* moves by click or arrow. Off by default: the per-frame poll has a cost, so only anchors that track a
|
|
64
|
+
* moving point should enable it (a normal element/point anchor repositions fine on scroll/resize alone).
|
|
65
|
+
* @defaultValue false
|
|
66
|
+
*/
|
|
67
|
+
followAnchor?: boolean;
|
|
68
|
+
label?: string;
|
|
69
|
+
children?: React.ReactNode;
|
|
70
|
+
onMount?: (element: HTMLDivElement, instance: FloatPopperInstance) => void;
|
|
71
|
+
onOpening?: () => void;
|
|
72
|
+
onOpen?: () => void;
|
|
73
|
+
onClosing?: () => void;
|
|
74
|
+
onClose?: () => void;
|
|
75
|
+
ref?: React.Ref<FloatPopperRef>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Popper built directly on [Floating UI](https://floating-ui.com)
|
|
79
|
+
* (`@floating-ui/react-dom`).
|
|
80
|
+
*
|
|
81
|
+
* A popper has 3 lifecycle states: mounted, visible, open.
|
|
82
|
+
*/
|
|
83
|
+
declare const FloatPopper: React.FC<FloatPopperProps>;
|
|
84
|
+
export { FloatPopper };
|
|
85
|
+
//# sourceMappingURL=FloatPopper.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FloatReference } from './useFloatStack';
|
|
3
|
+
/**
|
|
4
|
+
* Props passed to the panel rendered inside a float.
|
|
5
|
+
*/
|
|
6
|
+
export interface FloatPopupPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
popupContainer?: HTMLElement;
|
|
8
|
+
floatReference?: FloatReference;
|
|
9
|
+
/**
|
|
10
|
+
* When the popup panel initiates a close
|
|
11
|
+
*/
|
|
12
|
+
closeFloat?: () => void;
|
|
13
|
+
closeFloatAll?: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Default popup panel (a simple flex column container).
|
|
17
|
+
*/
|
|
18
|
+
export declare const defaultCreateFloatPopupPanel: (props: FloatPopupPanelProps) => React.ReactElement;
|
|
19
|
+
//# sourceMappingURL=FloatPopup.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ThemeMode } from '../theme';
|
|
3
|
+
import { FloatReference, RenderFloatPanel } from './useFloatStack';
|
|
4
|
+
import { FloatPanelProps } from './FloatPanel';
|
|
5
|
+
import { FloatPopupPanelProps } from './FloatPopup';
|
|
6
|
+
/** The built-in neutral surface (the "floor") used when nothing else provides one. */
|
|
7
|
+
export declare const defaultRenderFloatPanel: RenderFloatPanel;
|
|
8
|
+
export interface FloatProviderProps {
|
|
9
|
+
/**
|
|
10
|
+
* The floating surface for descendants. When omitted, the surface is
|
|
11
|
+
* inherited from an outer provider (and ultimately the neutral `FloatPanel`).
|
|
12
|
+
*/
|
|
13
|
+
renderFloatPanel?: RenderFloatPanel;
|
|
14
|
+
/** Default panel-content factory for descendants. Inherited when omitted. */
|
|
15
|
+
createPopupPanel?: (props: FloatPopupPanelProps) => any;
|
|
16
|
+
/** Extra props merged into the rendered panel. Inherited when omitted. */
|
|
17
|
+
propsFloatPanel?: Partial<FloatPanelProps>;
|
|
18
|
+
/**
|
|
19
|
+
* Add a per-instance scope class to the theme floats in this subtree carry (see {@link FloatThemeScope}).
|
|
20
|
+
* Accumulates onto any inherited scope classes, so a float resolves every ancestor instance's scoped
|
|
21
|
+
* tokens. An app/instance sets this to its own scope class (e.g. `sheetxl-studio-<id>`).
|
|
22
|
+
*/
|
|
23
|
+
themeScopeClass?: string;
|
|
24
|
+
/** The `data-sxl-theme-surface` floats in this subtree open with (nearest provider wins). App sets `app`. */
|
|
25
|
+
themeSurface?: string;
|
|
26
|
+
/** The `data-sxl-theme-mode` floats in this subtree open with (nearest provider wins). App sets its mode. */
|
|
27
|
+
themeMode?: ThemeMode;
|
|
28
|
+
/**
|
|
29
|
+
* Establish an isolated state root for this subtree (its own open-tree,
|
|
30
|
+
* focus/click-away coordination and debounce), independent of other roots on
|
|
31
|
+
* the page. Mount on the boundary that should coordinate as a unit (e.g. an
|
|
32
|
+
* app or split-view container). Without it, a nested provider inherits the
|
|
33
|
+
* enclosing root — but a *top-level* provider (no enclosing float) still
|
|
34
|
+
* auto-roots, so `isolate` is only needed to force a NEW root when nested.
|
|
35
|
+
*/
|
|
36
|
+
isolate?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Receives the root float in effect for this subtree, so an owner *outside*
|
|
39
|
+
* the subtree can drive it imperatively (e.g. `rootRef.current.closeAll()` on
|
|
40
|
+
* webview focus loss). `isolate` *creates* a root; this only *exposes* it.
|
|
41
|
+
*
|
|
42
|
+
* Set with or without `isolate`: the owned root when this provider roots
|
|
43
|
+
* (isolating, or top of the tree), otherwise the inherited root. Always set to
|
|
44
|
+
* a root (never null) while mounted.
|
|
45
|
+
*/
|
|
46
|
+
rootRef?: React.Ref<FloatReference>;
|
|
47
|
+
children?: React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Configures the float system for a subtree.
|
|
51
|
+
*
|
|
52
|
+
* - `renderFloatPanel`/`propsFloatPanel` set the surface, overriding only when
|
|
53
|
+
* given (otherwise the outer surface flows through unchanged), so the
|
|
54
|
+
* nearest explicit surface wins.
|
|
55
|
+
* - The top provider in a tree (no enclosing float) automatically owns a fresh
|
|
56
|
+
* coordinating root; nested providers inherit it. `isolate` forces a *new*
|
|
57
|
+
* root even when nested (a sub-scope).
|
|
58
|
+
*/
|
|
59
|
+
export declare const FloatProvider: (props: FloatProviderProps) => React.ReactElement;
|
|
60
|
+
//# sourceMappingURL=FloatProvider.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FloatReference } from './useFloatStack';
|
|
2
|
+
/**
|
|
3
|
+
* Provides the current {@link FloatReference} to descendants.
|
|
4
|
+
*
|
|
5
|
+
* {@link useFloatStack} wraps its own popup content with this automatically, so
|
|
6
|
+
* nested popup buttons inherit their parent float. Ambient (non-popup) floats
|
|
7
|
+
* that render their children inline (e.g. a toolbar) should wrap those children
|
|
8
|
+
* with this provider explicitly.
|
|
9
|
+
*/
|
|
10
|
+
export declare const FloatStackProvider: import('react').Provider<FloatReference | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the {@link FloatReference} of the enclosing region (i.e. the float
|
|
13
|
+
* this component is rendered inside), or `null` when there is no ancestor float.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This is the float you would nest under, so from a child's perspective it is
|
|
17
|
+
* the "parent". A component that owns a float (via {@link useFloatStack}) gets
|
|
18
|
+
* its own reference from that hook; `useFloat` returns the one *above* it.
|
|
19
|
+
*
|
|
20
|
+
* Use this in any component that needs the enclosing float without owning one —
|
|
21
|
+
* e.g. a menu item calling `closeChild()` on hover to dismiss an open sibling
|
|
22
|
+
* submenu. Such components are not reached by props, only by context.
|
|
23
|
+
*/
|
|
24
|
+
export declare const useFloat: () => FloatReference | null;
|
|
25
|
+
//# sourceMappingURL=FloatStackContext.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Placement } from '@floating-ui/react-dom';
|
|
3
|
+
import { FloatPopperPosition, FloatPopperAnchor } from './FloatPopper';
|
|
4
|
+
/**
|
|
5
|
+
* A lightweight, controlled tooltip built on {@link FloatPopper}.
|
|
6
|
+
*
|
|
7
|
+
* Unlike a hover tooltip, this is fully controlled (`open` + `anchor`) which suits
|
|
8
|
+
* programmatic tooltips (e.g. scroll/resize hints).
|
|
9
|
+
*/
|
|
10
|
+
export interface FloatTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
11
|
+
open: boolean;
|
|
12
|
+
title?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* @defaultValue 'top'
|
|
15
|
+
*/
|
|
16
|
+
placement?: Placement;
|
|
17
|
+
anchorEl?: FloatPopperAnchor;
|
|
18
|
+
anchorPosition?: FloatPopperPosition;
|
|
19
|
+
offsets?: number[];
|
|
20
|
+
}
|
|
21
|
+
export declare const FloatTooltip: React.NamedExoticComponent<FloatTooltipProps & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
//# sourceMappingURL=FloatTooltip.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FloatPanelProps } from './FloatPanel';
|
|
2
|
+
import { FloatPopupPanelProps } from './FloatPopup';
|
|
3
|
+
import { RenderFloatPanel } from './useFloatStack';
|
|
4
|
+
import { ThemeAttrs, ThemeMode } from '../theme';
|
|
5
|
+
/**
|
|
6
|
+
* The theme a float opens with (THEMING-DESIGN §7). A float portals to a shared, theme-free container
|
|
7
|
+
* (`getPortalContainer()`), so it must carry its **origin instance's** theme onto its own wrapper. That
|
|
8
|
+
* theme rides the float-surface context: the nearest {@link FloatSurface}-providing ancestor
|
|
9
|
+
* ({@link FloatProvider}) decides it — the app sets one at its root; the grid deliberately sets none, so a
|
|
10
|
+
* grid-originated menu inherits the app's (a menu from a light grid in a dark app opens dark, following the
|
|
11
|
+
* app). To theme (or re-surface) floats for a subtree, drop a {@link FloatProvider} with a new theme.
|
|
12
|
+
*/
|
|
13
|
+
export interface FloatThemeScope {
|
|
14
|
+
/**
|
|
15
|
+
* Scope class name(s) placed on the float wrapper so the instance's per-instance `@scope (.<class>){…}`
|
|
16
|
+
* rules treat the wrapper as a scope root and apply to it. Accumulated through nested providers so a float
|
|
17
|
+
* can resolve every ancestor instance's scoped tokens (layer order settles conflicts).
|
|
18
|
+
*/
|
|
19
|
+
classes?: string[];
|
|
20
|
+
/** The `data-sxl-theme-surface` a float opens with. App-driven; defaults to `app`. */
|
|
21
|
+
surface?: string;
|
|
22
|
+
/** The `data-sxl-theme-mode` a float opens with — the app's resolved mode (so floats follow the app). */
|
|
23
|
+
mode?: ThemeMode;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Ambient floating-surface configuration: how the panel is rendered and any
|
|
27
|
+
* extra panel props to merge. Resolved most-specific-wins via {@link FloatProvider}.
|
|
28
|
+
*/
|
|
29
|
+
export interface FloatSurface {
|
|
30
|
+
renderFloatPanel?: RenderFloatPanel;
|
|
31
|
+
/** Default panel-content factory, used when a float doesn't supply its own. */
|
|
32
|
+
createPopupPanel?: (props: FloatPopupPanelProps) => any;
|
|
33
|
+
propsFloatPanel?: Partial<FloatPanelProps>;
|
|
34
|
+
/**
|
|
35
|
+
* The theme floats in this subtree open with (scope class(es) + surface + mode). Carried onto the float
|
|
36
|
+
* wrapper by {@link FloatPopper} so a portaled float resolves the origin instance's scoped tokens. See
|
|
37
|
+
* {@link FloatThemeScope}.
|
|
38
|
+
*/
|
|
39
|
+
themeScope?: FloatThemeScope;
|
|
40
|
+
}
|
|
41
|
+
/** The ambient {@link FloatSurface}, or `null` if none is provided. */
|
|
42
|
+
export declare const useFloatSurface: () => FloatSurface | null;
|
|
43
|
+
/**
|
|
44
|
+
* Turn a {@link FloatThemeScope} into the props to carry it across a portal boundary: the scope class(es)
|
|
45
|
+
* and the `data-sxl-theme-*` attrs to spread onto the portaled wrapper so it resolves the origin instance's
|
|
46
|
+
* scoped tokens (THEMING-DESIGN §7). Shared by every element that portals out of its themed subtree —
|
|
47
|
+
* {@link FloatPopper} (popups/menus) and the modal dialog wrapper alike, since a dialog portals to the same
|
|
48
|
+
* theme-free container and must carry its theme the same way. Returns an empty result (no className, no
|
|
49
|
+
* attrs) when the scope carries nothing, so the caller can apply its own fallback.
|
|
50
|
+
*/
|
|
51
|
+
export declare const floatThemeScopeProps: (themeScope?: FloatThemeScope) => {
|
|
52
|
+
className?: string;
|
|
53
|
+
attrs: ThemeAttrs;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=FloatUtils.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FloatReference, FloatReferenceKey } from './useFloatStack';
|
|
2
|
+
import { FloatSurface } from './FloatUtils';
|
|
3
|
+
export declare const DEFAULT_OPEN_DELAY = 120;
|
|
4
|
+
export declare const DEFAULT_CLOSE_DELAY = 60;
|
|
5
|
+
export declare const DEFAULT_CLOSE_OTHER_DELAY = 360;
|
|
6
|
+
/**
|
|
7
|
+
* Backing context for {@link useFloatSurface} / {@link FloatProvider}. Internal: consumers read the
|
|
8
|
+
* ambient surface via the hook and set it via the provider, never the context directly.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SurfaceContext: import('react').Context<FloatSurface | null>;
|
|
11
|
+
interface DebouncedFloat {
|
|
12
|
+
fn: any;
|
|
13
|
+
setReferences: Set<FloatReference>;
|
|
14
|
+
isClose: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The root float.
|
|
18
|
+
*
|
|
19
|
+
* In addition to being a {@link FloatReference}, the root owns the shared
|
|
20
|
+
* runtime state for its tree: the open-child map, the float registry, and the
|
|
21
|
+
* single in-flight debounce. Every float reaches it via
|
|
22
|
+
* {@link FloatReference.getRoot}.
|
|
23
|
+
*
|
|
24
|
+
* Previously this was a set of module-level singletons; making the root the
|
|
25
|
+
* state holder (seeded by {@link FloatProvider}, or a shared default) removes
|
|
26
|
+
* the multi-instance / SSR hazard and the app-wide single debounce.
|
|
27
|
+
*/
|
|
28
|
+
export interface FloatRoot extends FloatReference {
|
|
29
|
+
/** parent key -> currently open child key */
|
|
30
|
+
readonly floatByParents: Map<FloatReferenceKey, FloatReferenceKey>;
|
|
31
|
+
/** float key -> live reference (registered/open floats) */
|
|
32
|
+
readonly statesByMovables: Map<FloatReferenceKey, FloatReference>;
|
|
33
|
+
/** the single in-flight open/close debounce, if any */
|
|
34
|
+
lastDebounced: DebouncedFloat | null;
|
|
35
|
+
/**
|
|
36
|
+
* Debounces an open/close. Only one float transition is in flight at a time;
|
|
37
|
+
* scheduling a new one cancels the previous.
|
|
38
|
+
*/
|
|
39
|
+
debounce(delay: number | null, fn: () => any, setReferences: Set<FloatReference>, isClose: boolean): () => any;
|
|
40
|
+
/** The currently open child of `reference`, if any. */
|
|
41
|
+
getChildRef(reference: FloatReference): FloatReference | null;
|
|
42
|
+
/** `reference` plus its full open-child chain. */
|
|
43
|
+
descendants(reference: FloatReference | null): Set<FloatReference>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates an isolated root float (a {@link FloatReference} that also holds the
|
|
47
|
+
* shared state for its tree).
|
|
48
|
+
*/
|
|
49
|
+
export declare const createFloatRoot: () => FloatRoot;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=_FloatUtils.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './FloatUtils';
|
|
2
|
+
export * from './FloatPopper';
|
|
3
|
+
export * from './FloatPopup';
|
|
4
|
+
export * from './FloatPanel';
|
|
5
|
+
export * from './FloatTooltip';
|
|
6
|
+
export * from './useFloatStack';
|
|
7
|
+
export * from './FloatStackContext';
|
|
8
|
+
export * from './FloatProvider';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|