@trackunit/react-modal 0.0.56 → 0.0.59

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
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var jsxRuntime = require('react/jsx-runtime');
6
4
  var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
7
5
  var reactComponents = require('@trackunit/react-components');
@@ -10,10 +8,7 @@ var React = require('react');
10
8
  var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
11
9
  var usePortal = require('react-useportal');
12
10
 
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
-
15
- function _interopNamespace(e) {
16
- if (e && e.__esModule) return e;
11
+ function _interopNamespaceDefault(e) {
17
12
  var n = Object.create(null);
18
13
  if (e) {
19
14
  Object.keys(e).forEach(function (k) {
@@ -26,12 +21,11 @@ function _interopNamespace(e) {
26
21
  }
27
22
  });
28
23
  }
29
- n["default"] = e;
24
+ n.default = e;
30
25
  return Object.freeze(n);
31
26
  }
32
27
 
33
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
34
- var usePortal__default = /*#__PURE__*/_interopDefaultLegacy(usePortal);
28
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
35
29
 
36
30
  var defaultTranslations = {
37
31
 
@@ -175,7 +169,7 @@ Modal.displayName = "Modal";
175
169
  */
176
170
  const useModal = ({ closeOnOutsideClick } = {}) => {
177
171
  const modalRef = React.useRef(null);
178
- const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal__default["default"]({
172
+ const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal({
179
173
  closeOnOutsideClick,
180
174
  onPortalClick: ({ target }) => {
181
175
  var _a;
@@ -189,7 +183,7 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
189
183
  }
190
184
  },
191
185
  });
192
- const PortalWrapper = (props) => (jsxRuntime.jsx(Portal, { children: jsxRuntime.jsx(Modal, Object.assign({ isOpen: isOpen, ref: modalRef }, props)) }));
186
+ const PortalWrapper = (props) => (jsxRuntime.jsx(Portal, { children: jsxRuntime.jsx(Modal, { isOpen: isOpen, ref: modalRef, ...props }) }));
193
187
  PortalWrapper.displayName = "Modal";
194
188
  const WrappedModal = React.useCallback(PortalWrapper, [Portal, isOpen]);
195
189
  return {
package/index.esm.js CHANGED
@@ -163,7 +163,7 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
163
163
  }
164
164
  },
165
165
  });
166
- const PortalWrapper = (props) => (jsx(Portal, { children: jsx(Modal, Object.assign({ isOpen: isOpen, ref: modalRef }, props)) }));
166
+ const PortalWrapper = (props) => (jsx(Portal, { children: jsx(Modal, { isOpen: isOpen, ref: modalRef, ...props }) }));
167
167
  PortalWrapper.displayName = "Modal";
168
168
  const WrappedModal = useCallback(PortalWrapper, [Portal, isOpen]);
169
169
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-modal",
3
- "version": "0.0.56",
3
+ "version": "0.0.59",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,11 +9,12 @@
9
9
  "dependencies": {
10
10
  "@trackunit/i18n-library-translation": "*",
11
11
  "@trackunit/react-components": "*",
12
- "react": "^18.2.0",
12
+ "react": "18.3.1",
13
13
  "@trackunit/css-class-variance-utilities": "*",
14
14
  "react-useportal": "1.0.18",
15
15
  "@trackunit/react-core-hooks": "*"
16
16
  },
17
17
  "module": "./index.esm.js",
18
- "main": "./index.cjs.js"
19
- }
18
+ "main": "./index.cjs.js",
19
+ "types": "./index.esm.d.ts"
20
+ }
@@ -1,15 +1,14 @@
1
- /// <reference types="react" />
2
1
  import { Meta, StoryObj } from "@storybook/react";
3
2
  import { Modal, ModalProps } from "./Modal";
4
3
  type Story = StoryObj<typeof Modal>;
5
4
  declare const meta: Meta<typeof Modal>;
6
5
  export default meta;
7
- export declare const packageName: () => JSX.Element;
8
- export declare const OverviewTemplate: (props: ModalProps) => JSX.Element;
6
+ export declare const packageName: () => import("react/jsx-runtime").JSX.Element;
7
+ export declare const OverviewTemplate: (props: ModalProps) => import("react/jsx-runtime").JSX.Element;
9
8
  export declare const Default: Story;
10
- export declare const IncorrectUsageErrorModal: (closeOnOutsideClick: true) => JSX.Element;
11
- export declare const CorrectUsagePrimaryAction: (closeOnOutsideClick: true) => JSX.Element;
12
- export declare const IncorrectUsageLongText: (closeOnOutsideClick: true) => JSX.Element;
13
- export declare const CorrectUsageImportantAction: (closeOnOutsideClick: true) => JSX.Element;
14
- export declare const IncorrectAccessibility: (closeOnOutsideClick: false) => JSX.Element;
15
- export declare const CorrectAccessibility: (closeOnOutsideClick: true) => JSX.Element;
9
+ export declare const IncorrectUsageErrorModal: (closeOnOutsideClick: true) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const CorrectUsagePrimaryAction: (closeOnOutsideClick: true) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const IncorrectUsageLongText: (closeOnOutsideClick: true) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const CorrectUsageImportantAction: (closeOnOutsideClick: true) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const IncorrectAccessibility: (closeOnOutsideClick: false) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const CorrectAccessibility: (closeOnOutsideClick: true) => import("react/jsx-runtime").JSX.Element;
@@ -11,4 +11,4 @@ export interface ModalBackdropProps {
11
11
  * @param {ModalBackdropProps} props - The props for the ModalBackdrop component
12
12
  * @returns {JSX.Element} ModalBackdrop component
13
13
  */
14
- export declare const ModalBackdrop: ({ children, isVisible, onClick, noShadow }: ModalBackdropProps) => JSX.Element;
14
+ export declare const ModalBackdrop: ({ children, isVisible, onClick, noShadow }: ModalBackdropProps) => import("react/jsx-runtime").JSX.Element;
@@ -11,7 +11,7 @@ export interface UseModalProps {
11
11
  */
12
12
  export declare const useModal: ({ closeOnOutsideClick }?: UseModalProps) => {
13
13
  Modal: {
14
- (props: ModalProps): JSX.Element;
14
+ (props: ModalProps): import("react/jsx-runtime").JSX.Element;
15
15
  displayName: string;
16
16
  };
17
17
  toggleModal: (e?: BaseSyntheticEvent) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { NamespaceTransProps, TransForLibs, TranslationResource } from "@trackunit/i18n-library-translation";
3
2
  import defaultTranslations from "./locales/en/translation.json";
4
3
  /** A type for all available translation keys in this library */
@@ -27,7 +26,7 @@ export type TranslationFunction = TransForLibs<TranslationKeys>;
27
26
  /**
28
27
  * Trans for this specific library.
29
28
  */
30
- export declare const Trans: (props: NamespaceTransProps<TranslationKeys>) => JSX.Element;
29
+ export declare const Trans: (props: NamespaceTransProps<TranslationKeys>) => import("react/jsx-runtime").JSX.Element;
31
30
  /**
32
31
  * Registers the translations for this library
33
32
  */
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;
@@ -4,4 +4,4 @@ var translation = {
4
4
 
5
5
  };
6
6
 
7
- exports["default"] = translation;
7
+ exports.default = translation;