@charcoal-ui/react 2.0.0 → 2.0.1
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/Modal/index.d.ts +4 -2
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/index.cjs +14 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +15 -7
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +15 -7
- package/dist/index.module.js.map +1 -1
- package/package.json +7 -7
- package/src/components/Modal/index.story.tsx +5 -5
- package/src/components/Modal/index.tsx +27 -7
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AriaModalOverlayProps } from '@react-aria/overlays';
|
|
3
3
|
import { AriaDialogProps } from '@react-types/dialog';
|
|
4
4
|
import { ButtonProps } from '../Button';
|
|
5
|
-
export declare type ModalProps =
|
|
5
|
+
export declare type ModalProps = AriaModalOverlayProps & AriaDialogProps & {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
zIndex?: number;
|
|
8
8
|
title: string;
|
|
9
9
|
size?: 'S' | 'M' | 'L';
|
|
10
10
|
bottomSheet?: boolean | 'full';
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
onClose: () => void;
|
|
11
13
|
portalContainer?: HTMLElement;
|
|
12
14
|
};
|
|
13
15
|
export default function Modal({ children, zIndex, portalContainer, ...props }: ModalProps): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAA;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAA;AACjD,OAAO,EACL,qBAAqB,EAKtB,MAAM,sBAAsB,CAAA;AAK7B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAMrD,OAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAG/C,oBAAY,UAAU,GAAG,qBAAqB,GAC5C,eAAe,GAAG;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;IACtB,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC9B,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,MAAM,IAAI,CAAA;IAInB,eAAe,CAAC,EAAE,WAAW,CAAA;CAC9B,CAAA;AAIH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,QAAQ,EACR,MAAwB,EACxB,eAAe,EACf,GAAG,KAAK,EACT,EAAE,UAAU,eA+FZ;AAgFD,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,eAOzE;AAQD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,sBAYrE"}
|
package/dist/index.cjs
CHANGED
|
@@ -1082,7 +1082,6 @@ function Modal(_ref) {
|
|
|
1082
1082
|
var children = _ref.children,
|
|
1083
1083
|
_ref$zIndex = _ref.zIndex,
|
|
1084
1084
|
zIndex = _ref$zIndex === void 0 ? DEFAULT_Z_INDEX : _ref$zIndex,
|
|
1085
|
-
portalContainer = _ref.portalContainer,
|
|
1086
1085
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
1087
1086
|
|
|
1088
1087
|
var title = props.title,
|
|
@@ -1102,8 +1101,19 @@ function Modal(_ref) {
|
|
|
1102
1101
|
|
|
1103
1102
|
overlays.usePreventScroll();
|
|
1104
1103
|
|
|
1105
|
-
var
|
|
1106
|
-
|
|
1104
|
+
var _useModalOverlay = overlays.useModalOverlay(props, {
|
|
1105
|
+
close: onClose,
|
|
1106
|
+
isOpen: isOpen,
|
|
1107
|
+
// these props are not used actually.
|
|
1108
|
+
// https://github.com/adobe/react-spectrum/blob/df14e3fb129b94b310f0397a701b83f006b51dfe/packages/%40react-aria/overlays/src/useModalOverlay.ts
|
|
1109
|
+
open: function open() {// nope
|
|
1110
|
+
},
|
|
1111
|
+
setOpen: function setOpen() {// nope
|
|
1112
|
+
},
|
|
1113
|
+
toggle: function toggle() {// nope
|
|
1114
|
+
}
|
|
1115
|
+
}, ref),
|
|
1116
|
+
modalProps = _useModalOverlay.modalProps;
|
|
1107
1117
|
|
|
1108
1118
|
var _useDialog = dialog.useDialog(props, ref),
|
|
1109
1119
|
dialogProps = _useDialog.dialogProps,
|
|
@@ -1136,9 +1146,7 @@ function Modal(_ref) {
|
|
|
1136
1146
|
return transition(function (_ref2, item) {
|
|
1137
1147
|
var backgroundColor = _ref2.backgroundColor,
|
|
1138
1148
|
transform = _ref2.transform;
|
|
1139
|
-
return item && /*#__PURE__*/React__default["default"].createElement(overlays.
|
|
1140
|
-
portalContainer: portalContainer
|
|
1141
|
-
}, /*#__PURE__*/React__default["default"].createElement(ModalBackground, _extends({
|
|
1149
|
+
return item && /*#__PURE__*/React__default["default"].createElement(overlays.Overlay, null, /*#__PURE__*/React__default["default"].createElement(ModalBackground, _extends({
|
|
1142
1150
|
zIndex: zIndex
|
|
1143
1151
|
}, underlayProps, {
|
|
1144
1152
|
style: transitionEnabled ? {
|