@pingux/astro 2.32.1-alpha.1 → 2.33.0-alpha.1

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.
@@ -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
- if ((labelRef === null || labelRef === void 0 || (_labelRef$current = labelRef.current) === null || _labelRef$current === void 0 ? void 0 : _labelRef$current.offsetHeight) > (inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.offsetHeight)) {
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 === null || labelRef === void 0 || (_labelRef$current2 = labelRef.current) === null || _labelRef$current2 === void 0 ? void 0 : _labelRef$current2.offsetHeight, inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.offsetHeight]);
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 { default } from './useOverlayPanelState';
@@ -0,0 +1,32 @@
1
+ /// <reference types="react" />
2
+ import { OverlayTriggerState } from 'react-stately';
3
+ interface UseOverlayPanelStateProps {
4
+ isDefaultOpen?: boolean;
5
+ isOpen?: boolean;
6
+ onOpenChange?: (isOpen: boolean) => void;
7
+ transitionDuration?: number;
8
+ }
9
+ export interface UseOverlayPanelReturnState extends OverlayTriggerState {
10
+ isTransitioning?: boolean;
11
+ }
12
+ interface UseOverlayPanelStateReturnValues {
13
+ state: UseOverlayPanelReturnState;
14
+ onClose: (stateProp?: OverlayTriggerState, triggerRef?: React.RefObject<HTMLButtonElement>, onCloseProp?: VoidFunction) => void;
15
+ isTransitioning: boolean;
16
+ }
17
+ interface UseOverlayPanelState {
18
+ /**
19
+ * Returns state-related data and functions for use with a Modal component.
20
+ * @param {Object} [props] Properties provided to the state
21
+ *
22
+ * @param {boolean} [prop.isDefaultOpen] Whether the modal is open by default (uncontrolled).
23
+ * @param {boolean} [prop.isOpen] Whether the modal is currently open (controlled).
24
+ * @param {function} [prop.onOpenChange] Handler that is called when the open state changes.
25
+ * @param {number} [prop.transitionDuration] Number value of the length of the transition in ms.
26
+ *
27
+ * @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
28
+ */
29
+ (props?: UseOverlayPanelStateProps): UseOverlayPanelStateReturnValues;
30
+ }
31
+ declare const useOverlayPanelState: UseOverlayPanelState;
32
+ export default useOverlayPanelState;
@@ -18,16 +18,6 @@ var _reactStately = require("react-stately");
18
18
  var _useMountTransition = _interopRequireDefault(require("../useMountTransition"));
19
19
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
21
- /**
22
- * Returns state-related data and functions for use with a Modal component.
23
- * @param {Object} [props] Properties provided to the state
24
- * @param {Boolean} [props.isDefaultOpen] Whether the modal is open by default (uncontrolled).
25
- * @param {Boolean} [props.isOpen] Whether the modal is currently open (controlled).
26
- * @param {Function} [props.onOpenChange] Handler that is called when the open state changes.
27
- * @param {Number} [props.transitionDuration] Number value of the length of the transition in ms.
28
- * `(isOpen: boolean) => void`
29
- * @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
30
- */
31
21
  var useOverlayPanelState = function useOverlayPanelState() {
32
22
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
33
23
  var isDefaultOpen = props.isDefaultOpen,
@@ -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
- if ((labelRef === null || labelRef === void 0 || (_labelRef$current = labelRef.current) === null || _labelRef$current === void 0 ? void 0 : _labelRef$current.offsetHeight) > (inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.offsetHeight)) {
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 === null || labelRef === void 0 || (_labelRef$current2 = labelRef.current) === null || _labelRef$current2 === void 0 ? void 0 : _labelRef$current2.offsetHeight, inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.offsetHeight]);
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;
@@ -11,17 +11,6 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
11
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
12
12
  import { useOverlayTriggerState } from 'react-stately';
13
13
  import useMountTransition from '../useMountTransition';
14
-
15
- /**
16
- * Returns state-related data and functions for use with a Modal component.
17
- * @param {Object} [props] Properties provided to the state
18
- * @param {Boolean} [props.isDefaultOpen] Whether the modal is open by default (uncontrolled).
19
- * @param {Boolean} [props.isOpen] Whether the modal is currently open (controlled).
20
- * @param {Function} [props.onOpenChange] Handler that is called when the open state changes.
21
- * @param {Number} [props.transitionDuration] Number value of the length of the transition in ms.
22
- * `(isOpen: boolean) => void`
23
- * @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
24
- */
25
14
  var useOverlayPanelState = function useOverlayPanelState() {
26
15
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27
16
  var isDefaultOpen = props.isDefaultOpen,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.32.1-alpha.1",
3
+ "version": "2.33.0-alpha.1",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",