@allxsmith/bestax-bulma 2.3.1 → 2.3.3
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/index.cjs.js +57 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +57 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/Modal.d.ts +46 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -762,12 +762,63 @@ const MessageWithSubComponents = MessageComponent;
|
|
|
762
762
|
MessageWithSubComponents.Header = MessageHeader;
|
|
763
763
|
MessageWithSubComponents.Body = MessageBody;
|
|
764
764
|
|
|
765
|
-
const
|
|
765
|
+
const ModalBackground = ({ className, ...props }) => {
|
|
766
|
+
const classes = classNames('modal-background', className);
|
|
767
|
+
return jsxRuntime.jsx("div", { className: classes, ...props });
|
|
768
|
+
};
|
|
769
|
+
const ModalContent = ({ className, ...props }) => {
|
|
770
|
+
const classes = classNames('modal-content', className);
|
|
771
|
+
return jsxRuntime.jsx("div", { className: classes, ...props });
|
|
772
|
+
};
|
|
773
|
+
const ModalCardHead = ({ className, ...props }) => {
|
|
774
|
+
const classes = classNames('modal-card-head', className);
|
|
775
|
+
return jsxRuntime.jsx("header", { className: classes, ...props });
|
|
776
|
+
};
|
|
777
|
+
const ModalCardTitle = ({ className, ...props }) => {
|
|
778
|
+
const classes = classNames('modal-card-title', className);
|
|
779
|
+
return jsxRuntime.jsx("p", { className: classes, ...props });
|
|
780
|
+
};
|
|
781
|
+
const ModalCardBody = ({ className, ...props }) => {
|
|
782
|
+
const classes = classNames('modal-card-body', className);
|
|
783
|
+
return jsxRuntime.jsx("section", { className: classes, ...props });
|
|
784
|
+
};
|
|
785
|
+
const ModalCardFoot = ({ className, ...props }) => {
|
|
786
|
+
const classes = classNames('modal-card-foot', className);
|
|
787
|
+
return jsxRuntime.jsx("footer", { className: classes, ...props });
|
|
788
|
+
};
|
|
789
|
+
const ModalCard = ({ className, ...props }) => {
|
|
790
|
+
const classes = classNames('modal-card', className);
|
|
791
|
+
return jsxRuntime.jsx("div", { className: classes, ...props });
|
|
792
|
+
};
|
|
793
|
+
ModalCard.Head = ModalCardHead;
|
|
794
|
+
ModalCard.Title = ModalCardTitle;
|
|
795
|
+
ModalCard.Body = ModalCardBody;
|
|
796
|
+
ModalCard.Foot = ModalCardFoot;
|
|
797
|
+
const ModalClose = ({ className, size = 'large', variant = 'delete', ...props }) => {
|
|
798
|
+
const classes = classNames(variant === 'delete' ? 'delete' : 'modal-close', variant === 'floating' && size && `is-${size}`, className);
|
|
799
|
+
return (jsxRuntime.jsx("button", { className: classes, "aria-label": "close", type: "button", ...props }));
|
|
800
|
+
};
|
|
801
|
+
const ModalRoot = ({ active, isActive, onClose, className, textColor, bgColor, modalCardTitle, modalCardFoot, type, children, ...props }) => {
|
|
802
|
+
var _a;
|
|
766
803
|
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
767
804
|
color: textColor,
|
|
768
805
|
backgroundColor: bgColor,
|
|
769
806
|
...props,
|
|
770
807
|
});
|
|
808
|
+
const isModalActive = (_a = active !== null && active !== void 0 ? active : isActive) !== null && _a !== void 0 ? _a : false;
|
|
809
|
+
const hasCompoundComponents = React.Children.toArray(children).some(child => React.isValidElement(child) &&
|
|
810
|
+
(child.type === ModalBackground ||
|
|
811
|
+
child.type === ModalContent ||
|
|
812
|
+
child.type === ModalCard ||
|
|
813
|
+
child.type === ModalClose));
|
|
814
|
+
const bulmaClasses = usePrefixedClassNames('modal', {
|
|
815
|
+
'is-active': isModalActive,
|
|
816
|
+
});
|
|
817
|
+
const deleteClass = usePrefixedClassNames('delete');
|
|
818
|
+
const modalClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
819
|
+
if (hasCompoundComponents) {
|
|
820
|
+
return (jsxRuntime.jsx("div", { className: modalClasses, ...rest, "data-testid": "modal", children: children }));
|
|
821
|
+
}
|
|
771
822
|
let isModalCard;
|
|
772
823
|
if (type === 'card')
|
|
773
824
|
isModalCard = true;
|
|
@@ -775,13 +826,13 @@ const Modal = ({ active = false, onClose, className, textColor, bgColor, modalCa
|
|
|
775
826
|
isModalCard = false;
|
|
776
827
|
else
|
|
777
828
|
isModalCard = !!modalCardTitle || !!modalCardFoot;
|
|
778
|
-
const bulmaClasses = usePrefixedClassNames('modal', {
|
|
779
|
-
'is-active': active,
|
|
780
|
-
});
|
|
781
|
-
const deleteClass = usePrefixedClassNames('delete');
|
|
782
|
-
const modalClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
783
829
|
return (jsxRuntime.jsxs("div", { className: modalClasses, ...rest, "data-testid": "modal", children: [jsxRuntime.jsx("div", { className: "modal-background", onClick: onClose, "data-testid": "modal-background" }), isModalCard ? (jsxRuntime.jsxs("div", { className: "modal-card", children: [modalCardTitle && (jsxRuntime.jsxs("header", { className: "modal-card-head", children: [jsxRuntime.jsx("p", { className: "modal-card-title", children: modalCardTitle }), onClose && (jsxRuntime.jsx("button", { className: deleteClass, "aria-label": "close", onClick: onClose, type: "button", "data-testid": "modal-close" }))] })), jsxRuntime.jsx("section", { className: "modal-card-body", "data-testid": "modal-body", children: children }), modalCardFoot && (jsxRuntime.jsx("footer", { className: "modal-card-foot", children: modalCardFoot }))] })) : (jsxRuntime.jsx("div", { className: "modal-content", "data-testid": "modal-content", children: children })), (!isModalCard || (!modalCardTitle && onClose)) && onClose && (jsxRuntime.jsx("button", { className: "modal-close is-large", "aria-label": "close", onClick: onClose, type: "button", "data-testid": "modal-close-float" }))] }));
|
|
784
830
|
};
|
|
831
|
+
ModalRoot.Background = ModalBackground;
|
|
832
|
+
ModalRoot.Content = ModalContent;
|
|
833
|
+
ModalRoot.Card = ModalCard;
|
|
834
|
+
ModalRoot.Close = ModalClose;
|
|
835
|
+
const Modal = ModalRoot;
|
|
785
836
|
|
|
786
837
|
const Navbar = ({ className, textColor, bgColor, color, transparent, fixed, children, ...props }) => {
|
|
787
838
|
const { bulmaHelperClasses, rest } = useBulmaClasses({
|