@digital-ai/dot-components 4.12.0 → 4.13.0

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/index.esm.js CHANGED
@@ -8480,12 +8480,14 @@ const DotDialog = ({
8480
8480
  onCancel,
8481
8481
  onSubmit,
8482
8482
  open,
8483
+ secondaryButtonProps,
8483
8484
  submitButtonProps,
8484
8485
  title
8485
8486
  }) => {
8486
8487
  const rootClasses = useStylesWithRootClass(rootClassName$K, className);
8487
8488
  const cancelClasses = useStylesWithRootClass(cancelButtonProps === null || cancelButtonProps === void 0 ? void 0 : cancelButtonProps.className, 'cancel-button');
8488
8489
  const [isOpen, setIsOpen] = useState(open);
8490
+ const hasSecondaryAction = !!secondaryButtonProps;
8489
8491
  useEffect(() => {
8490
8492
  setIsOpen(open);
8491
8493
  }, [open]);
@@ -8534,7 +8536,7 @@ const DotDialog = ({
8534
8536
  root: `dot-dialog-content`
8535
8537
  },
8536
8538
  children: renderNodeOrTypography(children)
8537
- }), (hasPrimaryAction || cancelButtonVisible) && jsxs(DialogActions, {
8539
+ }), (hasPrimaryAction || cancelButtonVisible || hasSecondaryAction) && jsxs(DialogActions, {
8538
8540
  classes: {
8539
8541
  root: `dot-dialog-actions`
8540
8542
  },
@@ -8551,6 +8553,19 @@ const DotDialog = ({
8551
8553
  tooltip: cancelButtonProps === null || cancelButtonProps === void 0 ? void 0 : cancelButtonProps.tooltip,
8552
8554
  type: "text",
8553
8555
  children: (cancelButtonProps === null || cancelButtonProps === void 0 ? void 0 : cancelButtonProps.label) || 'Cancel'
8556
+ }), hasSecondaryAction && jsx(DotButton, {
8557
+ autoFocus: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.autoFocus,
8558
+ className: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.className,
8559
+ "data-pendoid": secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps['data-pendoid'],
8560
+ "data-testid": secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps['data-testid'],
8561
+ disableRipple: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.disableRipple,
8562
+ disabled: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.disabled,
8563
+ endIcon: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.endIcon,
8564
+ onClick: secondaryButtonProps.onClick,
8565
+ startIcon: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.startIcon,
8566
+ tooltip: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.tooltip,
8567
+ type: (secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.type) || 'primary',
8568
+ children: secondaryButtonProps.label
8554
8569
  }), hasPrimaryAction && jsx(DotButton, {
8555
8570
  autoFocus: submitButtonProps === null || submitButtonProps === void 0 ? void 0 : submitButtonProps.autoFocus,
8556
8571
  className: submitButtonProps === null || submitButtonProps === void 0 ? void 0 : submitButtonProps.className,
@@ -8579,6 +8594,7 @@ const DotConfirmationDialog = ({
8579
8594
  onCancel,
8580
8595
  onSubmit,
8581
8596
  submitButtonProps,
8597
+ secondaryButtonProps,
8582
8598
  open,
8583
8599
  title = ''
8584
8600
  }) => {
@@ -8596,6 +8612,7 @@ const DotConfirmationDialog = ({
8596
8612
  onSubmit: onSubmit,
8597
8613
  open: open,
8598
8614
  submitButtonProps: submitButtonProps,
8615
+ secondaryButtonProps: secondaryButtonProps,
8599
8616
  title: title,
8600
8617
  children: message
8601
8618
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -1,3 +1,3 @@
1
1
  import { DialogActions } from '@mui/material';
2
- export declare const StyledDashboardDialog: import("styled-components").StyledComponent<({ ariaLabel, cancelButtonProps, cancelButtonVisible, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, children, closeIconVisible, closeOnClickAway, closeOnSubmit, hasPrimaryAction, onCancel, onSubmit, open, submitButtonProps, title, }: import("../../dialog/Dialog").DialogProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
2
+ export declare const StyledDashboardDialog: import("styled-components").StyledComponent<({ ariaLabel, cancelButtonProps, cancelButtonVisible, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, children, closeIconVisible, closeOnClickAway, closeOnSubmit, hasPrimaryAction, onCancel, onSubmit, open, secondaryButtonProps, submitButtonProps, title, }: import("../../dialog/Dialog").DialogProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
3
3
  export declare const StyledDialogActions: import("styled-components").StyledComponent<typeof DialogActions, any, {}, never>;
@@ -1,6 +1,6 @@
1
1
  import { KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
2
  import { CommonProps } from '../CommonProps';
3
- import { DialogButtonProps, SubmitButtonProps } from '../dialog/Dialog';
3
+ import { DialogButtonProps, SecondaryActionButtonProps, SubmitButtonProps } from '../dialog/Dialog';
4
4
  export interface ConfirmationDialogProps extends CommonProps {
5
5
  /** Cancel button properties */
6
6
  cancelButtonProps?: DialogButtonProps;
@@ -12,9 +12,11 @@ export interface ConfirmationDialogProps extends CommonProps {
12
12
  onSubmit?: (event: MouseEvent | KeyboardEvent) => void;
13
13
  /** If true the dialog will be visible */
14
14
  open: boolean;
15
+ /** The secondary action button properties */
16
+ secondaryButtonProps?: SecondaryActionButtonProps;
15
17
  /** Submit button properties */
16
18
  submitButtonProps?: SubmitButtonProps;
17
19
  /** The dialog title */
18
20
  title?: ReactNode;
19
21
  }
20
- export declare const DotConfirmationDialog: ({ ariaLabel, cancelButtonProps, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, message, onCancel, onSubmit, submitButtonProps, open, title, }: ConfirmationDialogProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const DotConfirmationDialog: ({ ariaLabel, cancelButtonProps, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, message, onCancel, onSubmit, submitButtonProps, secondaryButtonProps, open, title, }: ConfirmationDialogProps) => import("react/jsx-runtime").JSX.Element;
@@ -9,6 +9,16 @@ export interface DialogButtonProps extends BaseButtonProps {
9
9
  /** The icon to display on the button */
10
10
  startIcon?: ReactNode;
11
11
  }
12
+ export interface SecondaryActionButtonProps extends BaseButtonProps {
13
+ /** Icon placed after the children. */
14
+ endIcon?: ReactNode;
15
+ /** The text displayed on the button */
16
+ label: string;
17
+ /** Event callback */
18
+ onClick: (event: MouseEvent<Element> | KeyboardEvent<Element>) => void;
19
+ /** The icon to display on the button */
20
+ startIcon?: ReactNode;
21
+ }
12
22
  export interface SubmitButtonProps extends DialogButtonProps {
13
23
  /** The type of button to be used */
14
24
  type?: 'primary' | 'destructive';
@@ -34,9 +44,11 @@ export interface DialogProps extends CommonProps {
34
44
  onSubmit?: (event: KeyboardEvent | MouseEvent) => void;
35
45
  /** if true, the dialog is visible to the user */
36
46
  open: boolean;
47
+ /** props passed down to the secondary action button */
48
+ secondaryButtonProps?: SecondaryActionButtonProps;
37
49
  /** props passed down to the submit button */
38
50
  submitButtonProps?: SubmitButtonProps;
39
51
  /** dialog heading */
40
52
  title: ReactNode;
41
53
  }
42
- export declare const DotDialog: ({ ariaLabel, cancelButtonProps, cancelButtonVisible, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, children, closeIconVisible, closeOnClickAway, closeOnSubmit, hasPrimaryAction, onCancel, onSubmit, open, submitButtonProps, title, }: DialogProps) => import("react/jsx-runtime").JSX.Element;
54
+ export declare const DotDialog: ({ ariaLabel, cancelButtonProps, cancelButtonVisible, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, children, closeIconVisible, closeOnClickAway, closeOnSubmit, hasPrimaryAction, onCancel, onSubmit, open, secondaryButtonProps, submitButtonProps, title, }: DialogProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  export declare const rootClassName = "dot-impact-dialog";
2
- export declare const StyledImpactDialog: import("styled-components").StyledComponent<({ ariaLabel, cancelButtonProps, cancelButtonVisible, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, children, closeIconVisible, closeOnClickAway, closeOnSubmit, hasPrimaryAction, onCancel, onSubmit, open, submitButtonProps, title, }: import("../dialog/Dialog").DialogProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
2
+ export declare const StyledImpactDialog: import("styled-components").StyledComponent<({ ariaLabel, cancelButtonProps, cancelButtonVisible, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, children, closeIconVisible, closeOnClickAway, closeOnSubmit, hasPrimaryAction, onCancel, onSubmit, open, secondaryButtonProps, submitButtonProps, title, }: import("../dialog/Dialog").DialogProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;