UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

95 lines (92 loc) 2.95 kB
import { BackgroundStyle } from '../common/Common'; import { ButtonConfiguration } from '../common/Common'; import { DeepPartial, PartiallyConstructible } from '../../utils'; import { ForegroundStyle } from '../common/Common'; import { StyledText } from '../common/Common'; /** Configuration of the the standard alert dialog. */ export class ScanbotAlertDialog extends PartiallyConstructible { /** The title displayed above the message. */ public title: StyledText = new StyledText({ text: 'Title', color: '?sbColorOnSurface' }); /** The explanation message. */ public subtitle: StyledText = new StyledText({ text: 'Standard explanation message text.', color: '?sbColorOnSurfaceVariant', }); /** The background color of the alert dialog. Default is "?sbColorSurface" */ public sheetColor: string = '?sbColorSurface'; /** The dialog overlay color. Default is "?sbColorModalOverlay" */ public modalOverlayColor: string = '?sbColorModalOverlay'; /** The color of the divider line. Default is "?sbColorOutline" */ public dividerColor: string = '?sbColorOutline'; /** Configuration of the 'OK' button. */ public okButton: ButtonConfiguration = new ButtonConfiguration({ background: new BackgroundStyle({ fillColor: '?sbColorPrimary' }), }); /** Configuration of the middle button for dialogs with tree buttons. */ public actionButton: ButtonConfiguration = new ButtonConfiguration({ visible: false, background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0, }), }); /** Configuration of the 'cancel' button. */ public cancelButton: ButtonConfiguration = new ButtonConfiguration({ visible: true, background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0, }), }); /** @param source {@displayType `DeepPartial<ScanbotAlertDialog>`} */ public constructor(source: DeepPartial<ScanbotAlertDialog> = {}) { super(); if (source.title !== undefined) { this.title = new StyledText(source.title); } if (source.subtitle !== undefined) { this.subtitle = new StyledText(source.subtitle); } if (source.sheetColor !== undefined) { this.sheetColor = source.sheetColor; } if (source.modalOverlayColor !== undefined) { this.modalOverlayColor = source.modalOverlayColor; } if (source.dividerColor !== undefined) { this.dividerColor = source.dividerColor; } if (source.okButton !== undefined) { this.okButton = new ButtonConfiguration(source.okButton); } if (source.actionButton !== undefined) { this.actionButton = new ButtonConfiguration(source.actionButton); } if (source.cancelButton !== undefined) { this.cancelButton = new ButtonConfiguration(source.cancelButton); } } }