@pingux/astro 2.32.0-alpha.8 → 2.32.0-alpha.9
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/hooks/useModalState/index.d.ts +1 -0
- package/lib/cjs/hooks/useModalState/useModalState.d.ts +21 -0
- package/lib/cjs/hooks/useModalState/useModalState.js +0 -9
- package/lib/cjs/hooks/useModalState/useModalState.test.d.ts +1 -0
- package/lib/hooks/useModalState/useModalState.js +0 -10
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useModalState';
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { OverlayTriggerState } from 'react-stately';
|
2
|
+
interface UseModalStateProps {
|
3
|
+
isDefaultOpen?: boolean;
|
4
|
+
isOpen?: boolean;
|
5
|
+
onOpenChange?: (isOpen: boolean) => void;
|
6
|
+
}
|
7
|
+
interface UseModalState {
|
8
|
+
/**
|
9
|
+
* Returns state-related data and functions for use with a Modal component.
|
10
|
+
* @param {Object} [props] Properties provided to the state
|
11
|
+
*
|
12
|
+
* `props.isDefaultOpen`: boolean - Whether the modal is open by default (uncontrolled).
|
13
|
+
* `props.isOpen`: boolean - Whether the modal is currently open (controlled).
|
14
|
+
* `props.onOpenChange`: boolean - Handler that is called when the open state changes.
|
15
|
+
*
|
16
|
+
* @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
|
17
|
+
*/
|
18
|
+
(props?: UseModalStateProps): OverlayTriggerState;
|
19
|
+
}
|
20
|
+
declare const useModalState: UseModalState;
|
21
|
+
export default useModalState;
|
@@ -6,15 +6,6 @@ _Object$defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports["default"] = void 0;
|
8
8
|
var _reactStately = require("react-stately");
|
9
|
-
/**
|
10
|
-
* Returns state-related data and functions for use with a Modal component.
|
11
|
-
* @param {Object} [props] Properties provided to the state
|
12
|
-
* @param {Boolean} [props.isDefaultOpen] Whether the modal is open by default (uncontrolled).
|
13
|
-
* @param {Boolean} [props.isOpen] Whether the modal is currently open (controlled).
|
14
|
-
* @param {Function} [props.onOpenChange] Handler that is called when the open state changes.
|
15
|
-
* `(isOpen: boolean) => void`
|
16
|
-
* @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
|
17
|
-
*/
|
18
9
|
var useModalState = function useModalState() {
|
19
10
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
20
11
|
var isDefaultOpen = props.isDefaultOpen,
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,14 +1,4 @@
|
|
1
1
|
import { useOverlayTriggerState } from 'react-stately';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Returns state-related data and functions for use with a Modal component.
|
5
|
-
* @param {Object} [props] Properties provided to the state
|
6
|
-
* @param {Boolean} [props.isDefaultOpen] Whether the modal is open by default (uncontrolled).
|
7
|
-
* @param {Boolean} [props.isOpen] Whether the modal is currently open (controlled).
|
8
|
-
* @param {Function} [props.onOpenChange] Handler that is called when the open state changes.
|
9
|
-
* `(isOpen: boolean) => void`
|
10
|
-
* @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
|
11
|
-
*/
|
12
2
|
var useModalState = function useModalState() {
|
13
3
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
14
4
|
var isDefaultOpen = props.isDefaultOpen,
|