@skedulo/sked-ui 21.0.0-alpha.6 → 21.0.0-alpha.7

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.
@@ -4,5 +4,6 @@ export declare const usePopOut: ({ delayShow, preventShow, onClose, openOnMount
4
4
  visible: boolean;
5
5
  openPopOut: () => void;
6
6
  closePopOut: () => void;
7
+ togglePopOut: () => void;
7
8
  };
8
9
  export {};
package/dist/index.js CHANGED
@@ -10514,7 +10514,7 @@ var PopOut = function PopOut(props) {
10514
10514
  }),
10515
10515
  visible = _usePopOut.visible,
10516
10516
  closePopOut = _usePopOut.closePopOut,
10517
- openPopOut = _usePopOut.openPopOut;
10517
+ togglePopOut = _usePopOut.togglePopOut;
10518
10518
 
10519
10519
  var contentRef = react__WEBPACK_IMPORTED_MODULE_2__["useRef"](null);
10520
10520
  var triggerRef = react__WEBPACK_IMPORTED_MODULE_2__["useRef"](null);
@@ -10525,15 +10525,6 @@ var PopOut = function PopOut(props) {
10525
10525
 
10526
10526
  return null;
10527
10527
  }, [visible, triggerRef.current]);
10528
-
10529
- var onTriggerClick = function onTriggerClick() {
10530
- if (visible && closeOnFirstClick) {
10531
- closePopOut();
10532
- } else if (!visible) {
10533
- openPopOut();
10534
- }
10535
- };
10536
-
10537
10528
  react__WEBPACK_IMPORTED_MODULE_2__["useEffect"](function () {
10538
10529
  if (!closeOnScroll || !triggerRect || !triggerRef) {
10539
10530
  return null;
@@ -10593,7 +10584,7 @@ var PopOut = function PopOut(props) {
10593
10584
  ref: triggerRef,
10594
10585
  className: "sk-w-full sk-h-full",
10595
10586
  "data-sk-name": "trigger-container",
10596
- onClick: onTriggerClick
10587
+ onClick: togglePopOut
10597
10588
  }, trigger(visible));
10598
10589
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__["createElement"](_PopOutBase__WEBPACK_IMPORTED_MODULE_3__["PopOutBase"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({
10599
10590
  placement: placement,
@@ -14493,13 +14484,17 @@ var usePopOut = function usePopOut(_ref) {
14493
14484
  onClose();
14494
14485
  }
14495
14486
  }, [isOpen, onClose]);
14496
- var openPopOut = react__WEBPACK_IMPORTED_MODULE_1__["useCallback"](function () {
14497
- setIsOpen(true);
14498
- }, [isOpen]);
14487
+
14488
+ var openPopOut = function openPopOut() {
14489
+ return setIsOpen(true);
14490
+ };
14491
+
14492
+ var togglePopOut = isOpen ? closePopOut : openPopOut;
14499
14493
  return {
14500
14494
  visible: visible,
14501
14495
  openPopOut: openPopOut,
14502
- closePopOut: closePopOut
14496
+ closePopOut: closePopOut,
14497
+ togglePopOut: togglePopOut
14503
14498
  };
14504
14499
  };
14505
14500
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skedulo/sked-ui",
3
- "version": "21.0.0-alpha.6",
3
+ "version": "21.0.0-alpha.7",
4
4
  "license": "UNLICENSED",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",