@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inceptionbg/iui",
3
- "version": "2.0.14",
3
+ "version": "2.0.15",
4
4
  "description": "UI components, elements & utils for Inception ecosystem",
5
5
  "type": "module",
6
6
  "exports": {
@@ -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.splitActions ? SplitButton : Button;
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
- <ConfirmButton
81
- label={confirmButton.label || t('Confirm')}
82
- icon={confirmButton.icon}
83
- variant="solid"
84
- type={confirmButton.type ?? (isForm ? 'submit' : 'button')}
85
- onClick={e => {
86
- e.stopPropagation();
87
- confirmButton.onClick?.();
88
- !confirmButton.keepOpen && !isForm && onClose();
89
- }}
90
- color={(confirmButton.color ?? type === 'danger') ? 'danger' : undefined}
91
- disabled={confirmButton.disabled}
92
- splitActions={confirmButton.splitActions}
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.splitActions ? SplitButton : Button;
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.onClick?.();
83
- !footer?.confirmButton.keepOpen && onClose();
82
+ footer?.confirmButton?.onClick?.();
83
+ !footer?.confirmButton?.keepOpen && onClose();
84
84
  },
85
- disabled: !footer?.confirmButton.onClick,
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
- <ConfirmButton
169
- {...footer.confirmButton}
170
- label={footer.confirmButton.label ?? t('Confirm')}
171
- disabled={footer.confirmButton.disabled || isFetching || isLoading}
172
- type={
173
- (footer.confirmButton.type ?? onFormSubmit) ? 'submit' : 'button'
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>