Merge branch 'develop' into feature/tileletEnhancements

This commit is contained in:
Krishna Kishore Bandaru 2024-03-07 14:00:28 +05:30
commit cb40014395
5 changed files with 47 additions and 21 deletions

View File

@ -16,7 +16,6 @@ class LoaderViewController: BaseViewController<Loader>, LoaderLaunchable {
override func viewDidLoad() {
super.viewDidLoad()
contentTopView.height(constant: 80)
addContentTopView(view: component)
setupPicker()
}

View File

@ -88,7 +88,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
MenuComponent(title: "RadioButtonGroup", completed: true, viewController: RadioButtonGroupViewController.self),
// //MenuComponent(title: "TabsContainer", completed: false, viewController: TabsContainerViewController.self),
MenuComponent(title: "Tabs", completed: true, viewController: TabsViewController.self),
MenuComponent(title: "TextArea", completed: false, viewController: TextAreaViewController.self),
MenuComponent(title: "TextArea", completed: true, viewController: TextAreaViewController.self),
MenuComponent(title: "TextLink", completed: true, viewController: TextLinkViewController.self),
MenuComponent(title: "TextLinkCaret", completed: true, viewController: TextLinkCaretViewController.self),
MenuComponent(title: "TileContainer", completed: true, viewController: TileContainerViewController.self),

View File

@ -5,7 +5,6 @@
// Created by Matt Bruce on 1/10/23.
//
import Foundation
import Foundation
import UIKit
import VDS
@ -23,28 +22,38 @@ class TextAreaViewController: BaseViewController<TextArea> {
var showErrorSwitch = Toggle()
var tooltipTitleTextField = TextField()
var tooltipContentTextField = TextField()
var maxLengthTextField = NumericField()
var readOnlySwitch = Toggle()
lazy var heightPickerSelectorView = {
PickerSelectorView(title: "2X",
picker: self.picker,
items: TextArea.Height.allCases)
}()
override func viewDidLoad() {
super.viewDidLoad()
addContentTopView(view: component)
component.text = "Starting Text"
setupPicker()
setupModel()
}
override func setupForm(){
super.setupForm()
super.setupForm()
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Required", view: requiredSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Helper Text", view: helperTextField)
addFormRow(label: "Read Only", view: readOnlySwitch)
addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error Text", view: errorTextField)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)
addFormRow(label: "ToolTip Content", view: tooltipContentTextField)
addFormRow(label: "Character Count", view: maxLengthTextField)
addFormRow(label: "Min Height", view: heightPickerSelectorView)
requiredSwitch.onChange = { [weak self] sender in
self?.component.required = sender.isOn
}
@ -61,6 +70,10 @@ class TextAreaViewController: BaseViewController<TextArea> {
self?.component.isEnabled = !sender.isOn
}
readOnlySwitch.onChange = { [weak self] sender in
self?.component.readOnly = sender.isOn
}
labelTextField
.textPublisher
.sink { [weak self] text in
@ -82,7 +95,10 @@ class TextAreaViewController: BaseViewController<TextArea> {
widthTextField
.numberPublisher
.sink { [weak self] number in
guard let number else { return }
guard let number else {
self?.component.width = nil
return
}
self?.component.width = number.cgFloatValue
}.store(in: &subscribers)
@ -98,6 +114,15 @@ class TextAreaViewController: BaseViewController<TextArea> {
self?.updateTooltip()
}.store(in: &subscribers)
maxLengthTextField
.numberPublisher
.sink { [weak self] number in
guard let number else {
self?.component.maxLength = nil
return
}
self?.component.maxLength = number.intValue
}.store(in: &subscribers)
}
func setupModel() {
@ -106,15 +131,14 @@ class TextAreaViewController: BaseViewController<TextArea> {
component.helperText = "For example: 123 Verizon St"
component.errorText = "Enter a valid address."
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
component
.publisher(for: .valueChanged)
.sink { component in
if let text = component.value {
print("text entry: \(text)")
} else {
print("text entry: null")
}
// if let text = component.value {
// print("text entry: \(text)")
// } else {
// print("text entry: null")
// }
}.store(in: &subscribers)
//setup UI
@ -135,6 +159,10 @@ class TextAreaViewController: BaseViewController<TextArea> {
self?.component.surface = item
self?.contentTopView.backgroundColor = item.color
}
heightPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.minHeight = item
}
}
func updateTooltip() {

View File

@ -22,7 +22,7 @@ class TileletViewController: BaseViewController<Tilelet> {
lazy var otherStandardStylePickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
items: Tilelet.SubTitleModel.StandardStyle.allCases.sorted{ $0.rawValue < $1.rawValue })
items: Tilelet.SubTitleModel.OtherStandardStyle.allCases.sorted{ $0.rawValue < $1.rawValue })
}()
lazy var subtitleColorPickerSelectorView = {
@ -195,8 +195,7 @@ class TileletViewController: BaseViewController<Tilelet> {
//setup UI
surfacePickerSelectorView.text = component.surface.rawValue
paddingPickerSelectorView.text = component.padding.rawValue
otherStandardStylePickerSelectorView.text = subTitleModel.standardStyle.rawValue
otherStandardStylePickerSelectorView.text = subTitleModel.otherStandardStyle.rawValue
titleStandardStylePickerSelectorView.text = titleModel.standardStyle.rawValue
subtitleColorPickerSelectorView.text = subTitleModel.textColor.rawValue
titleTextField.text = titleModel.text
@ -225,7 +224,7 @@ class TileletViewController: BaseViewController<Tilelet> {
func setSubTitleModel() {
if let text = subTitleTextField.text, !text.isEmpty {
component.subTitleModel = Tilelet.SubTitleModel(text: text, standardStyle: otherStandardStylePickerSelectorView.selectedItem)
component.subTitleModel = Tilelet.SubTitleModel(text: text, otherStandardStyle: otherStandardStylePickerSelectorView.selectedItem)
} else {
component.subTitleModel = nil
}
@ -233,7 +232,7 @@ class TileletViewController: BaseViewController<Tilelet> {
func updateOtherTextStyles() {
let items = component.titleLockup.standardStyleConfiguration.configuration(for: titleStandardStylePickerSelectorView.selectedItem.value)!.allOtherStandardStyles
let otheritems = items.compactMap { Tilelet.SubTitleModel.StandardStyle(rawValue: $0.rawValue)! }
let otheritems = items.compactMap { Tilelet.SubTitleModel.OtherStandardStyle(rawValue: $0.rawValue)! }
otherStandardStylePickerSelectorView.items = otheritems
otherStandardStylePickerSelectorView.text = otheritems.first?.rawValue ?? ""
setSubTitleModel()

View File

@ -106,7 +106,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
//setup UI
surfacePickerSelectorView.text = component.surface.rawValue
textAlignmentPickerSelectorView.text = TextAlignment.left.rawValue
otherStandardStylePickerSelectorView.text = subTitleModel.standardStyle.rawValue
otherStandardStylePickerSelectorView.text = subTitleModel.otherStandardStyle.rawValue
titleStandardStylePickerSelectorView.text = titleModel.standardStyle.rawValue
subtitleColorPickerSelectorView.text = subTitleModel.textColor.rawValue
eyebrowTextField.text = eyebrowModel.text
@ -139,7 +139,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
let style = otherStandardStylePickerSelectorView.selectedItem
if let text = subTitleTextField.text, !text.isEmpty {
component.subTitleModel = TitleLockup.SubTitleModel(text: text, standardStyle: style, textColor: subtitleColorPickerSelectorView.selectedItem)
component.subTitleModel = TitleLockup.SubTitleModel(text: text, otherStandardStyle: style, textColor: subtitleColorPickerSelectorView.selectedItem)
debug(type: "SubTitle", textStyle: style.value.regular)
} else {
component.subTitleModel = nil