@inceptionbg/iui 2.0.14 → 2.0.15
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/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { IInfoType } from '../../../types/IInfo';
|
|
|
6
6
|
import { ISplitAction, SplitButton } from '../../Button/SplitButton';
|
|
7
7
|
|
|
8
8
|
export interface IDialogFooterActions {
|
|
9
|
-
confirmButton
|
|
9
|
+
confirmButton?: {
|
|
10
10
|
label?: string;
|
|
11
11
|
icon?: IconDefinition;
|
|
12
12
|
onClick?: () => void;
|
|
@@ -48,7 +48,7 @@ export const DialogFooter: FC<Props> = ({
|
|
|
48
48
|
type,
|
|
49
49
|
}) => {
|
|
50
50
|
const { t } = useTranslation();
|
|
51
|
-
const ConfirmButton = confirmButton
|
|
51
|
+
const ConfirmButton = confirmButton?.splitActions ? SplitButton : Button;
|
|
52
52
|
|
|
53
53
|
return (
|
|
54
54
|
<div className="iui-dialog-actions">
|
|
@@ -77,20 +77,22 @@ export const DialogFooter: FC<Props> = ({
|
|
|
77
77
|
type="button"
|
|
78
78
|
/>
|
|
79
79
|
)}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
e
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
{confirmButton && (
|
|
81
|
+
<ConfirmButton
|
|
82
|
+
label={confirmButton.label || t('Confirm')}
|
|
83
|
+
icon={confirmButton.icon}
|
|
84
|
+
variant="solid"
|
|
85
|
+
type={confirmButton.type ?? (isForm ? 'submit' : 'button')}
|
|
86
|
+
onClick={e => {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
confirmButton.onClick?.();
|
|
89
|
+
!confirmButton.keepOpen && !isForm && onClose();
|
|
90
|
+
}}
|
|
91
|
+
color={(confirmButton.color ?? type === 'danger') ? 'danger' : undefined}
|
|
92
|
+
disabled={confirmButton.disabled}
|
|
93
|
+
splitActions={confirmButton.splitActions}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
94
96
|
</div>
|
|
95
97
|
);
|
|
96
98
|
};
|
|
@@ -52,7 +52,7 @@ export const Pullover: FC<Props> = ({
|
|
|
52
52
|
const { t } = useTranslation();
|
|
53
53
|
const searchRef = useRef<HTMLInputElement>(null);
|
|
54
54
|
|
|
55
|
-
const ConfirmButton = footer?.confirmButton
|
|
55
|
+
const ConfirmButton = footer?.confirmButton?.splitActions ? SplitButton : Button;
|
|
56
56
|
|
|
57
57
|
const { elementRef, isOpen, onClose } = useLocalPopoverControl({
|
|
58
58
|
control,
|
|
@@ -79,10 +79,10 @@ export const Pullover: FC<Props> = ({
|
|
|
79
79
|
onClose,
|
|
80
80
|
enter: {
|
|
81
81
|
onAction: () => {
|
|
82
|
-
footer?.confirmButton
|
|
83
|
-
!footer?.confirmButton
|
|
82
|
+
footer?.confirmButton?.onClick?.();
|
|
83
|
+
!footer?.confirmButton?.keepOpen && onClose();
|
|
84
84
|
},
|
|
85
|
-
disabled: !footer?.confirmButton
|
|
85
|
+
disabled: !footer?.confirmButton?.onClick,
|
|
86
86
|
},
|
|
87
87
|
search: {
|
|
88
88
|
onAction: () => searchRef.current?.focus(),
|
|
@@ -165,14 +165,20 @@ export const Pullover: FC<Props> = ({
|
|
|
165
165
|
onClick={onClose}
|
|
166
166
|
disabled={isFetching || isLoading}
|
|
167
167
|
/>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
{footer.confirmButton && (
|
|
169
|
+
<ConfirmButton
|
|
170
|
+
{...footer.confirmButton}
|
|
171
|
+
label={footer.confirmButton.label ?? t('Confirm')}
|
|
172
|
+
disabled={
|
|
173
|
+
footer.confirmButton.disabled || isFetching || isLoading
|
|
174
|
+
}
|
|
175
|
+
type={
|
|
176
|
+
(footer.confirmButton.type ?? onFormSubmit)
|
|
177
|
+
? 'submit'
|
|
178
|
+
: 'button'
|
|
179
|
+
}
|
|
180
|
+
/>
|
|
181
|
+
)}
|
|
176
182
|
</div>
|
|
177
183
|
)}
|
|
178
184
|
</ConditionalWrapper>
|