@react-hive/honey-layout 17.4.0 → 17.5.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/components/HoneyBox/HoneyBox.d.ts +1 -1
- package/dist/components/HoneyFlex/HoneyFlex.d.ts +1 -1
- package/dist/components/HoneyGrid/HoneyGridStyled.d.ts +1 -1
- package/dist/components/HoneyGridColumn/HoneyGridColumnStyled.d.ts +1 -1
- package/dist/components/HoneyList/HoneyListStyled.d.ts +1 -1
- package/dist/components/HoneyOverlay.d.ts +56 -13
- package/dist/components/HoneyPopup/HoneyPopupStyled.d.ts +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +43 -15
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.dev.cjs
CHANGED
|
@@ -4829,9 +4829,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4829
4829
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
4830
4830
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
4831
4831
|
/* harmony import */ var _react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @react-hive/honey-utils */ "./node_modules/.pnpm/@react-hive+honey-utils@4.0.0/node_modules/@react-hive/honey-utils/dist/index.mjs");
|
|
4832
|
-
/* harmony import */ var
|
|
4833
|
-
/* harmony import */ var
|
|
4834
|
-
/* harmony import */ var
|
|
4832
|
+
/* harmony import */ var _react_hive_honey_hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @react-hive/honey-hooks */ "./node_modules/.pnpm/@react-hive+honey-hooks@3.1.0_react@19.2.7/node_modules/@react-hive/honey-hooks/dist/index.mjs");
|
|
4833
|
+
/* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../hooks */ "./src/hooks/index.ts");
|
|
4834
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helpers */ "./src/helpers/index.ts");
|
|
4835
|
+
/* harmony import */ var _HoneyFlex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./HoneyFlex */ "./src/components/HoneyFlex/index.ts");
|
|
4836
|
+
|
|
4835
4837
|
|
|
4836
4838
|
|
|
4837
4839
|
|
|
@@ -4841,9 +4843,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4841
4843
|
/**
|
|
4842
4844
|
* A reusable overlay component integrated with the `HoneyLayoutProvider` system.
|
|
4843
4845
|
*
|
|
4844
|
-
*
|
|
4846
|
+
* The component registers itself with the overlay system when active, provides
|
|
4847
|
+
* overlay context to render-function children, and disables interaction with its
|
|
4848
|
+
* content when inactive by applying the `inert` attribute.
|
|
4849
|
+
*
|
|
4850
|
+
* By default, releasing the Escape key deactivates the overlay. Custom key handling
|
|
4851
|
+
* can be provided through `onKeyUp`.
|
|
4845
4852
|
*
|
|
4846
|
-
* @param props -
|
|
4853
|
+
* @param props - Overlay component props.
|
|
4847
4854
|
*
|
|
4848
4855
|
* @example
|
|
4849
4856
|
* ```tsx
|
|
@@ -4859,21 +4866,42 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4859
4866
|
* )}
|
|
4860
4867
|
* </HoneyOverlay>
|
|
4861
4868
|
* ```
|
|
4869
|
+
*
|
|
4870
|
+
* @example
|
|
4871
|
+
* ```tsx
|
|
4872
|
+
* <HoneyOverlay
|
|
4873
|
+
* active={isOpen}
|
|
4874
|
+
* onDeactivate={() => setIsOpen(false)}
|
|
4875
|
+
* onKeyUp={(keyCode) => {
|
|
4876
|
+
* if (keyCode === 'Escape') {
|
|
4877
|
+
* setIsOpen(false);
|
|
4878
|
+
* }
|
|
4879
|
+
* }}
|
|
4880
|
+
* >
|
|
4881
|
+
* Overlay content
|
|
4882
|
+
* </HoneyOverlay>
|
|
4883
|
+
* ```
|
|
4862
4884
|
*/
|
|
4863
|
-
const HoneyOverlay = ({ ref, children, active, overlayId, onDeactivate, ...props }) => {
|
|
4864
|
-
const
|
|
4885
|
+
const HoneyOverlay = ({ ref, children, active, overlayId, onDeactivate, onKeyUp, ...props }) => {
|
|
4886
|
+
const onKeyUpRef = (0,_react_hive_honey_hooks__WEBPACK_IMPORTED_MODULE_3__.useHoneyLatest)(onKeyUp);
|
|
4887
|
+
const onDeactivateRef = (0,_react_hive_honey_hooks__WEBPACK_IMPORTED_MODULE_3__.useHoneyLatest)(onDeactivate);
|
|
4888
|
+
const handleKeyUp = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((keyCode, ...args) => {
|
|
4889
|
+
if (onKeyUpRef.current) {
|
|
4890
|
+
onKeyUpRef.current(keyCode, ...args);
|
|
4891
|
+
}
|
|
4892
|
+
else if (keyCode === 'Escape') {
|
|
4893
|
+
onDeactivateRef.current();
|
|
4894
|
+
}
|
|
4895
|
+
}, []);
|
|
4896
|
+
const overlay = (0,_hooks__WEBPACK_IMPORTED_MODULE_4__.useRegisterHoneyOverlay)(active, {
|
|
4865
4897
|
id: overlayId,
|
|
4866
|
-
onKeyUp:
|
|
4867
|
-
if (keyCode === 'Escape') {
|
|
4868
|
-
onDeactivate();
|
|
4869
|
-
}
|
|
4870
|
-
}, [onDeactivate]),
|
|
4898
|
+
onKeyUp: handleKeyUp,
|
|
4871
4899
|
});
|
|
4872
|
-
const mergedRef = (0,
|
|
4873
|
-
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(
|
|
4900
|
+
const mergedRef = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)(overlay?.setContainerRef, ref);
|
|
4901
|
+
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_HoneyFlex__WEBPACK_IMPORTED_MODULE_6__.HoneyFlex, { ref: mergedRef, inert: !active, ...props, children: (0,_react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_2__.invokeIfFunction)(children, {
|
|
4874
4902
|
overlay,
|
|
4875
4903
|
isActive: active,
|
|
4876
|
-
deactivateOverlay:
|
|
4904
|
+
deactivateOverlay: onDeactivateRef.current,
|
|
4877
4905
|
}) }));
|
|
4878
4906
|
};
|
|
4879
4907
|
|