@fkui/logic 6.31.0 → 6.32.0
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/lib/cjs/index.js +7 -2
- package/lib/esm/index.js +7 -2
- package/lib/types/index.d.ts +6 -1
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -3524,10 +3524,13 @@ function pushFocus(element) {
|
|
|
3524
3524
|
* Restore the focus on the last element from the stack
|
|
3525
3525
|
*
|
|
3526
3526
|
* @public
|
|
3527
|
+
* @param handle - The stack handle returned from the corresponding `pushFocus` call.
|
|
3528
|
+
* @param options - Options for `popFocus`.
|
|
3527
3529
|
* @throws Error when pop is called on an empty focus stack
|
|
3528
3530
|
* @throws Error when pop is called without a valid StackHandle
|
|
3529
3531
|
*/
|
|
3530
|
-
function popFocus(handle) {
|
|
3532
|
+
function popFocus(handle, options = {}) {
|
|
3533
|
+
const { restoreFocus = true } = options;
|
|
3531
3534
|
if (_focusElementStack.length === 0) {
|
|
3532
3535
|
const emptyStackErrorMsg = "Can not call pop on an empty focus stack";
|
|
3533
3536
|
if (configLogic.production) {
|
|
@@ -3551,7 +3554,9 @@ function popFocus(handle) {
|
|
|
3551
3554
|
throw new Error(outOfOrderErrorMsg);
|
|
3552
3555
|
}
|
|
3553
3556
|
}
|
|
3554
|
-
|
|
3557
|
+
if (restoreFocus) {
|
|
3558
|
+
focus(top?.element);
|
|
3559
|
+
}
|
|
3555
3560
|
}
|
|
3556
3561
|
/**
|
|
3557
3562
|
* Restore the focus on the last element from the stack
|
package/lib/esm/index.js
CHANGED
|
@@ -3522,10 +3522,13 @@ function pushFocus(element) {
|
|
|
3522
3522
|
* Restore the focus on the last element from the stack
|
|
3523
3523
|
*
|
|
3524
3524
|
* @public
|
|
3525
|
+
* @param handle - The stack handle returned from the corresponding `pushFocus` call.
|
|
3526
|
+
* @param options - Options for `popFocus`.
|
|
3525
3527
|
* @throws Error when pop is called on an empty focus stack
|
|
3526
3528
|
* @throws Error when pop is called without a valid StackHandle
|
|
3527
3529
|
*/
|
|
3528
|
-
function popFocus(handle) {
|
|
3530
|
+
function popFocus(handle, options = {}) {
|
|
3531
|
+
const { restoreFocus = true } = options;
|
|
3529
3532
|
if (_focusElementStack.length === 0) {
|
|
3530
3533
|
const emptyStackErrorMsg = "Can not call pop on an empty focus stack";
|
|
3531
3534
|
if (configLogic.production) {
|
|
@@ -3549,7 +3552,9 @@ function popFocus(handle) {
|
|
|
3549
3552
|
throw new Error(outOfOrderErrorMsg);
|
|
3550
3553
|
}
|
|
3551
3554
|
}
|
|
3552
|
-
|
|
3555
|
+
if (restoreFocus) {
|
|
3556
|
+
focus(top?.element);
|
|
3557
|
+
}
|
|
3553
3558
|
}
|
|
3554
3559
|
/**
|
|
3555
3560
|
* Restore the focus on the last element from the stack
|
package/lib/types/index.d.ts
CHANGED
|
@@ -792,10 +792,15 @@ export declare interface AllowListValidatorConfig extends ValidatorOptions {
|
|
|
792
792
|
* Restore the focus on the last element from the stack
|
|
793
793
|
*
|
|
794
794
|
* @public
|
|
795
|
+
* @param handle - The stack handle returned from the corresponding `pushFocus` call.
|
|
796
|
+
* @param options - Options for `popFocus`.
|
|
795
797
|
* @throws Error when pop is called on an empty focus stack
|
|
796
798
|
* @throws Error when pop is called without a valid StackHandle
|
|
797
799
|
*/
|
|
798
|
-
export declare function popFocus(handle: StackHandle
|
|
800
|
+
export declare function popFocus(handle: StackHandle, options?: {
|
|
801
|
+
/** Whether to restore focus after popping it from the stack. Defaults to true. */
|
|
802
|
+
restoreFocus?: boolean;
|
|
803
|
+
}): void;
|
|
799
804
|
|
|
800
805
|
/**
|
|
801
806
|
* A 5-digit string with space separator, for example "932 22"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fkui/logic",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.32.0",
|
|
4
4
|
"description": "Logic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fkui",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"watch": "rollup --config --watch"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@fkui/date": "^6.
|
|
64
|
+
"@fkui/date": "^6.32.0"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">= 20",
|
|
68
68
|
"npm": ">= 7"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "af40bfb2d776b120e7cbfeb5467be058a4384314"
|
|
71
71
|
}
|