@digital-ai/dot-components 4.12.0 → 4.14.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
@@ -3491,6 +3491,7 @@ const DotMenuList = forwardRef(({
3491
3491
  "aria-label": itemAriaLabel,
3492
3492
  className: menuItemClasses,
3493
3493
  "data-pendoid": dataPendoId,
3494
+ "data-id": key,
3494
3495
  disabled: disabled,
3495
3496
  disableRipple: hasSubmenu,
3496
3497
  divider: divider,
@@ -8480,12 +8481,14 @@ const DotDialog = ({
8480
8481
  onCancel,
8481
8482
  onSubmit,
8482
8483
  open,
8484
+ secondaryButtonProps,
8483
8485
  submitButtonProps,
8484
8486
  title
8485
8487
  }) => {
8486
8488
  const rootClasses = useStylesWithRootClass(rootClassName$K, className);
8487
8489
  const cancelClasses = useStylesWithRootClass(cancelButtonProps === null || cancelButtonProps === void 0 ? void 0 : cancelButtonProps.className, 'cancel-button');
8488
8490
  const [isOpen, setIsOpen] = useState(open);
8491
+ const hasSecondaryAction = !!secondaryButtonProps;
8489
8492
  useEffect(() => {
8490
8493
  setIsOpen(open);
8491
8494
  }, [open]);
@@ -8534,7 +8537,7 @@ const DotDialog = ({
8534
8537
  root: `dot-dialog-content`
8535
8538
  },
8536
8539
  children: renderNodeOrTypography(children)
8537
- }), (hasPrimaryAction || cancelButtonVisible) && jsxs(DialogActions, {
8540
+ }), (hasPrimaryAction || cancelButtonVisible || hasSecondaryAction) && jsxs(DialogActions, {
8538
8541
  classes: {
8539
8542
  root: `dot-dialog-actions`
8540
8543
  },
@@ -8551,6 +8554,19 @@ const DotDialog = ({
8551
8554
  tooltip: cancelButtonProps === null || cancelButtonProps === void 0 ? void 0 : cancelButtonProps.tooltip,
8552
8555
  type: "text",
8553
8556
  children: (cancelButtonProps === null || cancelButtonProps === void 0 ? void 0 : cancelButtonProps.label) || 'Cancel'
8557
+ }), hasSecondaryAction && jsx(DotButton, {
8558
+ autoFocus: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.autoFocus,
8559
+ className: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.className,
8560
+ "data-pendoid": secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps['data-pendoid'],
8561
+ "data-testid": secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps['data-testid'],
8562
+ disableRipple: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.disableRipple,
8563
+ disabled: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.disabled,
8564
+ endIcon: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.endIcon,
8565
+ onClick: secondaryButtonProps.onClick,
8566
+ startIcon: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.startIcon,
8567
+ tooltip: secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.tooltip,
8568
+ type: (secondaryButtonProps === null || secondaryButtonProps === void 0 ? void 0 : secondaryButtonProps.type) || 'primary',
8569
+ children: secondaryButtonProps.label
8554
8570
  }), hasPrimaryAction && jsx(DotButton, {
8555
8571
  autoFocus: submitButtonProps === null || submitButtonProps === void 0 ? void 0 : submitButtonProps.autoFocus,
8556
8572
  className: submitButtonProps === null || submitButtonProps === void 0 ? void 0 : submitButtonProps.className,
@@ -8579,6 +8595,7 @@ const DotConfirmationDialog = ({
8579
8595
  onCancel,
8580
8596
  onSubmit,
8581
8597
  submitButtonProps,
8598
+ secondaryButtonProps,
8582
8599
  open,
8583
8600
  title = ''
8584
8601
  }) => {
@@ -8596,6 +8613,7 @@ const DotConfirmationDialog = ({
8596
8613
  onSubmit: onSubmit,
8597
8614
  open: open,
8598
8615
  submitButtonProps: submitButtonProps,
8616
+ secondaryButtonProps: secondaryButtonProps,
8599
8617
  title: title,
8600
8618
  children: message
8601
8619
  });
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.14.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>;