@trackunit/react-modal 1.0.4 → 1.0.6

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
@@ -167,10 +167,11 @@ Modal.displayName = "Modal";
167
167
  * @param {UseModalProps} props - The props for the useModal hook
168
168
  * @returns {*} useModal return
169
169
  */
170
- const useModal = ({ closeOnOutsideClick, bindTo } = {}) => {
170
+ const useModal = ({ closeOnOutsideClick, bindTo, closeOnEsc = true } = {}) => {
171
171
  const modalRef = React.useRef(null);
172
172
  const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal({
173
173
  closeOnOutsideClick,
174
+ closeOnEsc,
174
175
  onPortalClick: ({ target }) => {
175
176
  var _a;
176
177
  if (!closeOnOutsideClick) {
package/index.esm.js CHANGED
@@ -147,10 +147,11 @@ Modal.displayName = "Modal";
147
147
  * @param {UseModalProps} props - The props for the useModal hook
148
148
  * @returns {*} useModal return
149
149
  */
150
- const useModal = ({ closeOnOutsideClick, bindTo } = {}) => {
150
+ const useModal = ({ closeOnOutsideClick, bindTo, closeOnEsc = true } = {}) => {
151
151
  const modalRef = useRef(null);
152
152
  const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal({
153
153
  closeOnOutsideClick,
154
+ closeOnEsc,
154
155
  onPortalClick: ({ target }) => {
155
156
  var _a;
156
157
  if (!closeOnOutsideClick) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-modal",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "react": "18.3.1",
11
11
  "react-useportal": "1.0.18",
12
- "@trackunit/react-components": "^1.0.4",
12
+ "@trackunit/react-components": "^1.0.5",
13
13
  "@trackunit/react-core-hooks": "^1.0.3",
14
14
  "@trackunit/css-class-variance-utilities": "^1.0.1",
15
15
  "@trackunit/i18n-library-translation": "^1.0.3"
@@ -3,6 +3,7 @@ import { ModalProps } from "./Modal";
3
3
  export interface UseModalProps {
4
4
  closeOnOutsideClick?: boolean;
5
5
  bindTo?: HTMLElement;
6
+ closeOnEsc?: boolean;
6
7
  }
7
8
  /**
8
9
  * The useModal component should be used to inform the user of important information.
@@ -10,7 +11,7 @@ export interface UseModalProps {
10
11
  * @param {UseModalProps} props - The props for the useModal hook
11
12
  * @returns {*} useModal return
12
13
  */
13
- export declare const useModal: ({ closeOnOutsideClick, bindTo }?: UseModalProps) => {
14
+ export declare const useModal: ({ closeOnOutsideClick, bindTo, closeOnEsc }?: UseModalProps) => {
14
15
  Modal: {
15
16
  (props: ModalProps): import("react/jsx-runtime").JSX.Element;
16
17
  displayName: string;