2022-08-26 12:54:03 +03:00
|
|
|
import { ReactNode } from 'react';
|
2017-06-03 22:12:04 -05:00
|
|
|
|
2017-11-17 13:06:47 -06:00
|
|
|
export type DialogProps = {
|
2017-11-13 09:54:04 -06:00
|
|
|
|
2017-06-03 22:12:04 -05:00
|
|
|
/**
|
|
|
|
|
* Whether cancel button is disabled. Enabled by default.
|
|
|
|
|
*/
|
2022-09-08 12:52:36 +03:00
|
|
|
cancelDisabled?: boolean;
|
2017-06-03 22:12:04 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Optional i18n key to change the cancel button title.
|
|
|
|
|
*/
|
2022-09-08 12:52:36 +03:00
|
|
|
cancelKey?: string;
|
2017-11-17 13:06:47 -06:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The React {@code Component} children which represents the dialog's body.
|
|
|
|
|
*/
|
2022-09-08 12:52:36 +03:00
|
|
|
children?: ReactNode;
|
2017-06-03 22:12:04 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Is ok button enabled/disabled. Enabled by default.
|
|
|
|
|
*/
|
2022-09-08 12:52:36 +03:00
|
|
|
okDisabled?: boolean;
|
2017-06-03 22:12:04 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Optional i18n key to change the ok button title.
|
|
|
|
|
*/
|
2022-09-08 12:52:36 +03:00
|
|
|
okKey?: string;
|
2017-06-03 22:12:04 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The handler for onCancel event.
|
|
|
|
|
*/
|
2023-04-24 14:09:50 +03:00
|
|
|
onCancel?: Function;
|
2017-06-03 22:12:04 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The handler for the event when submitting the dialog.
|
|
|
|
|
*/
|
2023-04-25 13:50:52 +03:00
|
|
|
onSubmit?: Function;
|
2017-06-03 22:12:04 -05:00
|
|
|
|
|
|
|
|
/**
|
2018-10-18 10:28:08 +02:00
|
|
|
* Additional style to be applied on the dialog.
|
|
|
|
|
*
|
|
|
|
|
* NOTE: Not all dialog types support this!
|
2017-06-03 22:12:04 -05:00
|
|
|
*/
|
2022-09-08 12:52:36 +03:00
|
|
|
style?: Object;
|
2017-06-03 22:12:04 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Key to use for showing a title.
|
|
|
|
|
*/
|
2022-09-08 12:52:36 +03:00
|
|
|
titleKey?: string;
|
2017-06-03 22:12:04 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The string to use as a title instead of {@code titleKey}. If a truthy
|
|
|
|
|
* value is specified, it takes precedence over {@code titleKey} i.e.
|
2021-11-04 22:10:43 +01:00
|
|
|
* The latter is unused.
|
2017-06-03 22:12:04 -05:00
|
|
|
*/
|
2022-09-08 12:52:36 +03:00
|
|
|
titleString?: string;
|
2017-06-03 22:12:04 -05:00
|
|
|
};
|
2018-10-18 10:28:08 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A preferred (or optimal) dialog size. This constant is reused in many
|
|
|
|
|
* components, where dialog size optimization is suggested.
|
|
|
|
|
*
|
|
|
|
|
* NOTE: Even though we support valious devices, including tablets, we don't
|
|
|
|
|
* want the dialogs to be oversized even on larger devices. This number seems
|
|
|
|
|
* to be a good compromise, but also easy to update.
|
|
|
|
|
*/
|
|
|
|
|
export const PREFERRED_DIALOG_SIZE = 300;
|