jy-headless 0.0.23 → 0.0.24
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/Modal.d.ts +3 -1
- package/dist/index.esm.js +12 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonProps } from '../button/Button';
|
|
3
3
|
interface ModalProps {
|
|
4
4
|
opener: ReactNode;
|
|
@@ -14,5 +14,7 @@ interface ModalOverlayProps {
|
|
|
14
14
|
backgroundColor?: string;
|
|
15
15
|
zIndex?: number;
|
|
16
16
|
children: ReactNode;
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
className: string;
|
|
17
19
|
}
|
|
18
20
|
export default Modal;
|
package/dist/index.esm.js
CHANGED
|
@@ -387,30 +387,25 @@ const Modal = ({ opener, children, targetSelector = 'root', }) => {
|
|
|
387
387
|
setIsShow(true);
|
|
388
388
|
};
|
|
389
389
|
return (React.createElement(ModalContext.Provider, { value: { isShow, setIsShow } },
|
|
390
|
-
React.
|
|
391
|
-
|
|
392
|
-
|
|
390
|
+
React.isValidElement(opener) &&
|
|
391
|
+
React.cloneElement(opener, {
|
|
392
|
+
onClick: onHandleShow,
|
|
393
|
+
}),
|
|
393
394
|
isShow &&
|
|
394
395
|
document.querySelector(targetSelector) &&
|
|
395
396
|
createPortal(children, document.querySelector(targetSelector))));
|
|
396
397
|
};
|
|
397
|
-
const ModalOverlay = ({ backgroundColor = 'rgba(0,0,0,0.5)', children, zIndex = 999, }) => {
|
|
398
|
-
return (React.createElement("div", { style: {
|
|
399
|
-
|
|
400
|
-
display: 'flex',
|
|
401
|
-
justifyContent: 'center',
|
|
402
|
-
alignItems: 'center',
|
|
403
|
-
top: 0,
|
|
404
|
-
right: 0,
|
|
405
|
-
bottom: 0,
|
|
406
|
-
left: 0,
|
|
407
|
-
zIndex,
|
|
408
|
-
backgroundColor,
|
|
409
|
-
} }, children));
|
|
398
|
+
const ModalOverlay = ({ backgroundColor = 'rgba(0,0,0,0.5)', children, style, className, zIndex = 999, }) => {
|
|
399
|
+
return (React.createElement("div", { className: className, style: Object.assign({ position: 'fixed', display: 'flex', justifyContent: 'center', alignItems: 'center', top: 0, right: 0, bottom: 0, left: 0, zIndex,
|
|
400
|
+
backgroundColor }, style) }, children));
|
|
410
401
|
};
|
|
411
402
|
const ModalCloseButton = (_a) => {
|
|
412
403
|
var props = __rest(_a, []);
|
|
413
|
-
const
|
|
404
|
+
const context = useContext(ModalContext);
|
|
405
|
+
if (!context) {
|
|
406
|
+
throw new Error('ModalCloseButton must be used within a ModalContext.Provider');
|
|
407
|
+
}
|
|
408
|
+
const { setIsShow } = context;
|
|
414
409
|
return React.createElement(Button, Object.assign({}, props, { onClick: () => setIsShow(false) }));
|
|
415
410
|
};
|
|
416
411
|
Modal.Overlay = ModalOverlay;
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -389,30 +389,25 @@ const Modal = ({ opener, children, targetSelector = 'root', }) => {
|
|
|
389
389
|
setIsShow(true);
|
|
390
390
|
};
|
|
391
391
|
return (React.createElement(ModalContext.Provider, { value: { isShow, setIsShow } },
|
|
392
|
-
React.
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
React.isValidElement(opener) &&
|
|
393
|
+
React.cloneElement(opener, {
|
|
394
|
+
onClick: onHandleShow,
|
|
395
|
+
}),
|
|
395
396
|
isShow &&
|
|
396
397
|
document.querySelector(targetSelector) &&
|
|
397
398
|
reactDom.createPortal(children, document.querySelector(targetSelector))));
|
|
398
399
|
};
|
|
399
|
-
const ModalOverlay = ({ backgroundColor = 'rgba(0,0,0,0.5)', children, zIndex = 999, }) => {
|
|
400
|
-
return (React.createElement("div", { style: {
|
|
401
|
-
|
|
402
|
-
display: 'flex',
|
|
403
|
-
justifyContent: 'center',
|
|
404
|
-
alignItems: 'center',
|
|
405
|
-
top: 0,
|
|
406
|
-
right: 0,
|
|
407
|
-
bottom: 0,
|
|
408
|
-
left: 0,
|
|
409
|
-
zIndex,
|
|
410
|
-
backgroundColor,
|
|
411
|
-
} }, children));
|
|
400
|
+
const ModalOverlay = ({ backgroundColor = 'rgba(0,0,0,0.5)', children, style, className, zIndex = 999, }) => {
|
|
401
|
+
return (React.createElement("div", { className: className, style: Object.assign({ position: 'fixed', display: 'flex', justifyContent: 'center', alignItems: 'center', top: 0, right: 0, bottom: 0, left: 0, zIndex,
|
|
402
|
+
backgroundColor }, style) }, children));
|
|
412
403
|
};
|
|
413
404
|
const ModalCloseButton = (_a) => {
|
|
414
405
|
var props = __rest(_a, []);
|
|
415
|
-
const
|
|
406
|
+
const context = React.useContext(ModalContext);
|
|
407
|
+
if (!context) {
|
|
408
|
+
throw new Error('ModalCloseButton must be used within a ModalContext.Provider');
|
|
409
|
+
}
|
|
410
|
+
const { setIsShow } = context;
|
|
416
411
|
return React.createElement(Button, Object.assign({}, props, { onClick: () => setIsShow(false) }));
|
|
417
412
|
};
|
|
418
413
|
Modal.Overlay = ModalOverlay;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|