@seeqdev/qomponents 0.0.80 → 0.0.82
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/Modal/Modal.stories.d.ts +0 -1
- package/dist/index.esm.js +18 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +25 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14078,16 +14078,17 @@ const DialogContent = React.forwardRef(({ className, children, ...props }, ref)
|
|
|
14078
14078
|
tw-gap-4 tw-border tw-bg-sq-white dark:tw-bg-sq-dark-background tw-p-6 tw-shadow-lg tw-duration-200
|
|
14079
14079
|
tw-rounded-lg ${className}`, ...props }, children))));
|
|
14080
14080
|
DialogContent.displayName = $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2.displayName;
|
|
14081
|
-
const DialogHeader = (
|
|
14082
|
-
React.createElement("div", {
|
|
14081
|
+
const DialogHeader = (props) => (React.createElement("div", { className: "tw-w-full tw-justify-between" },
|
|
14082
|
+
React.createElement("div", { ...props })));
|
|
14083
14083
|
DialogHeader.displayName = 'DialogHeader';
|
|
14084
|
-
const DialogFooter = (
|
|
14084
|
+
const DialogFooter = (props) => React.createElement("div", { ...props });
|
|
14085
14085
|
DialogFooter.displayName = 'DialogFooter';
|
|
14086
|
-
const DialogTitle = React.forwardRef((
|
|
14086
|
+
const DialogTitle = React.forwardRef((props, ref) => React.createElement($5d3850c4d0b4e6c7$export$f99233281efd08a0, { ref: ref, ...props }));
|
|
14087
14087
|
DialogTitle.displayName = $5d3850c4d0b4e6c7$export$f99233281efd08a0.displayName;
|
|
14088
|
-
const DialogDescription = React.forwardRef((
|
|
14088
|
+
const DialogDescription = React.forwardRef((props, ref) => React.createElement($5d3850c4d0b4e6c7$export$393edc798c47379d, { ref: ref, ...props }));
|
|
14089
14089
|
DialogDescription.displayName = $5d3850c4d0b4e6c7$export$393edc798c47379d.displayName;
|
|
14090
14090
|
const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, subtitle, children, open = false, onClose, customButton = false, customButtonLabel = 'Back', onClickCustomButton, submitButtonLabel = 'Submit', cancelButtonLabel = 'Cancel', disableSubmitButton = false, stopPropagationSubmitButton = false, onSubmit, isTitleEditable = false, onTitleChanged, inputExtraClassNames, hideCloseIcon = false, size = 'xl', titleIconPosition = 'left', hideFooterButtons = false, hideSubmitButton = false, hideCancelButton = false, testId = 'modal', modalFooter, dialogClassName, titlePlaceholder, titleRequired, titleError, submitButtonTooltip, cancelButtonTooltip, disableCustomButton, customHeader, middleFooterSection = React.createElement(React.Fragment, null), customButtonVariant = 'outline', keepFocusInsideModal = true, }) => {
|
|
14091
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
14091
14092
|
// the Dialog is adding pointerEvents: none to body and the dropdowns from the modal does not work anymore
|
|
14092
14093
|
React.useEffect(() => {
|
|
14093
14094
|
if (open) {
|
|
@@ -14101,6 +14102,17 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
|
|
|
14101
14102
|
document.body.style.pointerEvents = 'auto';
|
|
14102
14103
|
}
|
|
14103
14104
|
}, [open]);
|
|
14105
|
+
const handleSubmit = async (e) => {
|
|
14106
|
+
if (!onSubmit)
|
|
14107
|
+
return;
|
|
14108
|
+
try {
|
|
14109
|
+
setIsLoading(true);
|
|
14110
|
+
await onSubmit(e);
|
|
14111
|
+
}
|
|
14112
|
+
finally {
|
|
14113
|
+
setIsLoading(false);
|
|
14114
|
+
}
|
|
14115
|
+
};
|
|
14104
14116
|
const renderTitle = () => {
|
|
14105
14117
|
let titleIconElement = React.createElement(React.Fragment, null);
|
|
14106
14118
|
if (titleIcon) {
|
|
@@ -14146,7 +14158,7 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
|
|
|
14146
14158
|
React.createElement("div", { className: "tw-flex tw-items-center" }, middleFooterSection),
|
|
14147
14159
|
!hideCancelButton && (React.createElement(DialogClose, { asChild: true },
|
|
14148
14160
|
React.createElement(Button, { label: cancelButtonLabel, extraClassNames: "tw-mr-5 tw-min-w-[100px]", tooltip: cancelButtonTooltip, variant: "outline", stopPropagation: false, testId: "cancelButton" }))),
|
|
14149
|
-
!hideSubmitButton && (React.createElement(Button, { label: submitButtonLabel, onClick:
|
|
14161
|
+
!hideSubmitButton && (React.createElement(Button, { label: submitButtonLabel, onClick: handleSubmit, disabled: disableSubmitButton || isLoading, variant: "theme", stopPropagation: stopPropagationSubmitButton, tooltip: submitButtonTooltip, icon: isLoading ? 'fc-loading-notch tw-animate-spin' : undefined, iconPosition: "left", testId: "submitButton", extraClassNames: "tw-min-w-[100px]" })))))))))) : (React.createElement(React.Fragment, null));
|
|
14150
14162
|
};
|
|
14151
14163
|
|
|
14152
14164
|
// We have resorted to returning slots directly rather than exposing primitives that can then
|