@alfalab/core-components-base-modal
Advanced tools
Comparing version 5.0.4 to 5.0.5
/// <reference types="react-transition-group" /> | ||
/// <reference types="react" /> | ||
import React from 'react'; | ||
import { MouseEvent, KeyboardEvent, ReactNode, Ref, FC, MutableRefObject } from "react"; | ||
import { FC, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref } from "react"; | ||
import { TransitionProps } from 'react-transition-group/Transition'; | ||
import { BackdropProps } from "@alfalab/core-components-backdrop"; | ||
import { PortalProps } from "@alfalab/core-components-portal"; | ||
import { BackdropProps } from "@alfalab/core-components-backdrop"; | ||
type BaseModalProps = { | ||
@@ -9,0 +9,0 @@ /** |
@@ -6,13 +6,13 @@ 'use strict'; | ||
var React = require('react'); | ||
var cn = require('classnames'); | ||
var FocusLock = require('react-focus-lock'); | ||
var mergeRefs = require('react-merge-refs'); | ||
var reactTransitionGroup = require('react-transition-group'); | ||
var resizeObserver = require('@juggle/resize-observer'); | ||
var reactTransitionGroup = require('react-transition-group'); | ||
var FocusLock = require('react-focus-lock'); | ||
require('./matches-polyfill.js'); | ||
var cn = require('classnames'); | ||
var coreComponentsBackdrop = require('@alfalab/core-components-backdrop'); | ||
var coreComponentsPortal = require('@alfalab/core-components-portal'); | ||
var coreComponentsBackdrop = require('@alfalab/core-components-backdrop'); | ||
var coreComponentsStack = require('@alfalab/core-components-stack'); | ||
require('@alfalab/core-components-global-store'); | ||
var utils = require('./utils.js'); | ||
require('./matches-polyfill.js'); | ||
@@ -22,7 +22,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var FocusLock__default = /*#__PURE__*/_interopDefaultLegacy(FocusLock); | ||
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs); | ||
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn); | ||
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs); | ||
var FocusLock__default = /*#__PURE__*/_interopDefaultLegacy(FocusLock); | ||
/*! ***************************************************************************** | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
@@ -54,5 +54,6 @@ | ||
var styles = {"component":"base-modal__component_pnet3","wrapper":"base-modal__wrapper_pnet3","content":"base-modal__content_pnet3","hidden":"base-modal__hidden_pnet3","backdrop":"base-modal__backdrop_pnet3","appear":"base-modal__appear_pnet3","enter":"base-modal__enter_pnet3","appearActive":"base-modal__appearActive_pnet3","enterActive":"base-modal__enterActive_pnet3","exit":"base-modal__exit_pnet3","exitActive":"base-modal__exitActive_pnet3","exitDone":"base-modal__exitDone_pnet3"}; | ||
var styles = {"component":"base-modal__component_1i1k8","wrapper":"base-modal__wrapper_1i1k8","content":"base-modal__content_1i1k8","hidden":"base-modal__hidden_1i1k8","backdrop":"base-modal__backdrop_1i1k8","appear":"base-modal__appear_1i1k8","enter":"base-modal__enter_1i1k8","appearActive":"base-modal__appearActive_1i1k8","enterActive":"base-modal__enterActive_1i1k8","exit":"base-modal__exit_1i1k8","exitActive":"base-modal__exitActive_1i1k8","exitDone":"base-modal__exitDone_1i1k8"}; | ||
require('./index.css') | ||
// eslint-disable-next-line @typescript-eslint/no-redeclare | ||
var BaseModalContext = React__default['default'].createContext({ | ||
@@ -96,5 +97,3 @@ hasFooter: false, | ||
var shouldRender = keepMounted || open || !isExited; | ||
var getContainer = React.useCallback(function () { | ||
return (container ? container() : document.body); | ||
}, [container]); | ||
var getContainer = React.useCallback(function () { return (container ? container() : document.body); }, [container]); | ||
var addResizeHandle = React.useCallback(function () { | ||
@@ -101,0 +100,0 @@ if (!resizeObserverRef.current) |
/// <reference types="react-transition-group" /> | ||
/// <reference types="react" /> | ||
import React from 'react'; | ||
import { MouseEvent, KeyboardEvent, ReactNode, Ref, FC, MutableRefObject } from "react"; | ||
import { FC, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref } from "react"; | ||
import { TransitionProps } from 'react-transition-group/Transition'; | ||
import { BackdropProps } from "@alfalab/core-components-backdrop"; | ||
import { PortalProps } from "@alfalab/core-components-portal"; | ||
import { BackdropProps } from "@alfalab/core-components-backdrop"; | ||
type BaseModalProps = { | ||
@@ -9,0 +9,0 @@ /** |
@@ -6,10 +6,9 @@ 'use strict'; | ||
var React = require('react'); | ||
var cn = require('classnames'); | ||
var FocusLock = require('react-focus-lock'); | ||
var mergeRefs = require('react-merge-refs'); | ||
var reactTransitionGroup = require('react-transition-group'); | ||
var resizeObserver = require('@juggle/resize-observer'); | ||
var reactTransitionGroup = require('react-transition-group'); | ||
var FocusLock = require('react-focus-lock'); | ||
require('./matches-polyfill.js'); | ||
var cn = require('classnames'); | ||
var coreComponentsBackdrop = require('@alfalab/core-components-backdrop/cssm'); | ||
var coreComponentsPortal = require('@alfalab/core-components-portal/cssm'); | ||
var coreComponentsBackdrop = require('@alfalab/core-components-backdrop/cssm'); | ||
var coreComponentsStack = require('@alfalab/core-components-stack/cssm'); | ||
@@ -19,2 +18,3 @@ require('@alfalab/core-components-global-store/cssm'); | ||
var styles = require('./index.module.css'); | ||
require('./matches-polyfill.js'); | ||
@@ -24,8 +24,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var FocusLock__default = /*#__PURE__*/_interopDefaultLegacy(FocusLock); | ||
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs); | ||
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn); | ||
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs); | ||
var FocusLock__default = /*#__PURE__*/_interopDefaultLegacy(FocusLock); | ||
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles); | ||
/*! ***************************************************************************** | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
@@ -57,2 +57,3 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-redeclare | ||
var BaseModalContext = React__default['default'].createContext({ | ||
@@ -96,5 +97,3 @@ hasFooter: false, | ||
var shouldRender = keepMounted || open || !isExited; | ||
var getContainer = React.useCallback(function () { | ||
return (container ? container() : document.body); | ||
}, [container]); | ||
var getContainer = React.useCallback(function () { return (container ? container() : document.body); }, [container]); | ||
var addResizeHandle = React.useCallback(function () { | ||
@@ -101,0 +100,0 @@ if (!resizeObserverRef.current) |
@@ -7,10 +7,9 @@ 'use strict'; | ||
require('react'); | ||
require('classnames'); | ||
require('react-focus-lock'); | ||
require('react-merge-refs'); | ||
require('react-transition-group'); | ||
require('@juggle/resize-observer'); | ||
require('react-transition-group'); | ||
require('react-focus-lock'); | ||
require('./matches-polyfill.js'); | ||
require('classnames'); | ||
require('@alfalab/core-components-backdrop/cssm'); | ||
require('@alfalab/core-components-portal/cssm'); | ||
require('@alfalab/core-components-backdrop/cssm'); | ||
require('@alfalab/core-components-stack/cssm'); | ||
@@ -20,2 +19,3 @@ require('@alfalab/core-components-global-store/cssm'); | ||
require('./index.module.css'); | ||
require('./matches-polyfill.js'); | ||
@@ -22,0 +22,0 @@ |
@@ -40,5 +40,3 @@ 'use strict'; | ||
}; | ||
var getPaddingRight = function (node) { | ||
return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0; | ||
}; | ||
var getPaddingRight = function (node) { return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0; }; | ||
var restoreContainerStyles = function (container) { | ||
@@ -45,0 +43,0 @@ var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles(); |
/// <reference types="react-transition-group" /> | ||
/// <reference types="react" /> | ||
import React from 'react'; | ||
import { MouseEvent, KeyboardEvent, ReactNode, Ref, FC, MutableRefObject } from "react"; | ||
import { FC, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref } from "react"; | ||
import { TransitionProps } from 'react-transition-group/Transition'; | ||
import { BackdropProps } from "@alfalab/core-components-backdrop"; | ||
import { PortalProps } from "@alfalab/core-components-portal"; | ||
import { BackdropProps } from "@alfalab/core-components-backdrop"; | ||
type BaseModalProps = { | ||
@@ -9,0 +9,0 @@ /** |
import React, { forwardRef, useState, useRef, useCallback, useEffect, useMemo } from 'react'; | ||
import cn from 'classnames'; | ||
import FocusLock from 'react-focus-lock'; | ||
import mergeRefs from 'react-merge-refs'; | ||
import { CSSTransition } from 'react-transition-group'; | ||
import { ResizeObserver } from '@juggle/resize-observer'; | ||
import { CSSTransition } from 'react-transition-group'; | ||
import FocusLock from 'react-focus-lock'; | ||
import './matches-polyfill.js'; | ||
import cn from 'classnames'; | ||
import { Backdrop } from '@alfalab/core-components-backdrop/esm'; | ||
import { Portal } from '@alfalab/core-components-portal/esm'; | ||
import { Backdrop } from '@alfalab/core-components-backdrop/esm'; | ||
import { stackingOrder, Stack } from '@alfalab/core-components-stack/esm'; | ||
import '@alfalab/core-components-global-store/esm'; | ||
import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar, getScrollbarSize } from './utils.js'; | ||
import './matches-polyfill.js'; | ||
/*! ***************************************************************************** | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
@@ -41,5 +41,6 @@ | ||
var styles = {"component":"base-modal__component_pnet3","wrapper":"base-modal__wrapper_pnet3","content":"base-modal__content_pnet3","hidden":"base-modal__hidden_pnet3","backdrop":"base-modal__backdrop_pnet3","appear":"base-modal__appear_pnet3","enter":"base-modal__enter_pnet3","appearActive":"base-modal__appearActive_pnet3","enterActive":"base-modal__enterActive_pnet3","exit":"base-modal__exit_pnet3","exitActive":"base-modal__exitActive_pnet3","exitDone":"base-modal__exitDone_pnet3"}; | ||
var styles = {"component":"base-modal__component_1i1k8","wrapper":"base-modal__wrapper_1i1k8","content":"base-modal__content_1i1k8","hidden":"base-modal__hidden_1i1k8","backdrop":"base-modal__backdrop_1i1k8","appear":"base-modal__appear_1i1k8","enter":"base-modal__enter_1i1k8","appearActive":"base-modal__appearActive_1i1k8","enterActive":"base-modal__enterActive_1i1k8","exit":"base-modal__exit_1i1k8","exitActive":"base-modal__exitActive_1i1k8","exitDone":"base-modal__exitDone_1i1k8"}; | ||
require('./index.css') | ||
// eslint-disable-next-line @typescript-eslint/no-redeclare | ||
var BaseModalContext = React.createContext({ | ||
@@ -83,5 +84,3 @@ hasFooter: false, | ||
var shouldRender = keepMounted || open || !isExited; | ||
var getContainer = useCallback(function () { | ||
return (container ? container() : document.body); | ||
}, [container]); | ||
var getContainer = useCallback(function () { return (container ? container() : document.body); }, [container]); | ||
var addResizeHandle = useCallback(function () { | ||
@@ -88,0 +87,0 @@ if (!resizeObserverRef.current) |
export { BaseModal, BaseModalContext } from './Component.js'; | ||
import 'react'; | ||
import 'classnames'; | ||
import 'react-focus-lock'; | ||
import 'react-merge-refs'; | ||
import 'react-transition-group'; | ||
import '@juggle/resize-observer'; | ||
import 'react-transition-group'; | ||
import 'react-focus-lock'; | ||
import './matches-polyfill.js'; | ||
import 'classnames'; | ||
import '@alfalab/core-components-backdrop/esm'; | ||
import '@alfalab/core-components-portal/esm'; | ||
import '@alfalab/core-components-backdrop/esm'; | ||
import '@alfalab/core-components-stack/esm'; | ||
import '@alfalab/core-components-global-store/esm'; | ||
export { getScrollbarSize, handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js'; | ||
import './matches-polyfill.js'; |
@@ -36,5 +36,3 @@ import { getModalStore } from '@alfalab/core-components-global-store/esm'; | ||
}; | ||
var getPaddingRight = function (node) { | ||
return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0; | ||
}; | ||
var getPaddingRight = function (node) { return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0; }; | ||
var restoreContainerStyles = function (container) { | ||
@@ -41,0 +39,0 @@ var modalRestoreStyles = getModalStore().getRestoreStyles(); |
10
index.js
@@ -7,13 +7,13 @@ 'use strict'; | ||
require('react'); | ||
require('classnames'); | ||
require('react-focus-lock'); | ||
require('react-merge-refs'); | ||
require('react-transition-group'); | ||
require('@juggle/resize-observer'); | ||
require('react-transition-group'); | ||
require('react-focus-lock'); | ||
require('./matches-polyfill.js'); | ||
require('classnames'); | ||
require('@alfalab/core-components-backdrop'); | ||
require('@alfalab/core-components-portal'); | ||
require('@alfalab/core-components-backdrop'); | ||
require('@alfalab/core-components-stack'); | ||
require('@alfalab/core-components-global-store'); | ||
var utils = require('./utils.js'); | ||
require('./matches-polyfill.js'); | ||
@@ -20,0 +20,0 @@ |
/// <reference types="react-transition-group" /> | ||
/// <reference types="react" /> | ||
import React from 'react'; | ||
import { MouseEvent, KeyboardEvent, ReactNode, Ref, FC, MutableRefObject } from "react"; | ||
import { FC, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref } from "react"; | ||
import { TransitionProps } from 'react-transition-group/Transition'; | ||
import { BackdropProps } from "@alfalab/core-components-backdrop"; | ||
import { PortalProps } from "@alfalab/core-components-portal"; | ||
import { BackdropProps } from "@alfalab/core-components-backdrop"; | ||
type BaseModalProps = { | ||
@@ -9,0 +9,0 @@ /** |
import React, { forwardRef, useState, useRef, useCallback, useEffect, useMemo } from 'react'; | ||
import cn from 'classnames'; | ||
import FocusLock from 'react-focus-lock'; | ||
import mergeRefs from 'react-merge-refs'; | ||
import { CSSTransition } from 'react-transition-group'; | ||
import { ResizeObserver } from '@juggle/resize-observer'; | ||
import { CSSTransition } from 'react-transition-group'; | ||
import FocusLock from 'react-focus-lock'; | ||
import './matches-polyfill.js'; | ||
import cn from 'classnames'; | ||
import { Backdrop } from '@alfalab/core-components-backdrop/modern'; | ||
import { Portal } from '@alfalab/core-components-portal/modern'; | ||
import { Backdrop } from '@alfalab/core-components-backdrop/modern'; | ||
import { stackingOrder, Stack } from '@alfalab/core-components-stack/modern'; | ||
import '@alfalab/core-components-global-store/modern'; | ||
import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar, getScrollbarSize } from './utils.js'; | ||
import './matches-polyfill.js'; | ||
var styles = {"component":"base-modal__component_pnet3","wrapper":"base-modal__wrapper_pnet3","content":"base-modal__content_pnet3","hidden":"base-modal__hidden_pnet3","backdrop":"base-modal__backdrop_pnet3","appear":"base-modal__appear_pnet3","enter":"base-modal__enter_pnet3","appearActive":"base-modal__appearActive_pnet3","enterActive":"base-modal__enterActive_pnet3","exit":"base-modal__exit_pnet3","exitActive":"base-modal__exitActive_pnet3","exitDone":"base-modal__exitDone_pnet3"}; | ||
var styles = {"component":"base-modal__component_1i1k8","wrapper":"base-modal__wrapper_1i1k8","content":"base-modal__content_1i1k8","hidden":"base-modal__hidden_1i1k8","backdrop":"base-modal__backdrop_1i1k8","appear":"base-modal__appear_1i1k8","enter":"base-modal__enter_1i1k8","appearActive":"base-modal__appearActive_1i1k8","enterActive":"base-modal__enterActive_1i1k8","exit":"base-modal__exit_1i1k8","exitActive":"base-modal__exitActive_1i1k8","exitDone":"base-modal__exitDone_1i1k8"}; | ||
require('./index.css') | ||
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ | ||
// eslint-disable-next-line @typescript-eslint/no-redeclare | ||
const BaseModalContext = React.createContext({ | ||
@@ -55,5 +56,3 @@ hasFooter: false, | ||
const shouldRender = keepMounted || open || !isExited; | ||
const getContainer = useCallback(() => { | ||
return (container ? container() : document.body); | ||
}, [container]); | ||
const getContainer = useCallback(() => (container ? container() : document.body), [container]); | ||
const addResizeHandle = useCallback(() => { | ||
@@ -158,3 +157,3 @@ if (!resizeObserverRef.current) | ||
}, [addResizeHandle, getScrollHandler, handleScroll, onMount, transitionProps]); | ||
const handleExited = useCallback(node => { | ||
const handleExited = useCallback((node) => { | ||
removeResizeHandle(); | ||
@@ -224,8 +223,8 @@ setExited(true); | ||
return null; | ||
return (React.createElement(Stack, { value: zIndex }, computedZIndex => (React.createElement(Portal, { getPortalContainer: container, immediateMount: true }, | ||
return (React.createElement(Stack, { value: zIndex }, (computedZIndex) => (React.createElement(Portal, { getPortalContainer: container, immediateMount: true }, | ||
React.createElement(BaseModalContext.Provider, { value: contextValue }, | ||
React.createElement(FocusLock, { autoFocus: !disableAutoFocus, disabled: disableFocusLock || !open, returnFocus: !disableRestoreFocus }, | ||
Backdrop$1 && (React.createElement(Backdrop$1, Object.assign({}, backdropProps, { className: cn(backdropProps.className, styles.backdrop), open: open, style: { | ||
Backdrop$1 && (React.createElement(Backdrop$1, { ...backdropProps, className: cn(backdropProps.className, styles.backdrop), open: open, style: { | ||
zIndex: computedZIndex, | ||
} }))), | ||
} })), | ||
React.createElement("div", { role: 'dialog', className: cn(styles.wrapper, wrapperClassName, { | ||
@@ -238,3 +237,3 @@ [styles.hidden]: !open && isExited, | ||
} }, | ||
React.createElement(CSSTransition, Object.assign({ appear: true, timeout: 200, classNames: styles }, transitionProps, { in: open, onEntered: handleEntered, onExited: handleExited }), | ||
React.createElement(CSSTransition, { appear: true, timeout: 200, classNames: styles, ...transitionProps, in: open, onEntered: handleEntered, onExited: handleExited }, | ||
React.createElement("div", { className: cn(styles.component, className), ref: mergeRefs([componentRef, componentNodeRef]) }, | ||
@@ -241,0 +240,0 @@ React.createElement("div", { className: cn(styles.content, contentClassName) }, children)))))))))); |
import 'react'; | ||
import 'classnames'; | ||
import 'react-focus-lock'; | ||
import 'react-merge-refs'; | ||
import 'react-transition-group'; | ||
import '@juggle/resize-observer'; | ||
import 'react-transition-group'; | ||
import 'react-focus-lock'; | ||
import './matches-polyfill.js'; | ||
import 'classnames'; | ||
import '@alfalab/core-components-backdrop/modern'; | ||
import '@alfalab/core-components-portal/modern'; | ||
import '@alfalab/core-components-backdrop/modern'; | ||
import '@alfalab/core-components-stack/modern'; | ||
@@ -14,1 +13,2 @@ import '@alfalab/core-components-global-store/modern'; | ||
export { BaseModal, BaseModalContext } from './Component.js'; | ||
import './matches-polyfill.js'; |
@@ -36,5 +36,3 @@ import { getModalStore } from '@alfalab/core-components-global-store/modern'; | ||
}; | ||
const getPaddingRight = (node) => { | ||
return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0; | ||
}; | ||
const getPaddingRight = (node) => parseInt(window.getComputedStyle(node).paddingRight, 10) || 0; | ||
const restoreContainerStyles = (container) => { | ||
@@ -41,0 +39,0 @@ const modalRestoreStyles = getModalStore().getRestoreStyles(); |
{ | ||
"name": "@alfalab/core-components-base-modal", | ||
"version": "5.0.4", | ||
"version": "5.0.5", | ||
"description": "BaseModal component", | ||
@@ -17,3 +17,3 @@ "keywords": [], | ||
"@alfalab/core-components-backdrop": "^3.0.1", | ||
"@alfalab/core-components-global-store": "^2.0.1", | ||
"@alfalab/core-components-global-store": "^2.0.2", | ||
"@alfalab/core-components-portal": "^3.1.0", | ||
@@ -20,0 +20,0 @@ "@alfalab/core-components-stack": "^4.0.1", |
@@ -40,5 +40,3 @@ 'use strict'; | ||
}; | ||
var getPaddingRight = function (node) { | ||
return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0; | ||
}; | ||
var getPaddingRight = function (node) { return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0; }; | ||
var restoreContainerStyles = function (container) { | ||
@@ -45,0 +43,0 @@ var modalRestoreStyles = coreComponentsGlobalStore.getModalStore().getRestoreStyles(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106158
2508