@sheetxl/utils-react 0.8.0-beta.10 → 0.8.0-beta.11
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/esm/{MX1mB0lFgdtW9vqX.mjs → 3j_xcvx6bFQsulwT.mjs} +1 -1
- package/browser/esm/{c6p-JLuLHZbSS4lS.mjs → DmyXYEmBOLQfUC3S.mjs} +2 -2
- package/browser/esm/IqQLdwJk1VA8hpDI.mjs +100 -0
- package/browser/esm/index.mjs +1537 -1466
- package/node/esm/{DluzVx_97eND2sL7.mjs → B7T-c_PH7rtDuiLF.mjs} +1 -1
- package/node/esm/DHJ2cDJlYQ1rBfYF.mjs +100 -0
- package/node/esm/index.mjs +1310 -1237
- package/package.json +2 -2
- package/types/src/hooks/useEditMode.d.ts +21 -3
- package/types/src/hooks/useNotifier.d.ts +25 -32
- package/types/src/icons/packs/Base.json.d.ts +3406 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/scroller/Scroller.d.ts +1 -1
- package/types/src/utils/index.d.ts +1 -0
- package/types/src/utils/measureUIText.d.ts +24 -0
- package/types/src/virtualKeyboard/VirtualKeyboard.d.ts +122 -0
- package/types/src/virtualKeyboard/index.d.ts +2 -0
- package/browser/esm/C61KRGJ5SxolPzsV.mjs +0 -2352
- package/node/esm/DgX4rJhtPuZxWvt5.mjs +0 -2352
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/utils-react",
|
|
3
3
|
"description": "Utils React - Utilities for React capabilities needed for all SheetXL components.",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
4
|
+
"version": "0.8.0-beta.11",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@floating-ui/react-dom": "^2.1.9",
|
|
43
|
-
"@sheetxl/utils": "^0.8.0-beta.
|
|
43
|
+
"@sheetxl/utils": "^0.8.0-beta.11",
|
|
44
44
|
"clsx": "^2.1.1",
|
|
45
45
|
"detect-it": "^4.0.1",
|
|
46
46
|
"prop-types": "^15.8.1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditModeHandler, SetEditMode } from '@sheetxl/utils';
|
|
1
|
+
import { EditMode, EditModeHandler, SetEditMode } from '@sheetxl/utils';
|
|
2
2
|
/**
|
|
3
3
|
* Publish (or clear) the active {@link EditMode} on the app-wide bus **without a hook** — the same
|
|
4
4
|
* write {@link useEditMode}'s `setMode` performs (fires the superseded mode's
|
|
@@ -11,6 +11,25 @@ import { EditModeHandler, SetEditMode } from '@sheetxl/utils';
|
|
|
11
11
|
* to be mounted (a `SingletonHooksContainer` in the tree), exactly like the hook.
|
|
12
12
|
*/
|
|
13
13
|
export declare const setEditMode: SetEditMode;
|
|
14
|
+
/** A way out of a mode: {@link EditMode.done} or {@link EditMode.cancel}. */
|
|
15
|
+
export type EditModeExit = 'done' | 'cancel';
|
|
16
|
+
/**
|
|
17
|
+
* Take a way out of a mode from chrome (the status bar's ✓ / ✕): tells the
|
|
18
|
+
* {@link subscribeEditModeExit} listeners, then runs the mode's own `done` or `cancel`.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* A way out is the user finishing the interaction, which is more than the mode ending: an edit also
|
|
22
|
+
* ends when Enter moves on to the next cell. A feature that follows the user rather than the mode (the
|
|
23
|
+
* virtual keyboard going down) listens here, so the chrome needs no knowledge of it.
|
|
24
|
+
*/
|
|
25
|
+
export declare const exitEditMode: (mode: EditMode, exit: EditModeExit) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Listen for a way out of a mode taken from chrome (see {@link exitEditMode}). Called before the
|
|
28
|
+
* mode's own `done` or `cancel` runs.
|
|
29
|
+
*
|
|
30
|
+
* @returns Stops listening.
|
|
31
|
+
*/
|
|
32
|
+
export declare const subscribeEditModeExit: (listener: (mode: EditMode, exit: EditModeExit) => void) => (() => void);
|
|
14
33
|
/**
|
|
15
34
|
* Access the application's **edit-mode bus** — the single, app-wide signal describing the
|
|
16
35
|
* interaction currently in effect.
|
|
@@ -37,8 +56,7 @@ export declare const setEditMode: SetEditMode;
|
|
|
37
56
|
*
|
|
38
57
|
* Typical **consumers** (read the active mode):
|
|
39
58
|
* - the status bar, which shows {@link EditMode.description} (and its idle label when there is none),
|
|
40
|
-
* with a ✕
|
|
41
|
-
* mode carries them;
|
|
59
|
+
* with a ✕ and a ✓ that take the mode's ways out ({@link exitEditMode}) when the mode carries them;
|
|
42
60
|
* - the grid, which applies {@link EditMode.cursor};
|
|
43
61
|
* - features that must defer to another interaction — e.g. fill is suppressed while a cell is being
|
|
44
62
|
* edited — by inspecting the active {@link EditMode.key}.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NotifierOptions, INotifier } from '@sheetxl/utils';
|
|
3
3
|
/**
|
|
4
4
|
* Indicates the type of notification.
|
|
5
5
|
*/
|
|
@@ -269,52 +269,45 @@ export interface IReactNotifier extends INotifier {
|
|
|
269
269
|
*/
|
|
270
270
|
showInput: (options: ShowInputOptions) => Promise<InputResults>;
|
|
271
271
|
}
|
|
272
|
-
export
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
/** @inheritdoc IReactNotifier.showBusy */
|
|
280
|
-
showBusy(message: string | React.ReactNode, options?: ShowBusyOptions): (Promise<BusyHandle>) | BusyHandle;
|
|
281
|
-
/** @inheritdoc IReactNotifier.showWindow */
|
|
282
|
-
showWindow(type: string, options?: ShowWindowOptions): Promise<HTMLElement>;
|
|
283
|
-
/** @inheritdoc IReactNotifier.showError */
|
|
284
|
-
showError(error: any): void;
|
|
285
|
-
/** @inheritdoc IReactNotifier.showOptions */
|
|
286
|
-
showOptions(options: ShowOptionsOptions): Promise<OptionInput>;
|
|
287
|
-
/** @inheritdoc IReactNotifier.showInput */
|
|
288
|
-
showInput(options: ShowInputOptions): Promise<InputResults>;
|
|
272
|
+
export interface ReactNotifierProviderProps {
|
|
273
|
+
children: React.ReactNode;
|
|
274
|
+
/**
|
|
275
|
+
* The methods this provider implements. The ones it leaves out come from a provider further out,
|
|
276
|
+
* or do what {@link useNotifier} does with no provider.
|
|
277
|
+
*/
|
|
278
|
+
notifier: Partial<IReactNotifier>;
|
|
289
279
|
}
|
|
290
280
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
281
|
+
* Shows the messages, dialogs and busy indicators that components below it ask for through
|
|
282
|
+
* {@link useNotifier}.
|
|
283
|
+
*
|
|
284
|
+
* @remarks
|
|
285
|
+
* Providers stack **per method, and the outermost wins**. An app that wraps a studio in a provider
|
|
286
|
+
* with only `showMessage` replaces the studio's toasts and keeps its dialogs.
|
|
287
|
+
*
|
|
288
|
+
* The provider affects React components only. To redirect the SDK's own messages, override the
|
|
289
|
+
* global {@link Notifier}.
|
|
293
290
|
*
|
|
294
291
|
* @example
|
|
295
292
|
* ```tsx
|
|
296
|
-
* const
|
|
293
|
+
* const notifier = {
|
|
297
294
|
* showMessage: (message) => toast(message),
|
|
298
|
-
* showError: (error) => toast.error(error)
|
|
299
|
-
* // ... other methods
|
|
295
|
+
* showError: (error) => toast.error(String(error))
|
|
300
296
|
* };
|
|
301
297
|
*
|
|
302
|
-
* <ReactNotifierProvider notifier={
|
|
298
|
+
* <ReactNotifierProvider notifier={notifier}>
|
|
303
299
|
* <App />
|
|
304
300
|
* </ReactNotifierProvider>
|
|
305
301
|
* ```
|
|
306
302
|
*/
|
|
307
|
-
export interface ReactNotifierProviderProps {
|
|
308
|
-
children: React.ReactNode;
|
|
309
|
-
notifier: IReactNotifier;
|
|
310
|
-
}
|
|
311
303
|
export declare const ReactNotifierProvider: React.FC<ReactNotifierProviderProps>;
|
|
312
304
|
/**
|
|
313
|
-
*
|
|
314
|
-
* NotifierProvider, or falls back to the default ReactNotifier singleton if
|
|
315
|
-
* no provider is found.
|
|
305
|
+
* Returns the notifier for showing the user messages, dialogs and busy indicators.
|
|
316
306
|
*
|
|
317
|
-
* @
|
|
307
|
+
* @remarks
|
|
308
|
+
* Every method is always present. With no {@link ReactNotifierProvider} above, messages, dialogs and
|
|
309
|
+
* busy indicators show nothing (a dialog resolves as if cancelled), and `log`, `warn`, `error` and
|
|
310
|
+
* `showError` go to the global {@link Notifier}.
|
|
318
311
|
*
|
|
319
312
|
* @example
|
|
320
313
|
* ```tsx
|