@pingux/astro 2.32.1-alpha.0 → 2.33.0-alpha.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/hooks/useLabelHeight/index.d.ts +1 -0
- package/lib/cjs/hooks/useLabelHeight/useLabelHeight.d.ts +12 -0
- package/lib/cjs/hooks/useLabelHeight/useLabelHeight.js +4 -3
- package/lib/cjs/hooks/useNavBarPress/index.d.ts +1 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.d.ts +20 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.js +0 -8
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.test.d.ts +1 -0
- package/lib/hooks/useLabelHeight/useLabelHeight.js +4 -3
- package/lib/hooks/useNavBarPress/useNavBarPress.js +0 -8
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useLabelHeight';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface UseLabelHeightProps {
|
3
|
+
labelRef: React.RefObject<HTMLLabelElement>;
|
4
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
5
|
+
}
|
6
|
+
interface UseLabelHeight {
|
7
|
+
({ labelRef, inputRef }: UseLabelHeightProps): {
|
8
|
+
isLabelHigher: boolean;
|
9
|
+
};
|
10
|
+
}
|
11
|
+
declare const useLabelHeight: UseLabelHeight;
|
12
|
+
export default useLabelHeight;
|
@@ -9,7 +9,6 @@ exports["default"] = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
10
10
|
var _react = require("react");
|
11
11
|
var useLabelHeight = function useLabelHeight(_ref) {
|
12
|
-
var _labelRef$current2, _inputRef$current2;
|
13
12
|
var labelRef = _ref.labelRef,
|
14
13
|
inputRef = _ref.inputRef;
|
15
14
|
var _useState = (0, _react.useState)(false),
|
@@ -18,12 +17,14 @@ var useLabelHeight = function useLabelHeight(_ref) {
|
|
18
17
|
setIsLabelHigher = _useState2[1];
|
19
18
|
(0, _react.useEffect)(function () {
|
20
19
|
var _labelRef$current, _inputRef$current;
|
21
|
-
|
20
|
+
var labelOffsetHeight = (labelRef === null || labelRef === void 0 || (_labelRef$current = labelRef.current) === null || _labelRef$current === void 0 ? void 0 : _labelRef$current.offsetHeight) || 0;
|
21
|
+
var inputOffsetHeight = (inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.offsetHeight) || 0;
|
22
|
+
if (labelOffsetHeight > inputOffsetHeight) {
|
22
23
|
setIsLabelHigher(true);
|
23
24
|
} else {
|
24
25
|
setIsLabelHigher(false);
|
25
26
|
}
|
26
|
-
}, [labelRef
|
27
|
+
}, [labelRef, inputRef]);
|
27
28
|
return {
|
28
29
|
isLabelHigher: isLabelHigher
|
29
30
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useNavBarPress';
|
@@ -0,0 +1,20 @@
|
|
1
|
+
interface UseNavBarPress {
|
2
|
+
/**
|
3
|
+
* A custom hook that will call an onPressCallback function, if the function is provided.
|
4
|
+
* @param {Object} params The accepted parameters object
|
5
|
+
* @param {string} props.key The unique identifier that is assigned to the element being pressed
|
6
|
+
* @param {Object} state The state object tracking selected keys
|
7
|
+
* @param {function} state.setSelectedKey The function that sets the selected keys
|
8
|
+
* @callback props.onPressCallback The callback that will be called only if provided
|
9
|
+
*/
|
10
|
+
(params: {
|
11
|
+
key: string;
|
12
|
+
onPressCallback?: () => void;
|
13
|
+
}, state: {
|
14
|
+
setSelectedKey: (key: string) => void;
|
15
|
+
}): {
|
16
|
+
onNavPress: () => void;
|
17
|
+
};
|
18
|
+
}
|
19
|
+
declare const useNavBarPress: UseNavBarPress;
|
20
|
+
export default useNavBarPress;
|
@@ -5,14 +5,6 @@ _Object$defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports["default"] = void 0;
|
8
|
-
/**
|
9
|
-
* A custom hook that will call an onPressCallback function, if the function is provided.
|
10
|
-
* @param {Object} params The accepted parameters object
|
11
|
-
* @param {string} props.key The unique identifier that is assigned to the element being pressed
|
12
|
-
* @param {Object} state The state object tracking selected keys
|
13
|
-
* @param {function} state.setSelectedKey The function that sets the selected keys
|
14
|
-
* @callback props.onPressCallback The callback that will be called only if provided
|
15
|
-
*/
|
16
8
|
var useNavBarPress = function useNavBarPress(_ref, state) {
|
17
9
|
var key = _ref.key,
|
18
10
|
onPressCallback = _ref.onPressCallback;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
2
|
import { useEffect, useState } from 'react';
|
3
3
|
var useLabelHeight = function useLabelHeight(_ref) {
|
4
|
-
var _labelRef$current2, _inputRef$current2;
|
5
4
|
var labelRef = _ref.labelRef,
|
6
5
|
inputRef = _ref.inputRef;
|
7
6
|
var _useState = useState(false),
|
@@ -10,12 +9,14 @@ var useLabelHeight = function useLabelHeight(_ref) {
|
|
10
9
|
setIsLabelHigher = _useState2[1];
|
11
10
|
useEffect(function () {
|
12
11
|
var _labelRef$current, _inputRef$current;
|
13
|
-
|
12
|
+
var labelOffsetHeight = (labelRef === null || labelRef === void 0 || (_labelRef$current = labelRef.current) === null || _labelRef$current === void 0 ? void 0 : _labelRef$current.offsetHeight) || 0;
|
13
|
+
var inputOffsetHeight = (inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.offsetHeight) || 0;
|
14
|
+
if (labelOffsetHeight > inputOffsetHeight) {
|
14
15
|
setIsLabelHigher(true);
|
15
16
|
} else {
|
16
17
|
setIsLabelHigher(false);
|
17
18
|
}
|
18
|
-
}, [labelRef
|
19
|
+
}, [labelRef, inputRef]);
|
19
20
|
return {
|
20
21
|
isLabelHigher: isLabelHigher
|
21
22
|
};
|
@@ -1,11 +1,3 @@
|
|
1
|
-
/**
|
2
|
-
* A custom hook that will call an onPressCallback function, if the function is provided.
|
3
|
-
* @param {Object} params The accepted parameters object
|
4
|
-
* @param {string} props.key The unique identifier that is assigned to the element being pressed
|
5
|
-
* @param {Object} state The state object tracking selected keys
|
6
|
-
* @param {function} state.setSelectedKey The function that sets the selected keys
|
7
|
-
* @callback props.onPressCallback The callback that will be called only if provided
|
8
|
-
*/
|
9
1
|
var useNavBarPress = function useNavBarPress(_ref, state) {
|
10
2
|
var key = _ref.key,
|
11
3
|
onPressCallback = _ref.onPressCallback;
|