@react-stately/overlays 3.6.23 → 3.7.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/dist/import.mjs +2 -2
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -2
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +17 -14
- package/src/index.ts +2 -3
- package/dist/types.d.ts +0 -21
- package/dist/types.d.ts.map +0 -1
- package/dist/useOverlayTriggerState.main.js +0 -50
- package/dist/useOverlayTriggerState.main.js.map +0 -1
- package/dist/useOverlayTriggerState.mjs +0 -45
- package/dist/useOverlayTriggerState.module.js +0 -45
- package/dist/useOverlayTriggerState.module.js.map +0 -1
- package/src/useOverlayTriggerState.ts +0 -56
package/dist/import.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useOverlayTriggerState as $
|
|
1
|
+
import {useOverlayTriggerState as $b832f52a1b6fd394$re_export$useOverlayTriggerState} from "react-stately/useOverlayTriggerState";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,5 +13,5 @@ import {useOverlayTriggerState as $fc909762b330b746$export$61c6a8c84e605fb6} fro
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export {$
|
|
16
|
+
export {$b832f52a1b6fd394$re_export$useOverlayTriggerState as useOverlayTriggerState};
|
|
17
17
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var $
|
|
1
|
+
var $jCCcp$reactstatelyuseOverlayTriggerState = require("react-stately/useOverlayTriggerState");
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
function $parcel$export(e, n, v, s) {
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
$parcel$export(module.exports, "useOverlayTriggerState", ()
|
|
8
|
+
$parcel$export(module.exports, "useOverlayTriggerState", function () { return $jCCcp$reactstatelyuseOverlayTriggerState.useOverlayTriggerState; });
|
|
9
9
|
/*
|
|
10
10
|
* Copyright 2020 Adobe. All rights reserved.
|
|
11
11
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-stately/overlays/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useOverlayTriggerState} from '
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-stately/overlays/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useOverlayTriggerState} from 'react-stately/useOverlayTriggerState';\n\nexport type {OverlayTriggerProps, OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useOverlayTriggerState as $
|
|
1
|
+
import {useOverlayTriggerState as $b832f52a1b6fd394$re_export$useOverlayTriggerState} from "react-stately/useOverlayTriggerState";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,5 +13,5 @@ import {useOverlayTriggerState as $fc909762b330b746$export$61c6a8c84e605fb6} fro
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export {$
|
|
16
|
+
export {$b832f52a1b6fd394$re_export$useOverlayTriggerState as useOverlayTriggerState};
|
|
17
17
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-stately/overlays/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useOverlayTriggerState} from '
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-stately/overlays/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useOverlayTriggerState} from 'react-stately/useOverlayTriggerState';\n\nexport type {OverlayTriggerProps, OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/overlays",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"import": "./dist/import.mjs",
|
|
13
|
+
"require": "./dist/main.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
@@ -26,15 +26,18 @@
|
|
|
26
26
|
"url": "https://github.com/adobe/react-spectrum"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"
|
|
31
|
-
"@swc/helpers": "^0.5.0"
|
|
29
|
+
"@swc/helpers": "^0.5.0",
|
|
30
|
+
"react-stately": "3.46.0"
|
|
32
31
|
},
|
|
33
32
|
"peerDependencies": {
|
|
34
|
-
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
33
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
34
|
+
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"
|
|
39
|
+
"targets": {
|
|
40
|
+
"types": false
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
40
43
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export {useOverlayTriggerState} from '
|
|
13
|
+
export {useOverlayTriggerState} from 'react-stately/useOverlayTriggerState';
|
|
14
14
|
|
|
15
|
-
export type {OverlayTriggerProps} from '
|
|
16
|
-
export type {OverlayTriggerState} from './useOverlayTriggerState';
|
|
15
|
+
export type {OverlayTriggerProps, OverlayTriggerState} from 'react-stately/useOverlayTriggerState';
|
package/dist/types.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { OverlayTriggerProps } from "@react-types/overlays";
|
|
2
|
-
export interface OverlayTriggerState {
|
|
3
|
-
/** Whether the overlay is currently open. */
|
|
4
|
-
readonly isOpen: boolean;
|
|
5
|
-
/** Sets whether the overlay is open. */
|
|
6
|
-
setOpen(isOpen: boolean): void;
|
|
7
|
-
/** Opens the overlay. */
|
|
8
|
-
open(): void;
|
|
9
|
-
/** Closes the overlay. */
|
|
10
|
-
close(): void;
|
|
11
|
-
/** Toggles the overlay's visibility. */
|
|
12
|
-
toggle(): void;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Manages state for an overlay trigger. Tracks whether the overlay is open, and provides
|
|
16
|
-
* methods to toggle this state.
|
|
17
|
-
*/
|
|
18
|
-
export function useOverlayTriggerState(props: OverlayTriggerProps): OverlayTriggerState;
|
|
19
|
-
export type { OverlayTriggerProps } from '@react-types/overlays';
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAgBA;IACE,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,wCAAwC;IACxC,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,yBAAyB;IACzB,IAAI,IAAI,IAAI,CAAC;IACb,0BAA0B;IAC1B,KAAK,IAAI,IAAI,CAAC;IACd,wCAAwC;IACxC,MAAM,IAAI,IAAI,CAAA;CACf;AAED;;;GAGG;AACH,uCAAuC,KAAK,EAAE,mBAAmB,GAAG,mBAAmB,CAsBtF;ACzCD,YAAY,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC","sources":["packages/@react-stately/overlays/src/packages/@react-stately/overlays/src/useOverlayTriggerState.ts","packages/@react-stately/overlays/src/packages/@react-stately/overlays/src/index.ts","packages/@react-stately/overlays/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useOverlayTriggerState} from './useOverlayTriggerState';\n\nexport type {OverlayTriggerProps} from '@react-types/overlays';\nexport type {OverlayTriggerState} from './useOverlayTriggerState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var $62yjz$react = require("react");
|
|
2
|
-
var $62yjz$reactstatelyutils = require("@react-stately/utils");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function $parcel$export(e, n, v, s) {
|
|
6
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
$parcel$export(module.exports, "useOverlayTriggerState", () => $5076d97fb6884665$export$61c6a8c84e605fb6);
|
|
10
|
-
/*
|
|
11
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
-
* governing permissions and limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
function $5076d97fb6884665$export$61c6a8c84e605fb6(props) {
|
|
23
|
-
let [isOpen, setOpen] = (0, $62yjz$reactstatelyutils.useControlledState)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
|
|
24
|
-
const open = (0, $62yjz$react.useCallback)(()=>{
|
|
25
|
-
setOpen(true);
|
|
26
|
-
}, [
|
|
27
|
-
setOpen
|
|
28
|
-
]);
|
|
29
|
-
const close = (0, $62yjz$react.useCallback)(()=>{
|
|
30
|
-
setOpen(false);
|
|
31
|
-
}, [
|
|
32
|
-
setOpen
|
|
33
|
-
]);
|
|
34
|
-
const toggle = (0, $62yjz$react.useCallback)(()=>{
|
|
35
|
-
setOpen(!isOpen);
|
|
36
|
-
}, [
|
|
37
|
-
setOpen,
|
|
38
|
-
isOpen
|
|
39
|
-
]);
|
|
40
|
-
return {
|
|
41
|
-
isOpen: isOpen,
|
|
42
|
-
setOpen: setOpen,
|
|
43
|
-
open: open,
|
|
44
|
-
close: close,
|
|
45
|
-
toggle: toggle
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=useOverlayTriggerState.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAuBM,SAAS,0CAAuB,KAA0B;IAC/D,IAAI,CAAC,QAAQ,QAAQ,GAAG,CAAA,GAAA,2CAAiB,EAAE,MAAM,MAAM,EAAE,MAAM,WAAW,IAAI,OAAO,MAAM,YAAY;IAEvG,MAAM,OAAO,CAAA,GAAA,wBAAU,EAAE;QACvB,QAAQ;IACV,GAAG;QAAC;KAAQ;IAEZ,MAAM,QAAQ,CAAA,GAAA,wBAAU,EAAE;QACxB,QAAQ;IACV,GAAG;QAAC;KAAQ;IAEZ,MAAM,SAAS,CAAA,GAAA,wBAAU,EAAE;QACzB,QAAQ,CAAC;IACX,GAAG;QAAC;QAAS;KAAO;IAEpB,OAAO;gBACL;iBACA;cACA;eACA;gBACA;IACF;AACF","sources":["packages/@react-stately/overlays/src/useOverlayTriggerState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {OverlayTriggerProps} from '@react-types/overlays';\nimport {useCallback} from 'react';\nimport {useControlledState} from '@react-stately/utils';\n\nexport interface OverlayTriggerState {\n /** Whether the overlay is currently open. */\n readonly isOpen: boolean,\n /** Sets whether the overlay is open. */\n setOpen(isOpen: boolean): void,\n /** Opens the overlay. */\n open(): void,\n /** Closes the overlay. */\n close(): void,\n /** Toggles the overlay's visibility. */\n toggle(): void\n}\n\n/**\n * Manages state for an overlay trigger. Tracks whether the overlay is open, and provides\n * methods to toggle this state.\n */\nexport function useOverlayTriggerState(props: OverlayTriggerProps): OverlayTriggerState {\n let [isOpen, setOpen] = useControlledState(props.isOpen, props.defaultOpen || false, props.onOpenChange);\n\n const open = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const close = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const toggle = useCallback(() => {\n setOpen(!isOpen);\n }, [setOpen, isOpen]);\n\n return {\n isOpen,\n setOpen,\n open,\n close,\n toggle\n };\n}\n"],"names":[],"version":3,"file":"useOverlayTriggerState.main.js.map"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {useCallback as $hnMvi$useCallback} from "react";
|
|
2
|
-
import {useControlledState as $hnMvi$useControlledState} from "@react-stately/utils";
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
-
* governing permissions and limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
|
|
17
|
-
let [isOpen, setOpen] = (0, $hnMvi$useControlledState)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
|
|
18
|
-
const open = (0, $hnMvi$useCallback)(()=>{
|
|
19
|
-
setOpen(true);
|
|
20
|
-
}, [
|
|
21
|
-
setOpen
|
|
22
|
-
]);
|
|
23
|
-
const close = (0, $hnMvi$useCallback)(()=>{
|
|
24
|
-
setOpen(false);
|
|
25
|
-
}, [
|
|
26
|
-
setOpen
|
|
27
|
-
]);
|
|
28
|
-
const toggle = (0, $hnMvi$useCallback)(()=>{
|
|
29
|
-
setOpen(!isOpen);
|
|
30
|
-
}, [
|
|
31
|
-
setOpen,
|
|
32
|
-
isOpen
|
|
33
|
-
]);
|
|
34
|
-
return {
|
|
35
|
-
isOpen: isOpen,
|
|
36
|
-
setOpen: setOpen,
|
|
37
|
-
open: open,
|
|
38
|
-
close: close,
|
|
39
|
-
toggle: toggle
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export {$fc909762b330b746$export$61c6a8c84e605fb6 as useOverlayTriggerState};
|
|
45
|
-
//# sourceMappingURL=useOverlayTriggerState.module.js.map
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {useCallback as $hnMvi$useCallback} from "react";
|
|
2
|
-
import {useControlledState as $hnMvi$useControlledState} from "@react-stately/utils";
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
-
* governing permissions and limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
|
|
17
|
-
let [isOpen, setOpen] = (0, $hnMvi$useControlledState)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
|
|
18
|
-
const open = (0, $hnMvi$useCallback)(()=>{
|
|
19
|
-
setOpen(true);
|
|
20
|
-
}, [
|
|
21
|
-
setOpen
|
|
22
|
-
]);
|
|
23
|
-
const close = (0, $hnMvi$useCallback)(()=>{
|
|
24
|
-
setOpen(false);
|
|
25
|
-
}, [
|
|
26
|
-
setOpen
|
|
27
|
-
]);
|
|
28
|
-
const toggle = (0, $hnMvi$useCallback)(()=>{
|
|
29
|
-
setOpen(!isOpen);
|
|
30
|
-
}, [
|
|
31
|
-
setOpen,
|
|
32
|
-
isOpen
|
|
33
|
-
]);
|
|
34
|
-
return {
|
|
35
|
-
isOpen: isOpen,
|
|
36
|
-
setOpen: setOpen,
|
|
37
|
-
open: open,
|
|
38
|
-
close: close,
|
|
39
|
-
toggle: toggle
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export {$fc909762b330b746$export$61c6a8c84e605fb6 as useOverlayTriggerState};
|
|
45
|
-
//# sourceMappingURL=useOverlayTriggerState.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAuBM,SAAS,0CAAuB,KAA0B;IAC/D,IAAI,CAAC,QAAQ,QAAQ,GAAG,CAAA,GAAA,yBAAiB,EAAE,MAAM,MAAM,EAAE,MAAM,WAAW,IAAI,OAAO,MAAM,YAAY;IAEvG,MAAM,OAAO,CAAA,GAAA,kBAAU,EAAE;QACvB,QAAQ;IACV,GAAG;QAAC;KAAQ;IAEZ,MAAM,QAAQ,CAAA,GAAA,kBAAU,EAAE;QACxB,QAAQ;IACV,GAAG;QAAC;KAAQ;IAEZ,MAAM,SAAS,CAAA,GAAA,kBAAU,EAAE;QACzB,QAAQ,CAAC;IACX,GAAG;QAAC;QAAS;KAAO;IAEpB,OAAO;gBACL;iBACA;cACA;eACA;gBACA;IACF;AACF","sources":["packages/@react-stately/overlays/src/useOverlayTriggerState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {OverlayTriggerProps} from '@react-types/overlays';\nimport {useCallback} from 'react';\nimport {useControlledState} from '@react-stately/utils';\n\nexport interface OverlayTriggerState {\n /** Whether the overlay is currently open. */\n readonly isOpen: boolean,\n /** Sets whether the overlay is open. */\n setOpen(isOpen: boolean): void,\n /** Opens the overlay. */\n open(): void,\n /** Closes the overlay. */\n close(): void,\n /** Toggles the overlay's visibility. */\n toggle(): void\n}\n\n/**\n * Manages state for an overlay trigger. Tracks whether the overlay is open, and provides\n * methods to toggle this state.\n */\nexport function useOverlayTriggerState(props: OverlayTriggerProps): OverlayTriggerState {\n let [isOpen, setOpen] = useControlledState(props.isOpen, props.defaultOpen || false, props.onOpenChange);\n\n const open = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const close = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const toggle = useCallback(() => {\n setOpen(!isOpen);\n }, [setOpen, isOpen]);\n\n return {\n isOpen,\n setOpen,\n open,\n close,\n toggle\n };\n}\n"],"names":[],"version":3,"file":"useOverlayTriggerState.module.js.map"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {OverlayTriggerProps} from '@react-types/overlays';
|
|
14
|
-
import {useCallback} from 'react';
|
|
15
|
-
import {useControlledState} from '@react-stately/utils';
|
|
16
|
-
|
|
17
|
-
export interface OverlayTriggerState {
|
|
18
|
-
/** Whether the overlay is currently open. */
|
|
19
|
-
readonly isOpen: boolean,
|
|
20
|
-
/** Sets whether the overlay is open. */
|
|
21
|
-
setOpen(isOpen: boolean): void,
|
|
22
|
-
/** Opens the overlay. */
|
|
23
|
-
open(): void,
|
|
24
|
-
/** Closes the overlay. */
|
|
25
|
-
close(): void,
|
|
26
|
-
/** Toggles the overlay's visibility. */
|
|
27
|
-
toggle(): void
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Manages state for an overlay trigger. Tracks whether the overlay is open, and provides
|
|
32
|
-
* methods to toggle this state.
|
|
33
|
-
*/
|
|
34
|
-
export function useOverlayTriggerState(props: OverlayTriggerProps): OverlayTriggerState {
|
|
35
|
-
let [isOpen, setOpen] = useControlledState(props.isOpen, props.defaultOpen || false, props.onOpenChange);
|
|
36
|
-
|
|
37
|
-
const open = useCallback(() => {
|
|
38
|
-
setOpen(true);
|
|
39
|
-
}, [setOpen]);
|
|
40
|
-
|
|
41
|
-
const close = useCallback(() => {
|
|
42
|
-
setOpen(false);
|
|
43
|
-
}, [setOpen]);
|
|
44
|
-
|
|
45
|
-
const toggle = useCallback(() => {
|
|
46
|
-
setOpen(!isOpen);
|
|
47
|
-
}, [setOpen, isOpen]);
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
isOpen,
|
|
51
|
-
setOpen,
|
|
52
|
-
open,
|
|
53
|
-
close,
|
|
54
|
-
toggle
|
|
55
|
-
};
|
|
56
|
-
}
|