diff --git a/VDS/Components/Modal/Modal.swift b/VDS/Components/Modal/Modal.swift index 494b71b7..b99d99a8 100644 --- a/VDS/Components/Modal/Modal.swift +++ b/VDS/Components/Modal/Modal.swift @@ -80,6 +80,9 @@ open class Modal: Control, ModalLaunchable { title = nil content = nil contentView = nil + buttonData = nil + fullScreenDialog = false + hideCloseButton = false showModalButton.onClick = { _ in self.showModalButtonClick() } diff --git a/VDS/Components/Modal/ModalDialog.swift b/VDS/Components/Modal/ModalDialog.swift index 1f1987ce..ce03e88e 100644 --- a/VDS/Components/Modal/ModalDialog.swift +++ b/VDS/Components/Modal/ModalDialog.swift @@ -28,26 +28,6 @@ open class ModalDialog: View, UIScrollViewDelegate, ParentViewProtocol { super.init(coder: coder) } - //-------------------------------------------------- - // MARK: - Private Properties - //-------------------------------------------------- - private var scrollView = UIScrollView().with { - $0.translatesAutoresizingMaskIntoConstraints = false - $0.backgroundColor = .clear - } - - private let contentStackView = UIStackView().with { - $0.translatesAutoresizingMaskIntoConstraints = false - $0.axis = .vertical - $0.alignment = .leading - $0.distribution = .fillProportionally - $0.spacing = 0 - } - - lazy var primaryAccessibilityElement = UIAccessibilityElement(accessibilityContainer: self).with { - $0.accessibilityLabel = "Modal" - } - //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- @@ -79,18 +59,35 @@ open class ModalDialog: View, UIScrollViewDelegate, ParentViewProtocol { } //-------------------------------------------------- - // MARK: - Configuration + // MARK: - Private Properties //-------------------------------------------------- - // Min height content area 136 px. Total window height 232 px + private var scrollView = UIScrollView().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.backgroundColor = .clear + } + + private var contentStackView = UIStackView().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.axis = .vertical + $0.alignment = .leading + $0.distribution = .fillProportionally + $0.spacing = 0 + } + + lazy var primaryAccessibilityElement = UIAccessibilityElement(accessibilityContainer: self).with { + $0.accessibilityLabel = "Modal" + } + + // Min height for content area 136 px. Total window min height 232 px which is including top and bottom space. private var minHeight: CGFloat = 232.0 - // Max height content area. total window height: 70% of viewport height + // Max height is total window height. It is 70% of viewport height. private var maxHeight: CGFloat = 0.0 - // Min default width - private var minWidth: CGFloat = 560.0 + // Default width 560 px. A maximum width is only applied to a provided width and not to the default. + private var defaultWidth: CGFloat = 560.0 - // Max width: 70% of viewport width + // Max width: 70% of viewport width. private var maxWidth: CGFloat = 0.0 // close button with the 48 x 48 px @@ -104,7 +101,6 @@ open class ModalDialog: View, UIScrollViewDelegate, ParentViewProtocol { //-------------------------------------------------- // MARK: - Configuration Properties //-------------------------------------------------- - private let backgroundColorConfiguration = SurfaceColorConfiguration(VDSColor.backgroundPrimaryLight, VDSColor.backgroundPrimaryDark) private let textColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark) diff --git a/VDS/Components/Modal/ModalDialogViewController.swift b/VDS/Components/Modal/ModalDialogViewController.swift index 4d29a91f..834a1212 100644 --- a/VDS/Components/Modal/ModalDialogViewController.swift +++ b/VDS/Components/Modal/ModalDialogViewController.swift @@ -92,7 +92,7 @@ open class ModalDialogViewController: UIViewController, Surfaceable { // Activate constraints UIDevice.isIPad ? NSLayoutConstraint.activate([ - // Constraints for the floating modal view + // Constraints for the floating modal view for Tablet. modalDialog.centerXAnchor.constraint(equalTo: view.centerXAnchor), modalDialog.centerYAnchor.constraint(equalTo: view.centerYAnchor), modalDialog.leadingAnchor.constraint(greaterThanOrEqualTo: view.leadingAnchor), @@ -100,7 +100,7 @@ open class ModalDialogViewController: UIViewController, Surfaceable { modalDialog.topAnchor.constraint(greaterThanOrEqualTo: view.topAnchor), modalDialog.bottomAnchor.constraint(lessThanOrEqualTo: view.bottomAnchor) ]) : NSLayoutConstraint.activate([ - // Constraints for the floating modal view + // Constraints for fullscreen modal view for Phone. modalDialog.leadingAnchor.constraint(equalTo: view.leadingAnchor), modalDialog.trailingAnchor.constraint(equalTo: view.trailingAnchor), modalDialog.topAnchor.constraint(equalTo: view.topAnchor),