@trackunit/react-modal 1.8.147 → 1.8.153

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/index.cjs.js CHANGED
@@ -7,7 +7,7 @@ var reactComponents = require('@trackunit/react-components');
7
7
  var uiDesignTokens = require('@trackunit/ui-design-tokens');
8
8
  var react = require('react');
9
9
  var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
10
- var reactCoreHooks = require('@trackunit/react-core-hooks');
10
+ var reactCoreContextsApi = require('@trackunit/react-core-contexts-api');
11
11
 
12
12
  var defaultTranslations = {
13
13
 
@@ -350,7 +350,11 @@ const useModal = (props = {}) => {
350
350
  };
351
351
  const useModalInner = ({ isOpen, setIsOpen, onOpenChange, rootElement, closeOnOutsideClick = true, closeOnEsc = true, onClose, onOpen, ref: customRef, }) => {
352
352
  const ref = react.useRef(null);
353
- const { openModal, closeModal } = reactCoreHooks.useModalDialogContext();
353
+ const modalDialogContext = react.useContext(reactCoreContextsApi.ModalDialogContext);
354
+ if (!modalDialogContext) {
355
+ throw new Error("useModal must be used within the ModalDialogContextProvider");
356
+ }
357
+ const { openModal, closeModal } = modalDialogContext;
354
358
  const { refs, floatingStyles, context } = react$1.useFloating({
355
359
  open: isOpen,
356
360
  onOpenChange: (bool, event, openChangeReason) => {
package/index.esm.js CHANGED
@@ -3,9 +3,9 @@ import { registerTranslations } from '@trackunit/i18n-library-translation';
3
3
  import { FloatingFocusManager, useFloating, autoUpdate, shift, useDismiss, useInteractions } from '@floating-ui/react';
4
4
  import { Portal, Card, Button, Heading, Text, IconButton, Icon } from '@trackunit/react-components';
5
5
  import { zIndex } from '@trackunit/ui-design-tokens';
6
- import { useRef, useLayoutEffect, forwardRef, useState, useEffect, useCallback, useMemo } from 'react';
6
+ import { useRef, useLayoutEffect, forwardRef, useState, useContext, useEffect, useCallback, useMemo } from 'react';
7
7
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
8
- import { useModalDialogContext } from '@trackunit/react-core-hooks';
8
+ import { ModalDialogContext } from '@trackunit/react-core-contexts-api';
9
9
 
10
10
  var defaultTranslations = {
11
11
 
@@ -348,7 +348,11 @@ const useModal = (props = {}) => {
348
348
  };
349
349
  const useModalInner = ({ isOpen, setIsOpen, onOpenChange, rootElement, closeOnOutsideClick = true, closeOnEsc = true, onClose, onOpen, ref: customRef, }) => {
350
350
  const ref = useRef(null);
351
- const { openModal, closeModal } = useModalDialogContext();
351
+ const modalDialogContext = useContext(ModalDialogContext);
352
+ if (!modalDialogContext) {
353
+ throw new Error("useModal must be used within the ModalDialogContextProvider");
354
+ }
355
+ const { openModal, closeModal } = modalDialogContext;
352
356
  const { refs, floatingStyles, context } = useFloating({
353
357
  open: isOpen,
354
358
  onOpenChange: (bool, event, openChangeReason) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-modal",
3
- "version": "1.8.147",
3
+ "version": "1.8.153",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,13 +8,13 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "react": "19.0.0",
11
- "@trackunit/react-components": "1.10.83",
12
- "@trackunit/react-core-hooks": "1.7.121",
13
- "@trackunit/css-class-variance-utilities": "1.7.107",
14
- "@trackunit/i18n-library-translation": "1.7.128",
11
+ "@trackunit/react-components": "1.10.89",
12
+ "@trackunit/css-class-variance-utilities": "1.7.113",
13
+ "@trackunit/i18n-library-translation": "1.7.134",
15
14
  "@floating-ui/react": "^0.26.25",
16
15
  "@floating-ui/react-dom": "2.1.2",
17
- "@trackunit/ui-design-tokens": "1.7.107"
16
+ "@trackunit/ui-design-tokens": "1.7.113",
17
+ "@trackunit/react-core-contexts-api": "1.8.82"
18
18
  },
19
19
  "module": "./index.esm.js",
20
20
  "main": "./index.cjs.js",